gdk: visibility, RandR and event time fixes from GTK 3
Backported from GTK 3: - client-side windows get visibility events when they ask - unplugging a monitor while RandR is read no longer kills the program - transient-for an offscreen window is ignored - win32 event times survive 49.7 days of uptime - win32 modifier keys are marked as such - quartz moves windows in begin_move_drag - quartz skips offscreen windows on monitor changes Upstream commits: - 7ec927a386 (Alexander Larsson) - 4cf5ce2e08 (Charles Reiss) - 394fe4b57e (Ryan Lortie) - f3f998efd7 (fiddlerwoaroof) - 0c72ce94ea (Luca Bacci) - f74f81f06b (Руслан Ижбулатов) - 0274b2c94e (Руслан Ижбулатов)
This commit is contained in:
parent
25d594e965
commit
02596a975f
9 changed files with 70 additions and 15 deletions
|
|
@ -830,7 +830,7 @@ gdk_window_update_visibility (GdkWindowObject *private)
|
|||
private->effective_visibility = new_visibility;
|
||||
|
||||
if (new_visibility != GDK_VISIBILITY_NOT_VIEWABLE &&
|
||||
private->event_mask & GDK_VISIBILITY_NOTIFY)
|
||||
private->event_mask & GDK_VISIBILITY_NOTIFY_MASK)
|
||||
{
|
||||
event = _gdk_make_event ((GdkWindow *)private, GDK_VISIBILITY_NOTIFY,
|
||||
NULL, FALSE);
|
||||
|
|
|
|||
|
|
@ -429,9 +429,13 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)isInManualResize
|
||||
/* Used by gdkevents-quartz.c to decide if our sendEvent() handler above
|
||||
* will see the event or if it will be subjected to standard processing
|
||||
* by GDK.
|
||||
*/
|
||||
-(BOOL)isInManualResizeOrMove
|
||||
{
|
||||
return inManualResize;
|
||||
return inManualResize || inManualMove;
|
||||
}
|
||||
|
||||
-(void)beginManualResize
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
-(BOOL)isInMove;
|
||||
-(void)beginManualMove;
|
||||
-(BOOL)trackManualMove;
|
||||
-(BOOL)isInManualResize;
|
||||
-(BOOL)isInManualResizeOrMove;
|
||||
-(void)beginManualResize;
|
||||
-(BOOL)trackManualResize;
|
||||
-(void)showAndMakeKey:(BOOL)makeKey;
|
||||
|
|
|
|||
|
|
@ -1393,10 +1393,10 @@ gdk_event_translate (GdkEvent *event,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Also when in a manual resize, we ignore events so that these are
|
||||
* pushed to GdkQuartzWindow's sendEvent handler.
|
||||
/* Also when in a manual resize or move, we ignore events so that
|
||||
* these are pushed to GdkQuartzWindow's sendEvent handler.
|
||||
*/
|
||||
if ([(GdkQuartzWindow *)nswindow isInManualResize])
|
||||
if ([(GdkQuartzWindow *)nswindow isInManualResizeOrMove])
|
||||
return FALSE;
|
||||
|
||||
/* Find the right GDK window to send the event to, taking grabs and
|
||||
|
|
|
|||
|
|
@ -1131,7 +1131,13 @@ _gdk_windowing_update_window_sizes (GdkScreen *screen)
|
|||
windows = gdk_screen_get_toplevel_windows (screen);
|
||||
|
||||
for (list = windows; list; list = list->next)
|
||||
_gdk_quartz_window_update_position (list->data);
|
||||
{
|
||||
/* Offscreen windows have no NSWindow to take the position from */
|
||||
if (GDK_WINDOW_TYPE (list->data) == GDK_WINDOW_OFFSCREEN)
|
||||
continue;
|
||||
|
||||
_gdk_quartz_window_update_position (list->data);
|
||||
}
|
||||
|
||||
g_list_free (windows);
|
||||
}
|
||||
|
|
@ -2278,8 +2284,11 @@ gdk_window_set_transient_for (GdkWindow *window,
|
|||
GdkWindowImplQuartz *window_impl;
|
||||
GdkWindowImplQuartz *parent_impl;
|
||||
|
||||
/* an offscreen window, or a child of one, has no NSWindow to be
|
||||
* transient for */
|
||||
if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (parent) ||
|
||||
!WINDOW_IS_TOPLEVEL (window))
|
||||
!WINDOW_IS_TOPLEVEL (window) ||
|
||||
!GDK_IS_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (parent)->impl))
|
||||
return;
|
||||
|
||||
window_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,9 @@ _gdk_win32_get_next_tick (gulong suggested_tick)
|
|||
|
||||
if (suggested_tick == 0)
|
||||
suggested_tick = GetTickCount ();
|
||||
if (suggested_tick <= cur_tick)
|
||||
/* Ticks eventually wrap around.
|
||||
* This works as long as the interval between ticks is < 2147483648ms */
|
||||
if (suggested_tick <= cur_tick && ((cur_tick - suggested_tick) < 0x7FFFFFFF))
|
||||
return cur_tick;
|
||||
else
|
||||
return cur_tick = suggested_tick;
|
||||
|
|
@ -2352,6 +2354,10 @@ gdk_event_translate (MSG *msg,
|
|||
LOBYTE (HIWORD (msg->lParam)) == _gdk_win32_keymap_get_rshift_scancode (GDK_WIN32_KEYMAP (gdk_keymap_get_default ())))
|
||||
event->key.hardware_keycode = VK_RSHIFT;
|
||||
|
||||
event->key.is_modifier = (msg->wParam == VK_CONTROL ||
|
||||
msg->wParam == VK_SHIFT ||
|
||||
msg->wParam == VK_MENU);
|
||||
|
||||
/* g_print ("ctrl:%02x lctrl:%02x rctrl:%02x alt:%02x lalt:%02x ralt:%02x\n", key_state[VK_CONTROL], key_state[VK_LCONTROL], key_state[VK_RCONTROL], key_state[VK_MENU], key_state[VK_LMENU], key_state[VK_RMENU]); */
|
||||
|
||||
build_key_event_state (event, key_state);
|
||||
|
|
|
|||
|
|
@ -2154,12 +2154,20 @@ gdk_window_set_transient_for (GdkWindow *window,
|
|||
GdkWindow *parent)
|
||||
{
|
||||
HWND window_id, parent_id;
|
||||
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
||||
GdkWindowImplWin32 *window_impl;
|
||||
GdkWindowImplWin32 *parent_impl = NULL;
|
||||
GSList *item;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
/* an offscreen window, or a child of one, has no HWND and no
|
||||
* GdkWindowImplWin32 to keep the transient relationship in */
|
||||
if (!GDK_IS_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl) ||
|
||||
(parent != NULL &&
|
||||
!GDK_IS_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (parent)->impl)))
|
||||
return;
|
||||
|
||||
window_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
||||
window_id = GDK_WINDOW_HWND (window);
|
||||
parent_id = parent != NULL ? GDK_WINDOW_HWND (parent) : NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -903,8 +903,21 @@ init_randr13 (GdkScreen *screen)
|
|||
|
||||
for (i = 0; i < resources->noutput; ++i)
|
||||
{
|
||||
XRROutputInfo *output =
|
||||
XRRGetOutputInfo (dpy, resources, resources->outputs[i]);
|
||||
XRROutputInfo *output;
|
||||
gint error;
|
||||
|
||||
/* an output can go away before we ask about it; the X error
|
||||
* this gives must not end the program */
|
||||
gdk_error_trap_push ();
|
||||
output = XRRGetOutputInfo (dpy, resources, resources->outputs[i]);
|
||||
error = gdk_error_trap_pop ();
|
||||
|
||||
if (output == NULL || error)
|
||||
{
|
||||
if (output)
|
||||
XRRFreeOutputInfo (output);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Non RandR1.2 X driver have output name "default" */
|
||||
randr12_compat |= !g_strcmp0 (output->name, "default");
|
||||
|
|
@ -918,7 +931,19 @@ init_randr13 (GdkScreen *screen)
|
|||
if (output->crtc)
|
||||
{
|
||||
GdkX11Monitor monitor;
|
||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, output->crtc);
|
||||
XRRCrtcInfo *crtc;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
crtc = XRRGetCrtcInfo (dpy, resources, output->crtc);
|
||||
error = gdk_error_trap_pop ();
|
||||
|
||||
if (crtc == NULL || error)
|
||||
{
|
||||
if (crtc)
|
||||
XRRFreeCrtcInfo (crtc);
|
||||
XRRFreeOutputInfo (output);
|
||||
continue;
|
||||
}
|
||||
|
||||
monitor.geometry.x = crtc->x;
|
||||
monitor.geometry.y = crtc->y;
|
||||
|
|
|
|||
|
|
@ -2829,8 +2829,11 @@ void
|
|||
gdk_window_set_transient_for (GdkWindow *window,
|
||||
GdkWindow *parent)
|
||||
{
|
||||
/* an offscreen window, or a child of one, has no X window to be
|
||||
* transient for */
|
||||
if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent) &&
|
||||
WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
WINDOW_IS_TOPLEVEL_OR_FOREIGN (window) &&
|
||||
GDK_WINDOW_IS_X11 (parent))
|
||||
XSetTransientForHint (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window),
|
||||
GDK_WINDOW_XID (parent));
|
||||
|
|
|
|||
Loading…
Reference in a new issue