Fix recent console click quirks.
This commit is contained in:
parent
505061a8d2
commit
226c1cf6b4
|
@ -3294,7 +3294,7 @@ void Con_DrawConsole (int lines, qboolean noback)
|
||||||
}
|
}
|
||||||
selactive = Key_GetConsoleSelectionBox(con_current, &selsx, &selsy, &selex, &seley);
|
selactive = Key_GetConsoleSelectionBox(con_current, &selsx, &selsy, &selex, &seley);
|
||||||
|
|
||||||
if ((con_current->flags & CONF_KEEPSELECTION) && con_current->selstartline && con_current->selendline && con_current->buttonsdown != CB_SELECTED)
|
if ((con_current->flags & CONF_KEEPSELECTION) && con_current->selstartline && con_current->selendline && con_current->buttonsdown != CB_SELECTED && con_current->buttonsdown != CB_TAPPED)
|
||||||
selactive = -1;
|
selactive = -1;
|
||||||
|
|
||||||
Font_BeginString(font_console, x, y, &x, &y);
|
Font_BeginString(font_console, x, y, &x, &y);
|
||||||
|
@ -3329,14 +3329,18 @@ void Con_DrawConsole (int lines, qboolean noback)
|
||||||
mouseconsole = con_mouseover?con_mouseover:con_current;
|
mouseconsole = con_mouseover?con_mouseover:con_current;
|
||||||
|
|
||||||
|
|
||||||
if (con_current->buttonsdown == CB_SELECTED)
|
if (con_current->buttonsdown == CB_SELECTED || con_current->buttonsdown == CB_TAPPED)
|
||||||
{ //select was released...
|
{ //select was released...
|
||||||
console_t *con = con_current;
|
console_t *con = con_current;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
qboolean tapped = con->buttonsdown==CB_TAPPED;
|
||||||
con->buttonsdown = CB_NONE;
|
con->buttonsdown = CB_NONE;
|
||||||
if (con->selstartline)
|
if (con->selstartline)
|
||||||
{
|
{
|
||||||
con->flags |= CONF_KEEPSELECTION;
|
if (tapped)
|
||||||
|
con->flags &= ~CONF_KEEPSELECTION;
|
||||||
|
else
|
||||||
|
con->flags |= CONF_KEEPSELECTION;
|
||||||
if (con->userline)
|
if (con->userline)
|
||||||
{
|
{
|
||||||
if (con->flags & CONF_BACKSELECTION)
|
if (con->flags & CONF_BACKSELECTION)
|
||||||
|
@ -3427,6 +3431,57 @@ void Con_DrawOneConsole(console_t *con, qboolean focused, struct font_s *font, f
|
||||||
con->display = con->current;
|
con->display = con->current;
|
||||||
Con_DrawConsoleLines(con, con->display, con->displayscroll, x, sx, sy, y, selactive, selsx, selex, selsy, seley, lineagelimit);
|
Con_DrawConsoleLines(con, con->display, con->displayscroll, x, sx, sy, y, selactive, selsx, selex, selsy, seley, lineagelimit);
|
||||||
|
|
||||||
|
|
||||||
|
if (con->buttonsdown == CB_SELECTED || con->buttonsdown == CB_TAPPED)
|
||||||
|
{ //select was released...
|
||||||
|
char *buffer;
|
||||||
|
qboolean tapped = con->buttonsdown==CB_TAPPED;
|
||||||
|
con->buttonsdown = CB_NONE;
|
||||||
|
if (con->selstartline)
|
||||||
|
{
|
||||||
|
if (tapped)
|
||||||
|
con->flags &= ~CONF_KEEPSELECTION;
|
||||||
|
else
|
||||||
|
con->flags |= CONF_KEEPSELECTION;
|
||||||
|
if (con->userline)
|
||||||
|
{
|
||||||
|
if (con->flags & CONF_BACKSELECTION)
|
||||||
|
{
|
||||||
|
con->userline = con->selendline;
|
||||||
|
con->useroffset = con->selendoffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
con->userline = con->selstartline;
|
||||||
|
con->useroffset = con->selstartoffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (con->selstartline == con->selendline && con->selendoffset <= con->selstartoffset+1)
|
||||||
|
{
|
||||||
|
if (keydown[K_LSHIFT] || keydown[K_RSHIFT])
|
||||||
|
;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer = Con_CopyConsole(con, false, true, false);
|
||||||
|
if (buffer)
|
||||||
|
{
|
||||||
|
Key_HandleConsoleLink(con, buffer);
|
||||||
|
Z_Free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer = Con_CopyConsole(con, true, false, true); //don't keep markup if we're copying to the clipboard
|
||||||
|
if (buffer)
|
||||||
|
{
|
||||||
|
Sys_SaveClipboard(CBT_SELECTION, buffer);
|
||||||
|
Z_Free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Font_EndString(font);
|
Font_EndString(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -761,7 +761,7 @@ qboolean Key_GetConsoleSelectionBox(console_t *con, int *sx, int *sy, int *ex, i
|
||||||
*ey = con->mousecursor[1];
|
*ey = con->mousecursor[1];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (con->buttonsdown == CB_SELECT || con->buttonsdown == CB_SELECTED)
|
else if (con->buttonsdown == CB_SELECT || con->buttonsdown == CB_SELECTED || con->buttonsdown == CB_TAPPED)
|
||||||
{
|
{
|
||||||
//right-mouse
|
//right-mouse
|
||||||
//select. copy-to-clipboard on release.
|
//select. copy-to-clipboard on release.
|
||||||
|
@ -1219,7 +1219,10 @@ void Key_ConsoleRelease(console_t *con, int key, unsigned int unicode)
|
||||||
|
|
||||||
if ((key == K_TOUCHTAP || key == K_MOUSE1) && con->buttonsdown == CB_SELECT)
|
if ((key == K_TOUCHTAP || key == K_MOUSE1) && con->buttonsdown == CB_SELECT)
|
||||||
{
|
{
|
||||||
con->buttonsdown = CB_SELECTED;
|
if (fabs(con->mousedown[0] - con->mousecursor[0]) < 5 && fabs(con->mousedown[1] - con->mousecursor[1]) < 5 && realtime < con->mousedowntime + 0.4)
|
||||||
|
con->buttonsdown = CB_TAPPED; //don't leave it selected.
|
||||||
|
else
|
||||||
|
con->buttonsdown = CB_SELECTED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((key == K_TOUCHSLIDE || key == K_MOUSE1) && con->buttonsdown == CB_SCROLL)// || (key == K_MOUSE2 && con->buttonsdown == CB_SCROLL_R))
|
if ((key == K_TOUCHSLIDE || key == K_MOUSE1) && con->buttonsdown == CB_SCROLL)// || (key == K_MOUSE2 && con->buttonsdown == CB_SCROLL_R))
|
||||||
|
@ -1276,7 +1279,7 @@ void Key_ConsoleRelease(console_t *con, int key, unsigned int unicode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (con->buttonsdown == CB_SELECTED)
|
if (con->buttonsdown == CB_SELECTED || con->buttonsdown == CB_TAPPED)
|
||||||
; //will time out in the drawing code.
|
; //will time out in the drawing code.
|
||||||
else
|
else
|
||||||
// if (con->buttonsdown == CB_MOVE) //window title(move)
|
// if (con->buttonsdown == CB_MOVE) //window title(move)
|
||||||
|
|
|
@ -124,7 +124,8 @@ enum
|
||||||
CB_MOVE = 4,
|
CB_MOVE = 4,
|
||||||
CB_ACTIONBAR = 5,
|
CB_ACTIONBAR = 5,
|
||||||
CB_SELECT = 6,
|
CB_SELECT = 6,
|
||||||
CB_SELECTED = 7,
|
CB_SELECTED = 7, //selection ended (deferred until drawing to ensure selections happen properly)
|
||||||
|
CB_TAPPED = 8, //quick-tap ended (deferred until drawing to ensure selections happen properly)
|
||||||
|
|
||||||
//the flags part
|
//the flags part
|
||||||
CB_STALE = (1u<<28), //WAS held last frame - to make sure we still do stuff when released on the same frame.
|
CB_STALE = (1u<<28), //WAS held last frame - to make sure we still do stuff when released on the same frame.
|
||||||
|
|
Loading…
Reference in New Issue