- Added GUICapture mouse events for Win32.

SVN r1415 (trunk)
This commit is contained in:
Randy Heit 2009-02-08 03:45:41 +00:00
parent 025e36ee41
commit 05a8a49ea5
3 changed files with 47 additions and 14 deletions

View file

@ -1,4 +1,5 @@
February 7, 2009 February 7, 2009
- Added GUICapture mouse events for Win32.
- Changed I_GetFromClipboard() to return an FString. - Changed I_GetFromClipboard() to return an FString.
- Added GTK+-based clipboard support for Linux. - Added GTK+-based clipboard support for Linux.
- Fixed: Most Linux filesystems do not fill in d_type for scandir(), so we - Fixed: Most Linux filesystems do not fill in d_type for scandir(), so we

View file

@ -38,6 +38,8 @@
#define HU_INPUTX 0 #define HU_INPUTX 0
#define HU_INPUTY (0 + (screen->Font->GetHeight () + 1)) #define HU_INPUTY (0 + (screen->Font->GetHeight () + 1))
void CT_PasteChat(const char *clip);
EXTERN_CVAR (Int, con_scaletext) EXTERN_CVAR (Int, con_scaletext)
EXTERN_CVAR (Bool, sb_cooperative_enable) EXTERN_CVAR (Bool, sb_cooperative_enable)
@ -150,20 +152,7 @@ bool CT_Responder (event_t *ev)
} }
else if (ev->data1 == 'V' && (ev->data3 & GKM_CTRL)) else if (ev->data1 == 'V' && (ev->data3 & GKM_CTRL))
{ {
FString clip = I_GetFromClipboard (); CT_PasteChat(I_GetFromClipboard());
if (clip.IsNotEmpty())
{
// Only paste the first line.
const char *clip_p = clip;
while (*clip_p)
{
if (*clip_p == '\n' || *clip_p == '\r' || *clip_p == '\b')
{
break;
}
CT_AddChar (*clip_p++);
}
}
} }
} }
else if (ev->subtype == EV_GUI_Char) else if (ev->subtype == EV_GUI_Char)
@ -180,11 +169,37 @@ bool CT_Responder (event_t *ev)
} }
return true; return true;
} }
else if (ev->subtype == EV_GUI_MButtonDown)
{
CT_PasteChat(I_GetFromClipboard());
}
} }
return false; return false;
} }
//===========================================================================
//
// CT_PasteChat
//
//===========================================================================
void CT_PasteChat(const char *clip)
{
if (clip != NULL)
{
// Only paste the first line.
while (*clip != '\0')
{
if (*clip == '\n' || *clip == '\r' || *clip == '\b')
{
break;
}
CT_AddChar (*clip++);
}
}
}
//=========================================================================== //===========================================================================
// //
// CT_Drawer // CT_Drawer

View file

@ -699,6 +699,23 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
DIKState[ActiveDIKState][event.data1] = (event.type == EV_KeyDown); DIKState[ActiveDIKState][event.data1] = (event.type == EV_KeyDown);
D_PostEvent (&event); D_PostEvent (&event);
} }
else if (GUICapture)
{
event.type = EV_GUI_Event;
if (message >= WM_LBUTTONDOWN && message <= WM_LBUTTONDBLCLK)
{
event.subtype = message - WM_LBUTTONDOWN + EV_GUI_LButtonDown;
}
else if (message >= WM_RBUTTONDOWN && message <= WM_RBUTTONDBLCLK)
{
event.subtype = message - WM_RBUTTONDOWN + EV_GUI_RButtonDown;
}
else if (message >= WM_MBUTTONDOWN && message <= WM_MBUTTONDBLCLK)
{
event.subtype = message - WM_MBUTTONDOWN + EV_GUI_MButtonDown;
}
D_PostEvent (&event);
}
break; break;
case WM_XBUTTONDOWN: case WM_XBUTTONDOWN: