diff options
Diffstat (limited to 'src/core/window.c')
-rw-r--r-- | src/core/window.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/core/window.c b/src/core/window.c index 8cffdde8..5ec4af09 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3412,6 +3412,19 @@ send_sync_request (MetaWindow *window) } #endif +static gboolean +move_attached_dialog (MetaWindow *window, + void *data) +{ + MetaWindow *parent = meta_window_get_transient_for (window); + + if (window->type == META_WINDOW_MODAL_DIALOG && parent && parent != window) + /* It ignores x,y for such a dialog */ + meta_window_move (window, FALSE, 0, 0); + + return FALSE; +} + static void meta_window_move_resize_internal (MetaWindow *window, MetaMoveResizeFlags flags, @@ -3866,6 +3879,9 @@ meta_window_move_resize_internal (MetaWindow *window, * server-side size/pos of window->xwindow and frame->xwindow * b) all constraints are obeyed by window->rect and frame->rect */ + + if (meta_prefs_get_attach_modal_dialogs ()) + meta_window_foreach_transient (window, move_attached_dialog, NULL); } void @@ -5504,6 +5520,23 @@ meta_window_appears_focused_changed (MetaWindow *window) meta_frame_queue_draw (window->frame); } +static void +check_ancestor_focus_appearance (MetaWindow *window) +{ + MetaWindow *parent = meta_window_get_transient_for (window); + + if (!meta_prefs_get_attach_modal_dialogs ()) + return; + + if (window->type != META_WINDOW_MODAL_DIALOG || !parent || parent == window) + return; + + if (parent->frame) + meta_frame_queue_draw (parent->frame); + + check_ancestor_focus_appearance (parent); +} + gboolean meta_window_notify_focus (MetaWindow *window, XEvent *event) @@ -5639,6 +5672,9 @@ meta_window_notify_focus (MetaWindow *window, if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK || !meta_prefs_get_raise_on_click()) meta_display_ungrab_focus_window_button (window->display, window); + + /* parent window become active. */ + check_ancestor_focus_appearance (window); } } else if (event->type == FocusOut || @@ -5666,6 +5702,9 @@ meta_window_notify_focus (MetaWindow *window, window->display->focus_window = NULL; window->has_focus = FALSE; + /* parent window become active. */ + check_ancestor_focus_appearance (window); + meta_window_appears_focused_changed (window); meta_compositor_set_active_window (window->display->compositor, @@ -6472,6 +6511,16 @@ recalc_window_features (MetaWindow *window) if (window->type == META_WINDOW_TOOLBAR) window->decorated = FALSE; + if (window->type == META_WINDOW_MODAL_DIALOG && meta_prefs_get_attach_modal_dialogs ()) + { + MetaWindow *parent = meta_window_get_transient_for (window); + if (parent) + { + window->has_resize_func = FALSE; + window->border_only = TRUE; + } + } + if (window->type == META_WINDOW_DESKTOP || window->type == META_WINDOW_DOCK) window->always_sticky = TRUE; @@ -8594,6 +8643,28 @@ meta_window_get_frame (MetaWindow *window) return window->frame; } +static gboolean +transient_has_focus (MetaWindow *window, + void *data) +{ + if (window->type == META_WINDOW_MODAL_DIALOG && meta_window_appears_focused (window)) + *((gboolean *)data) = TRUE; + + return FALSE; +} + +gboolean +meta_window_appears_focused (MetaWindow *window) +{ + if (!window->has_focus && meta_prefs_get_attach_modal_dialogs ()) + { + gboolean focus = FALSE; + meta_window_foreach_transient (window, transient_has_focus, &focus); + return focus; + } + return window->has_focus; +} + gboolean meta_window_has_focus (MetaWindow *window) { |