mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
Move UI and key grabs to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
parent
6458139c04
commit
d79ffd3976
@ -65,7 +65,7 @@ meta_window_ensure_frame (MetaWindow *window)
|
|||||||
frame->rect.x, frame->rect.y,
|
frame->rect.x, frame->rect.y,
|
||||||
frame->rect.width, frame->rect.height);
|
frame->rect.width, frame->rect.height);
|
||||||
|
|
||||||
frame->ui_frame = meta_ui_create_frame (window->screen->ui,
|
frame->ui_frame = meta_ui_create_frame (x11_display->ui,
|
||||||
x11_display->xdisplay,
|
x11_display->xdisplay,
|
||||||
frame->window,
|
frame->window,
|
||||||
window->xvisual,
|
window->xvisual,
|
||||||
@ -118,7 +118,7 @@ meta_window_ensure_frame (MetaWindow *window)
|
|||||||
meta_frame_update_style (frame);
|
meta_frame_update_style (frame);
|
||||||
meta_frame_update_title (frame);
|
meta_frame_update_title (frame);
|
||||||
|
|
||||||
meta_ui_map_frame (frame->window->screen->ui, frame->xwindow);
|
meta_ui_map_frame (x11_display->ui, frame->xwindow);
|
||||||
|
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
@ -127,8 +127,6 @@ typedef struct
|
|||||||
|
|
||||||
void meta_display_init_keys (MetaDisplay *display);
|
void meta_display_init_keys (MetaDisplay *display);
|
||||||
void meta_display_shutdown_keys (MetaDisplay *display);
|
void meta_display_shutdown_keys (MetaDisplay *display);
|
||||||
void meta_screen_grab_keys (MetaScreen *screen);
|
|
||||||
void meta_screen_ungrab_keys (MetaScreen *screen);
|
|
||||||
void meta_window_grab_keys (MetaWindow *window);
|
void meta_window_grab_keys (MetaWindow *window);
|
||||||
void meta_window_ungrab_keys (MetaWindow *window);
|
void meta_window_ungrab_keys (MetaWindow *window);
|
||||||
gboolean meta_window_grab_all_keys (MetaWindow *window,
|
gboolean meta_window_grab_all_keys (MetaWindow *window,
|
||||||
@ -152,4 +150,7 @@ GList *meta_prefs_get_keybindings (void);
|
|||||||
void meta_prefs_get_overlay_binding (MetaKeyCombo *combo);
|
void meta_prefs_get_overlay_binding (MetaKeyCombo *combo);
|
||||||
const char *meta_prefs_get_iso_next_group_option (void);
|
const char *meta_prefs_get_iso_next_group_option (void);
|
||||||
|
|
||||||
|
void meta_x11_display_grab_keys (MetaX11Display *x11_display);
|
||||||
|
void meta_x11_display_ungrab_keys (MetaX11Display *x11_display);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -880,7 +880,8 @@ ungrab_key_bindings (MetaDisplay *display)
|
|||||||
{
|
{
|
||||||
GSList *windows, *l;
|
GSList *windows, *l;
|
||||||
|
|
||||||
meta_screen_ungrab_keys (display->screen);
|
if (display->x11_display)
|
||||||
|
meta_x11_display_ungrab_keys (display->x11_display);
|
||||||
|
|
||||||
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
||||||
for (l = windows; l; l = l->next)
|
for (l = windows; l; l = l->next)
|
||||||
@ -897,7 +898,8 @@ grab_key_bindings (MetaDisplay *display)
|
|||||||
{
|
{
|
||||||
GSList *windows, *l;
|
GSList *windows, *l;
|
||||||
|
|
||||||
meta_screen_grab_keys (display->screen);
|
if (display->x11_display)
|
||||||
|
meta_x11_display_grab_keys (display->x11_display);
|
||||||
|
|
||||||
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
||||||
for (l = windows; l; l = l->next)
|
for (l = windows; l; l = l->next)
|
||||||
@ -1477,45 +1479,44 @@ change_binding_keygrabs (MetaKeyBindingManager *keys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_screen_change_keygrabs (MetaScreen *screen,
|
meta_x11_display_change_keygrabs (MetaX11Display *x11_display,
|
||||||
gboolean grab)
|
gboolean grab)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = screen->display;
|
MetaKeyBindingManager *keys = &x11_display->display->key_binding_manager;
|
||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (keys->overlay_resolved_key_combo.len != 0)
|
if (keys->overlay_resolved_key_combo.len != 0)
|
||||||
meta_change_keygrab (keys, display->x11_display->xroot,
|
meta_change_keygrab (keys, x11_display->xroot,
|
||||||
grab, &keys->overlay_resolved_key_combo);
|
grab, &keys->overlay_resolved_key_combo);
|
||||||
|
|
||||||
for (i = 0; i < keys->n_iso_next_group_combos; i++)
|
for (i = 0; i < keys->n_iso_next_group_combos; i++)
|
||||||
meta_change_keygrab (keys, display->x11_display->xroot,
|
meta_change_keygrab (keys, x11_display->xroot,
|
||||||
grab, &keys->iso_next_group_combo[i]);
|
grab, &keys->iso_next_group_combo[i]);
|
||||||
|
|
||||||
change_binding_keygrabs (keys, display->x11_display->xroot,
|
change_binding_keygrabs (keys, x11_display->xroot,
|
||||||
FALSE, grab);
|
FALSE, grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_screen_grab_keys (MetaScreen *screen)
|
meta_x11_display_grab_keys (MetaX11Display *x11_display)
|
||||||
{
|
{
|
||||||
if (screen->keys_grabbed)
|
if (x11_display->keys_grabbed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_screen_change_keygrabs (screen, TRUE);
|
meta_x11_display_change_keygrabs (x11_display, TRUE);
|
||||||
|
|
||||||
screen->keys_grabbed = TRUE;
|
x11_display->keys_grabbed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_screen_ungrab_keys (MetaScreen *screen)
|
meta_x11_display_ungrab_keys (MetaX11Display *x11_display)
|
||||||
{
|
{
|
||||||
if (!screen->keys_grabbed)
|
if (!x11_display->keys_grabbed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_screen_change_keygrabs (screen, FALSE);
|
meta_x11_display_change_keygrabs (x11_display, FALSE);
|
||||||
|
|
||||||
screen->keys_grabbed = FALSE;
|
x11_display->keys_grabbed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -45,7 +45,6 @@ struct _MetaScreen
|
|||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
MetaUI *ui;
|
|
||||||
|
|
||||||
MetaWorkspace *active_workspace;
|
MetaWorkspace *active_workspace;
|
||||||
|
|
||||||
@ -57,8 +56,6 @@ struct _MetaScreen
|
|||||||
guint vertical_workspaces : 1;
|
guint vertical_workspaces : 1;
|
||||||
guint workspace_layout_overridden : 1;
|
guint workspace_layout_overridden : 1;
|
||||||
|
|
||||||
guint keys_grabbed : 1;
|
|
||||||
|
|
||||||
int closing;
|
int closing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -207,7 +207,6 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
int number;
|
int number;
|
||||||
Window xroot = meta_x11_display_get_xroot (display->x11_display);
|
Window xroot = meta_x11_display_get_xroot (display->x11_display);
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
|
||||||
|
|
||||||
number = meta_ui_get_screen_number ();
|
number = meta_ui_get_screen_number ();
|
||||||
|
|
||||||
@ -235,11 +234,6 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
*/
|
*/
|
||||||
meta_workspace_new (screen);
|
meta_workspace_new (screen);
|
||||||
|
|
||||||
screen->keys_grabbed = FALSE;
|
|
||||||
meta_screen_grab_keys (screen);
|
|
||||||
|
|
||||||
screen->ui = meta_ui_new (xdisplay);
|
|
||||||
|
|
||||||
meta_prefs_add_listener (prefs_changed_callback, screen);
|
meta_prefs_add_listener (prefs_changed_callback, screen);
|
||||||
|
|
||||||
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
|
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
|
||||||
@ -293,10 +287,6 @@ meta_screen_free (MetaScreen *screen,
|
|||||||
|
|
||||||
meta_prefs_remove_listener (prefs_changed_callback, screen);
|
meta_prefs_remove_listener (prefs_changed_callback, screen);
|
||||||
|
|
||||||
meta_screen_ungrab_keys (screen);
|
|
||||||
|
|
||||||
meta_ui_free (screen->ui);
|
|
||||||
|
|
||||||
g_object_unref (screen);
|
g_object_unref (screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ test_case_assert_stacking (TestCase *test,
|
|||||||
* is managed as a MetaWindow.
|
* is managed as a MetaWindow.
|
||||||
*/
|
*/
|
||||||
if (META_STACK_ID_IS_X11 (windows[i]) &&
|
if (META_STACK_ID_IS_X11 (windows[i]) &&
|
||||||
meta_ui_window_is_dummy (display->screen->ui, windows[i]))
|
meta_ui_window_is_dummy (display->x11_display->ui, windows[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (stack_string->len > 0)
|
if (stack_string->len > 0)
|
||||||
|
@ -865,7 +865,7 @@ handle_input_xevent (MetaX11Display *x11_display,
|
|||||||
NULL;
|
NULL;
|
||||||
|
|
||||||
/* If this is an event for a GTK+ widget, let GTK+ handle it. */
|
/* If this is an event for a GTK+ widget, let GTK+ handle it. */
|
||||||
if (meta_ui_window_is_widget (screen->ui, modified))
|
if (meta_ui_window_is_widget (x11_display->ui, modified))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (input_event->evtype)
|
switch (input_event->evtype)
|
||||||
@ -944,7 +944,6 @@ static void
|
|||||||
process_request_frame_extents (MetaX11Display *x11_display,
|
process_request_frame_extents (MetaX11Display *x11_display,
|
||||||
XEvent *event)
|
XEvent *event)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = x11_display->display;
|
|
||||||
/* The X window whose frame extents will be set. */
|
/* The X window whose frame extents will be set. */
|
||||||
Window xwindow = event->xclient.window;
|
Window xwindow = event->xclient.window;
|
||||||
unsigned long data[4] = { 0, 0, 0, 0 };
|
unsigned long data[4] = { 0, 0, 0, 0 };
|
||||||
@ -964,7 +963,7 @@ process_request_frame_extents (MetaX11Display *x11_display,
|
|||||||
MetaFrameBorders borders;
|
MetaFrameBorders borders;
|
||||||
|
|
||||||
/* Return estimated frame extents for a normal window. */
|
/* Return estimated frame extents for a normal window. */
|
||||||
meta_ui_theme_get_frame_borders (display->screen->ui,
|
meta_ui_theme_get_frame_borders (x11_display->ui,
|
||||||
META_FRAME_TYPE_NORMAL,
|
META_FRAME_TYPE_NORMAL,
|
||||||
0,
|
0,
|
||||||
&borders);
|
&borders);
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "meta/common.h"
|
#include "meta/common.h"
|
||||||
#include "meta/types.h"
|
#include "meta/types.h"
|
||||||
#include "meta/meta-x11-display.h"
|
#include "meta/meta-x11-display.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
typedef struct _MetaGroupPropHooks MetaGroupPropHooks;
|
typedef struct _MetaGroupPropHooks MetaGroupPropHooks;
|
||||||
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
|
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
|
||||||
@ -112,6 +113,10 @@ struct _MetaX11Display
|
|||||||
MetaAlarmFilter alarm_filter;
|
MetaAlarmFilter alarm_filter;
|
||||||
gpointer alarm_filter_data;
|
gpointer alarm_filter_data;
|
||||||
|
|
||||||
|
MetaUI *ui;
|
||||||
|
|
||||||
|
guint keys_grabbed : 1;
|
||||||
|
|
||||||
int composite_event_base;
|
int composite_event_base;
|
||||||
int composite_error_base;
|
int composite_error_base;
|
||||||
int composite_major_version;
|
int composite_major_version;
|
||||||
|
@ -91,6 +91,14 @@ meta_x11_display_dispose (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaX11Display *x11_display = META_X11_DISPLAY (object);
|
MetaX11Display *x11_display = META_X11_DISPLAY (object);
|
||||||
|
|
||||||
|
meta_x11_display_ungrab_keys (x11_display);
|
||||||
|
|
||||||
|
if (x11_display->ui)
|
||||||
|
{
|
||||||
|
meta_ui_free (x11_display->ui);
|
||||||
|
x11_display->ui = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (x11_display->no_focus_window != None)
|
if (x11_display->no_focus_window != None)
|
||||||
{
|
{
|
||||||
XUnmapWindow (x11_display->xdisplay, x11_display->no_focus_window);
|
XUnmapWindow (x11_display->xdisplay, x11_display->no_focus_window);
|
||||||
@ -827,6 +835,7 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|||||||
meta_unsigned_long_equal);
|
meta_unsigned_long_equal);
|
||||||
|
|
||||||
x11_display->groups_by_leader = NULL;
|
x11_display->groups_by_leader = NULL;
|
||||||
|
x11_display->ui = NULL;
|
||||||
x11_display->composite_overlay_window = None;
|
x11_display->composite_overlay_window = None;
|
||||||
x11_display->guard_window = None;
|
x11_display->guard_window = None;
|
||||||
x11_display->leader_window = None;
|
x11_display->leader_window = None;
|
||||||
@ -912,6 +921,11 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|||||||
|
|
||||||
set_desktop_geometry_hint (x11_display);
|
set_desktop_geometry_hint (x11_display);
|
||||||
|
|
||||||
|
x11_display->ui = meta_ui_new (xdisplay);
|
||||||
|
|
||||||
|
x11_display->keys_grabbed = FALSE;
|
||||||
|
meta_x11_display_grab_keys (x11_display);
|
||||||
|
|
||||||
return x11_display;
|
return x11_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user