mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- Stopped sending double the number of wheel events as appropriate to the
console under Linux. - Added middle mouse button selection pasting for X systems. SVN r1420 (trunk)
This commit is contained in:
parent
e55a97a18e
commit
035edb32ad
8 changed files with 112 additions and 79 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
February 9, 2009
|
||||||
|
- Stopped sending double the number of wheel events to the console under Linux.
|
||||||
|
- Added middle mouse button selection pasting for X systems.
|
||||||
|
|
||||||
February 8, 2009 (Changes by Graf Zahl)
|
February 8, 2009 (Changes by Graf Zahl)
|
||||||
- Fixed parsing for MustConfirm key in skill parser.
|
- Fixed parsing for MustConfirm key in skill parser.
|
||||||
- Converted internal MAPINFOs to new syntax.
|
- Converted internal MAPINFOs to new syntax.
|
||||||
|
@ -5,7 +9,7 @@ February 8, 2009 (Changes by Graf Zahl)
|
||||||
- Restored Dehacked music name replacement.
|
- Restored Dehacked music name replacement.
|
||||||
|
|
||||||
February 7, 2009
|
February 7, 2009
|
||||||
- Added GUICapture mouse events for Win32.
|
- Added GUICapture mouse button 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
|
||||||
|
|
|
@ -108,6 +108,7 @@ static int TopLine, InsertLine;
|
||||||
static char *BufferRover = ConsoleBuffer;
|
static char *BufferRover = ConsoleBuffer;
|
||||||
|
|
||||||
static void ClearConsole ();
|
static void ClearConsole ();
|
||||||
|
static void C_PasteText(FString clip, BYTE *buffer, int len);
|
||||||
|
|
||||||
struct GameAtExit
|
struct GameAtExit
|
||||||
{
|
{
|
||||||
|
@ -1735,11 +1736,31 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
|
||||||
buffer[2 + buffer[0]] = 0;
|
buffer[2 + buffer[0]] = 0;
|
||||||
I_PutInClipboard ((char *)&buffer[2]);
|
I_PutInClipboard ((char *)&buffer[2]);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // paste from clipboard
|
{ // paste from clipboard
|
||||||
FString clip = I_GetFromClipboard ();
|
C_PasteText(I_GetFromClipboard(false), buffer, len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef unix
|
||||||
|
case EV_GUI_MButtonDown:
|
||||||
|
C_PasteText(I_GetFromClipboard(true), buffer, len);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// Ensure that the cursor is always visible while typing
|
||||||
|
CursorTicker = C_BLINKRATE;
|
||||||
|
cursoron = 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void C_PasteText(FString clip, BYTE *buffer, int len)
|
||||||
|
{
|
||||||
if (clip.IsNotEmpty())
|
if (clip.IsNotEmpty())
|
||||||
{
|
{
|
||||||
// Only paste the first line.
|
// Only paste the first line.
|
||||||
|
@ -1766,16 +1787,6 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
|
||||||
HistPos = NULL;
|
HistPos = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Ensure that the cursor is always visible while typing
|
|
||||||
CursorTicker = C_BLINKRATE;
|
|
||||||
cursoron = 1;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_Responder (event_t *ev)
|
bool C_Responder (event_t *ev)
|
||||||
|
|
|
@ -152,7 +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))
|
||||||
{
|
{
|
||||||
CT_PasteChat(I_GetFromClipboard());
|
CT_PasteChat(I_GetFromClipboard(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ev->subtype == EV_GUI_Char)
|
else if (ev->subtype == EV_GUI_Char)
|
||||||
|
@ -169,10 +169,12 @@ bool CT_Responder (event_t *ev)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef unix
|
||||||
else if (ev->subtype == EV_GUI_MButtonDown)
|
else if (ev->subtype == EV_GUI_MButtonDown)
|
||||||
{
|
{
|
||||||
CT_PasteChat(I_GetFromClipboard());
|
CT_PasteChat(I_GetFromClipboard(true));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,7 +188,7 @@ bool CT_Responder (event_t *ev)
|
||||||
|
|
||||||
void CT_PasteChat(const char *clip)
|
void CT_PasteChat(const char *clip)
|
||||||
{
|
{
|
||||||
if (clip != NULL)
|
if (clip != NULL && *clip != '\0')
|
||||||
{
|
{
|
||||||
// Only paste the first line.
|
// Only paste the first line.
|
||||||
while (*clip != '\0')
|
while (*clip != '\0')
|
||||||
|
|
|
@ -284,6 +284,8 @@ static void MouseRead ()
|
||||||
static void WheelMoved(event_t *event)
|
static void WheelMoved(event_t *event)
|
||||||
{
|
{
|
||||||
if (GUICapture)
|
if (GUICapture)
|
||||||
|
{
|
||||||
|
if (event->type != EV_KeyUp)
|
||||||
{
|
{
|
||||||
SDLMod mod = SDL_GetModState();
|
SDLMod mod = SDL_GetModState();
|
||||||
event->type = EV_GUI_Event;
|
event->type = EV_GUI_Event;
|
||||||
|
@ -294,6 +296,7 @@ static void WheelMoved(event_t *event)
|
||||||
((mod & KMOD_ALT) ? GKM_ALT : 0);
|
((mod & KMOD_ALT) ? GKM_ALT : 0);
|
||||||
D_PostEvent(event);
|
D_PostEvent(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
D_PostEvent(event);
|
D_PostEvent(event);
|
||||||
|
@ -376,6 +379,8 @@ void MessagePump (const SDL_Event &sev)
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
if (!GUICapture || sev.button.button == 4 || sev.button.button == 5)
|
||||||
|
{
|
||||||
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||||
/* These button mappings work with my Gentoo system using the
|
/* These button mappings work with my Gentoo system using the
|
||||||
* evdev driver and a Logitech MX510 mouse. Whether or not they
|
* evdev driver and a Logitech MX510 mouse. Whether or not they
|
||||||
|
@ -412,6 +417,14 @@ void MessagePump (const SDL_Event &sev)
|
||||||
D_PostEvent(&event);
|
D_PostEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (sev.button.button >= 1 && sev.button.button <= 3)
|
||||||
|
{
|
||||||
|
event.type = EV_GUI_Event;
|
||||||
|
event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp;
|
||||||
|
event.subtype += (sev.button.button - 1) * 3;
|
||||||
|
D_PostEvent(&event);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define __I_INPUT_H__
|
#define __I_INPUT_H__
|
||||||
|
|
||||||
void I_PutInClipboard (const char *str);
|
void I_PutInClipboard (const char *str);
|
||||||
FString I_GetFromClipboard ();
|
FString I_GetFromClipboard (bool use_primary_selection);
|
||||||
|
|
||||||
struct GUIDName
|
struct GUIDName
|
||||||
{
|
{
|
||||||
|
|
|
@ -587,21 +587,24 @@ void I_PutInClipboard (const char *str)
|
||||||
{
|
{
|
||||||
gtk_clipboard_set_text(clipboard, str, -1);
|
gtk_clipboard_set_text(clipboard, str, -1);
|
||||||
}
|
}
|
||||||
|
/* Should I? I don't know. It's not actually a selection.
|
||||||
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||||
if (clipboard != NULL)
|
if (clipboard != NULL)
|
||||||
{
|
{
|
||||||
gtk_clipboard_set_text(clipboard, str, -1);
|
gtk_clipboard_set_text(clipboard, str, -1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FString I_GetFromClipboard ()
|
FString I_GetFromClipboard (bool use_primary_selection)
|
||||||
{
|
{
|
||||||
#ifndef NO_GTK
|
#ifndef NO_GTK
|
||||||
if (GtkAvailable)
|
if (GtkAvailable)
|
||||||
{
|
{
|
||||||
GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
|
GtkClipboard *clipboard = gtk_clipboard_get(use_primary_selection ?
|
||||||
|
GDK_SELECTION_PRIMARY : GDK_SELECTION_CLIPBOARD);
|
||||||
if (clipboard != NULL)
|
if (clipboard != NULL)
|
||||||
{
|
{
|
||||||
gchar *text = gtk_clipboard_wait_for_text(clipboard);
|
gchar *text = gtk_clipboard_wait_for_text(clipboard);
|
||||||
|
|
|
@ -2041,14 +2041,14 @@ void I_PutInClipboard (const char *str)
|
||||||
CloseClipboard ();
|
CloseClipboard ();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString I_GetFromClipboard ()
|
FString I_GetFromClipboard (bool return_nothing)
|
||||||
{
|
{
|
||||||
FString retstr;
|
FString retstr;
|
||||||
HGLOBAL cliphandle;
|
HGLOBAL cliphandle;
|
||||||
char *clipstr;
|
char *clipstr;
|
||||||
char *nlstr;
|
char *nlstr;
|
||||||
|
|
||||||
if (!IsClipboardFormatAvailable (CF_TEXT) || !OpenClipboard (Window))
|
if (return_nothing || !IsClipboardFormatAvailable (CF_TEXT) || !OpenClipboard (Window))
|
||||||
return retstr;
|
return retstr;
|
||||||
|
|
||||||
cliphandle = GetClipboardData (CF_TEXT);
|
cliphandle = GetClipboardData (CF_TEXT);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
bool I_InitInput (void *hwnd);
|
bool I_InitInput (void *hwnd);
|
||||||
void I_ShutdownInput ();
|
void I_ShutdownInput ();
|
||||||
void I_PutInClipboard (const char *str);
|
void I_PutInClipboard (const char *str);
|
||||||
FString I_GetFromClipboard ();
|
FString I_GetFromClipboard (bool windows_has_no_selection_clipboard);
|
||||||
|
|
||||||
void I_GetEvent ();
|
void I_GetEvent ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue