- 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 110 additions and 77 deletions
|
|
@ -108,6 +108,7 @@ static int TopLine, InsertLine;
|
|||
static char *BufferRover = ConsoleBuffer;
|
||||
|
||||
static void ClearConsole ();
|
||||
static void C_PasteText(FString clip, BYTE *buffer, int len);
|
||||
|
||||
struct GameAtExit
|
||||
{
|
||||
|
|
@ -1735,42 +1736,22 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
|
|||
buffer[2 + buffer[0]] = 0;
|
||||
I_PutInClipboard ((char *)&buffer[2]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ // paste from clipboard
|
||||
FString clip = I_GetFromClipboard ();
|
||||
if (clip.IsNotEmpty())
|
||||
{
|
||||
// Only paste the first line.
|
||||
long brk = clip.IndexOfAny("\r\n\b");
|
||||
int cliplen = brk >= 0 ? brk : clip.Len();
|
||||
|
||||
// Make sure there's room for the whole thing.
|
||||
if (buffer[0] + cliplen > len)
|
||||
{
|
||||
cliplen = len - buffer[0];
|
||||
}
|
||||
|
||||
if (cliplen > 0)
|
||||
{
|
||||
if (buffer[1] < buffer[0])
|
||||
{
|
||||
memmove (&buffer[2 + buffer[1] + cliplen],
|
||||
&buffer[2 + buffer[1]], buffer[0] - buffer[1]);
|
||||
}
|
||||
memcpy (&buffer[2 + buffer[1]], clip, cliplen);
|
||||
buffer[0] += cliplen;
|
||||
buffer[1] += cliplen;
|
||||
makestartposgood ();
|
||||
HistPos = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
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;
|
||||
|
|
@ -1778,6 +1759,36 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void C_PasteText(FString clip, BYTE *buffer, int len)
|
||||
{
|
||||
if (clip.IsNotEmpty())
|
||||
{
|
||||
// Only paste the first line.
|
||||
long brk = clip.IndexOfAny("\r\n\b");
|
||||
int cliplen = brk >= 0 ? brk : clip.Len();
|
||||
|
||||
// Make sure there's room for the whole thing.
|
||||
if (buffer[0] + cliplen > len)
|
||||
{
|
||||
cliplen = len - buffer[0];
|
||||
}
|
||||
|
||||
if (cliplen > 0)
|
||||
{
|
||||
if (buffer[1] < buffer[0])
|
||||
{
|
||||
memmove (&buffer[2 + buffer[1] + cliplen],
|
||||
&buffer[2 + buffer[1]], buffer[0] - buffer[1]);
|
||||
}
|
||||
memcpy (&buffer[2 + buffer[1]], clip, cliplen);
|
||||
buffer[0] += cliplen;
|
||||
buffer[1] += cliplen;
|
||||
makestartposgood ();
|
||||
HistPos = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool C_Responder (event_t *ev)
|
||||
{
|
||||
if (ev->type != EV_GUI_Event ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue