[metacity] add more checks for override-redirect windows
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] add more checks for override-redirect windows
- Date: Tue, 28 Feb 2017 01:56:20 +0000 (UTC)
commit 7dcfa098d8658ab7005ca617dab40751e56c8268
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Feb 28 03:45:41 2017 +0200
add more checks for override-redirect windows
src/core/display.c | 39 +++++++++++++++++------------
src/core/window-private.h | 3 ++
src/core/window.c | 61 +++++++++++++++++++++++++++++++++++++-------
3 files changed, 77 insertions(+), 26 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index bcee417..f0817b3 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1600,7 +1600,8 @@ event_callback (XEvent *event,
}
}
- if (window && ((event->type == KeyPress) || (event->type == ButtonPress)))
+ if (window && window && !window->override_redirect &&
+ ((event->type == KeyPress) || (event->type == ButtonPress)))
{
if (CurrentTime == display->current_time)
{
@@ -2042,7 +2043,8 @@ event_callback (XEvent *event,
"Window %s withdrawn\n",
window->desc);
- meta_effect_run_close (window, NULL, NULL);
+ if (!window->override_redirect)
+ meta_effect_run_close (window, NULL, NULL);
/* Unmanage withdrawn window */
window->withdrawn = TRUE;
@@ -2121,24 +2123,29 @@ event_callback (XEvent *event,
&event->xconfigure);
}
- /* Handle screen resize */
- {
- if (event->xconfigure.window == screen->xroot)
- {
+ if (window && window->override_redirect)
+ {
+ meta_window_configure_notify (window, &event->xconfigure);
+ }
+ else
+ {
+ /* Handle screen resize */
+ if (event->xconfigure.window == screen->xroot)
+ {
#ifdef HAVE_RANDR
- /* do the resize the official way */
- XRRUpdateConfiguration (event);
+ /* do the resize the official way */
+ XRRUpdateConfiguration (event);
#else
- /* poke around in Xlib */
- screen->xscreen->width = event->xconfigure.width;
- screen->xscreen->height = event->xconfigure.height;
+ /* poke around in Xlib */
+ screen->xscreen->width = event->xconfigure.width;
+ screen->xscreen->height = event->xconfigure.height;
#endif
- meta_screen_resize (screen,
- event->xconfigure.width,
- event->xconfigure.height);
- }
- }
+ meta_screen_resize (screen,
+ event->xconfigure.width,
+ event->xconfigure.height);
+ }
+ }
break;
case ConfigureRequest:
/* This comment and code is found in both twm and fvwm */
diff --git a/src/core/window-private.h b/src/core/window-private.h
index da336a3..35c8ac8 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -687,4 +687,7 @@ gboolean meta_window_is_client_decorated (MetaWindow *window);
void meta_window_get_titlebar_rect (MetaWindow *window,
MetaRectangle *titlebar_rect);
+void meta_window_configure_notify (MetaWindow *window,
+ XConfigureEvent *event);
+
#endif
diff --git a/src/core/window.c b/src/core/window.c
index 706272a..f4f090f 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -357,6 +357,9 @@ meta_window_new_with_attrs (MetaDisplay *display,
PropertyChangeMask | EnterWindowMask | LeaveWindowMask |
FocusChangeMask | ColormapChangeMask;
+ if (attrs->override_redirect)
+ event_mask |= StructureNotifyMask;
+
XSelectInput (display->xdisplay, xwindow, event_mask);
has_shape = FALSE;
@@ -590,6 +593,16 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->initial_workspace = 0; /* not used */
window->initial_timestamp = 0; /* not used */
+ if (window->override_redirect)
+ {
+ window->decorated = FALSE;
+ window->always_sticky = TRUE;
+ window->has_close_func = FALSE;
+ window->has_shade_func = FALSE;
+ window->has_move_func = FALSE;
+ window->has_resize_func = FALSE;
+ }
+
meta_display_register_x_window (display, &window->xwindow, window);
/* assign the window to its group, or create a new group if needed
@@ -665,14 +678,15 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_window_ensure_frame (window);
meta_window_grab_keys (window);
- if (window->type != META_WINDOW_DOCK)
+ if (window->type != META_WINDOW_DOCK && !window->override_redirect)
{
meta_display_grab_window_buttons (window->display, window->xwindow);
meta_display_grab_focus_window_button (window->display, window);
}
if (window->type == META_WINDOW_DESKTOP ||
- window->type == META_WINDOW_DOCK)
+ window->type == META_WINDOW_DOCK ||
+ window->override_redirect)
{
/* Change the default, but don't enforce this if the user
* focuses the dock/desktop and unsticks it using key shortcuts.
@@ -804,11 +818,14 @@ meta_window_new_with_attrs (MetaDisplay *display,
}
}
- /* FIXME we have a tendency to set this then immediately
- * change it again.
- */
- set_wm_state (window, window->iconic ? IconicState : NormalState);
- set_net_wm_state (window);
+ if (!window->override_redirect)
+ {
+ /* FIXME we have a tendency to set this then immediately
+ * change it again.
+ */
+ set_wm_state (window, window->iconic ? IconicState : NormalState);
+ set_net_wm_state (window);
+ }
/* Sync stack changes */
meta_stack_thaw (window->screen->stack);
@@ -4004,6 +4021,25 @@ idle_move_resize (gpointer data)
return FALSE;
}
+/* This is used to notify us of an unrequested configuration (only
+ * applicable to override redirect windows)
+ */
+void
+meta_window_configure_notify (MetaWindow *window,
+ XConfigureEvent *event)
+{
+ g_assert (window->override_redirect);
+ g_assert (window->frame == NULL);
+
+ window->rect.x = event->x;
+ window->rect.y = event->y;
+ window->rect.width = event->width;
+ window->rect.height = event->height;
+
+ if (!event->override_redirect && !event->send_event)
+ meta_warning ("Unhandled change of windows override redirect status\n");
+}
+
void
meta_window_get_position (MetaWindow *window,
int *x,
@@ -5896,6 +5932,8 @@ send_configure_notify (MetaWindow *window)
{
XEvent event;
+ g_return_if_fail (!window->override_redirect);
+
/* from twm */
event.type = ConfigureNotify;
@@ -6490,7 +6528,8 @@ recalc_window_type (MetaWindow *window)
{
recalc_window_features (window);
- set_net_wm_state (window);
+ if (!window->override_redirect)
+ set_net_wm_state (window);
/* Update frame */
if (window->decorated)
@@ -6658,12 +6697,14 @@ recalc_window_features (MetaWindow *window)
}
if (window->type == META_WINDOW_DESKTOP ||
- window->type == META_WINDOW_DOCK)
+ window->type == META_WINDOW_DOCK ||
+ window->override_redirect)
window->always_sticky = TRUE;
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
- window->type == META_WINDOW_SPLASHSCREEN)
+ window->type == META_WINDOW_SPLASHSCREEN ||
+ window->override_redirect)
{
window->decorated = FALSE;
window->has_close_func = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]