[evolution] Correct placement of emoticon and color chooser in composer under Wayland



commit ca1d3b89188f306ff1cd9c8dce4627738657582f
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 6 13:55:13 2016 +0200

    Correct placement of emoticon and color chooser in composer under Wayland
    
    Changes done based on suggestion from Jonas Ã…dahl and Olivier Fourdan
    at bug #757558.

 e-util/e-color-combo.c          |   13 +++++++++----
 e-util/e-emoticon-tool-button.c |   15 ++++++++++-----
 2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/e-util/e-color-combo.c b/e-util/e-color-combo.c
index ca3de89..3a9c051 100644
--- a/e-util/e-color-combo.c
+++ b/e-util/e-color-combo.c
@@ -166,6 +166,7 @@ static void
 color_combo_popup (EColorCombo *combo)
 {
        GdkWindow *window;
+       GtkWidget *toplevel;
        gboolean grab_status;
        GdkDevice *device, *mouse, *keyboard;
        guint32 activate_time;
@@ -191,12 +192,12 @@ color_combo_popup (EColorCombo *combo)
        /* Position the window over the button. */
        color_combo_reposition_window (combo);
 
-       /* Show the pop-up. */
-       gtk_widget_show_all (combo->priv->window);
-       gtk_widget_grab_focus (combo->priv->window);
+       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo));
+       if (GTK_IS_WINDOW (toplevel))
+               gtk_window_set_transient_for (GTK_WINDOW (combo->priv->window), GTK_WINDOW (toplevel));
 
        /* Try to grab the pointer and keyboard. */
-       window = gtk_widget_get_window (combo->priv->window);
+       window = gtk_widget_get_window (toplevel);
        grab_status =
                (keyboard == NULL) ||
                (gdk_device_grab (
@@ -230,6 +231,10 @@ color_combo_popup (EColorCombo *combo)
        g_object_set (
                G_OBJECT (combo->priv->chooser_widget),
                "show-editor", FALSE, NULL);
+
+       /* Show the pop-up. */
+       gtk_widget_show_all (combo->priv->window);
+       gtk_widget_grab_focus (combo->priv->window);
 }
 
 static void
diff --git a/e-util/e-emoticon-tool-button.c b/e-util/e-emoticon-tool-button.c
index 3271bd4..0b10133 100644
--- a/e-util/e-emoticon-tool-button.c
+++ b/e-util/e-emoticon-tool-button.c
@@ -347,6 +347,7 @@ emoticon_tool_button_popup (EEmoticonToolButton *button)
 {
        GtkToggleToolButton *tool_button;
        GdkWindow *window;
+       GtkWidget *toplevel;
        gboolean grab_status;
        GdkDevice *device, *mouse, *keyboard;
        guint32 activate_time;
@@ -372,16 +373,16 @@ emoticon_tool_button_popup (EEmoticonToolButton *button)
        /* Position the window over the button. */
        emoticon_tool_button_reposition_window (button);
 
-       /* Show the pop-up. */
-       gtk_widget_show (button->priv->window);
-       gtk_widget_grab_focus (button->priv->window);
-
        /* Activate the tool button. */
        tool_button = GTK_TOGGLE_TOOL_BUTTON (button);
        gtk_toggle_tool_button_set_active (tool_button, TRUE);
 
+       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+       if (GTK_IS_WINDOW (toplevel))
+               gtk_window_set_transient_for (GTK_WINDOW (button->priv->window), GTK_WINDOW (toplevel));
+
        /* Try to grab the pointer and keyboard. */
-       window = gtk_widget_get_window (button->priv->window);
+       window = gtk_widget_get_window (toplevel);
        grab_status = !keyboard ||
                gdk_device_grab (
                        keyboard, window,
@@ -405,6 +406,10 @@ emoticon_tool_button_popup (EEmoticonToolButton *button)
        } else {
                gtk_widget_hide (button->priv->window);
        }
+
+       /* Show the pop-up. */
+       gtk_widget_show (button->priv->window);
+       gtk_widget_grab_focus (button->priv->window);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]