mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-12 23:54:33 +00:00
fix the screen offset caused by moving the mouse at just the wrong moment
This commit is contained in:
parent
0ec5c00c18
commit
a3dbf0f9da
3 changed files with 20 additions and 24 deletions
|
@ -59,5 +59,6 @@ void x11_restore_vidmode (void);
|
||||||
void x11_create_window (int, int);
|
void x11_create_window (int, int);
|
||||||
void x11_grab_keyboard (void);
|
void x11_grab_keyboard (void);
|
||||||
void x11_set_caption (char *);
|
void x11_set_caption (char *);
|
||||||
|
void x11_force_view_port (void);
|
||||||
|
|
||||||
#endif // __CONTEXT_X11_H__
|
#endif // __CONTEXT_X11_H__
|
||||||
|
|
|
@ -98,8 +98,6 @@ static int xss_interval;
|
||||||
static int xss_blanking;
|
static int xss_blanking;
|
||||||
static int xss_exposures;
|
static int xss_exposures;
|
||||||
|
|
||||||
static int need_screen_warp;
|
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
x11_add_event (int event, void (*event_handler) (XEvent *))
|
x11_add_event (int event, void (*event_handler) (XEvent *))
|
||||||
{
|
{
|
||||||
|
@ -138,17 +136,6 @@ x11_process_event (void)
|
||||||
oktodraw = 1;
|
oktodraw = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef xHAVE_VIDMODE
|
|
||||||
if (need_screen_warp) {
|
|
||||||
int x, y;
|
|
||||||
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
|
||||||
if (x || y) {
|
|
||||||
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
|
||||||
} else {
|
|
||||||
need_screen_warp = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (event_handlers[x_event.type])
|
if (event_handlers[x_event.type])
|
||||||
event_handlers[x_event.type] (&x_event);
|
event_handlers[x_event.type] (&x_event);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +291,7 @@ x11_set_vidmode(int width, int height)
|
||||||
printf("%dx%d\n", vidmodes[i]->hdisplay, vidmodes[i]->vdisplay);
|
printf("%dx%d\n", vidmodes[i]->hdisplay, vidmodes[i]->vdisplay);
|
||||||
}
|
}
|
||||||
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
|
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
|
||||||
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
x11_force_view_port ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -369,19 +356,10 @@ x11_create_window (int width, int height)
|
||||||
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);
|
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);
|
||||||
|
|
||||||
if (vid_fullscreen->int_val) {
|
if (vid_fullscreen->int_val) {
|
||||||
int x, y;
|
|
||||||
|
|
||||||
XMoveWindow (x_disp, x_win, 0, 0);
|
XMoveWindow (x_disp, x_win, 0, 0);
|
||||||
XWarpPointer(x_disp, None, x_win, 0, 0, 0, 0,
|
XWarpPointer(x_disp, None, x_win, 0, 0, 0, 0,
|
||||||
vid.width+2, vid.height+2);
|
vid.width+2, vid.height+2);
|
||||||
need_screen_warp = 1;
|
x11_force_view_port ();
|
||||||
#ifdef HAVE_VIDMODE
|
|
||||||
do {
|
|
||||||
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
|
||||||
poll (0, 0, 50);
|
|
||||||
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
|
||||||
} while (x || y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XMapWindow (x_disp, x_win);
|
XMapWindow (x_disp, x_win);
|
||||||
|
@ -420,3 +398,19 @@ x11_set_caption (char *text)
|
||||||
if (x_disp && x_win && text)
|
if (x_disp && x_win && text)
|
||||||
XStoreName (x_disp, x_win, text);
|
XStoreName (x_disp, x_win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
x11_force_view_port (void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_VIDMODE
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
if (vid_fullscreen->int_val) {
|
||||||
|
do {
|
||||||
|
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
||||||
|
poll (0, 0, 50);
|
||||||
|
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
||||||
|
} while (x || y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -312,6 +312,7 @@ IN_Commands (void)
|
||||||
if (_windowed_mouse->int_val) { // grab the pointer
|
if (_windowed_mouse->int_val) { // grab the pointer
|
||||||
XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
|
XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
|
||||||
GrabModeAsync, x_win, None, CurrentTime);
|
GrabModeAsync, x_win, None, CurrentTime);
|
||||||
|
x11_force_view_port();
|
||||||
#ifdef HAVE_DGA
|
#ifdef HAVE_DGA
|
||||||
if (dga_avail && in_dga->int_val && !dga_active) {
|
if (dga_avail && in_dga->int_val && !dga_active) {
|
||||||
XF86DGADirectVideo (x_disp, DefaultScreen (x_disp),
|
XF86DGADirectVideo (x_disp, DefaultScreen (x_disp),
|
||||||
|
|
Loading…
Reference in a new issue