From a3460b8ac806b775c5410aabf59964479d43322c Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 11 May 2002 05:09:54 +0000 Subject: [PATCH] keep the tooltip on the screen horizontally, #76825 2002-05-11 Havoc Pennington * src/fixedtip.c (meta_fixed_tip_show): keep the tooltip on the screen horizontally, #76825 * src/window.c (meta_window_handle_mouse_grab_op_event): end grab op _after_ doing the final update of the move or resize. Hopefully I didn't have a reason for the order I was using before. --- ChangeLog | 9 +++++++++ src/fixedtip.c | 35 +++++++++++++++++++++++++++++------ src/stack.c | 7 +++++++ src/window.c | 8 ++++---- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 148112d2e..afdf955d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-05-11 Havoc Pennington + + * src/fixedtip.c (meta_fixed_tip_show): keep the tooltip + on the screen horizontally, #76825 + + * src/window.c (meta_window_handle_mouse_grab_op_event): end grab + op _after_ doing the final update of the move or resize. + Hopefully I didn't have a reason for the order I was using before. + 2002-05-10 Havoc Pennington * src/tools/metacity-window-demo.c: add override redirect test diff --git a/src/fixedtip.c b/src/fixedtip.c index c9af6d02d..826359a20 100644 --- a/src/fixedtip.c +++ b/src/fixedtip.c @@ -23,6 +23,8 @@ static GtkWidget *tip = NULL; static GtkWidget *label = NULL; +static int screen_width = 0; +static int screen_height = 0; static gint expose_handler (GtkTooltips *tooltips) @@ -40,14 +42,27 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number, int root_x, int root_y, const char *markup_text) { + int w, h; + if (tip == NULL) - { + { tip = gtk_window_new (GTK_WINDOW_POPUP); #ifdef HAVE_GTK_MULTIHEAD - gtk_window_set_screen (GTK_WINDOW (tip), - gdk_display_get_screen (gdk_get_default_display (), - screen_number)); + { + GdkScreen *gdk_screen; + + gdk_screen = gdk_display_get_screen (gdk_get_default_display (), + screen_number); + gtk_window_set_screen (GTK_WINDOW (tip), + gdk_screen); + screen_width = gdk_screen_get_width (gdk_screen); + screen_height = gdk_screen_get_height (gdk_screen); + } +#else + screen_width = gdk_screen_width (); + screen_height = gdk_screen_height (); #endif + gtk_widget_set_app_paintable (tip, TRUE); gtk_window_set_policy (GTK_WINDOW (tip), FALSE, FALSE, TRUE); gtk_widget_set_name (tip, "gtk-tooltips"); @@ -70,9 +85,17 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number, GTK_SIGNAL_FUNC (gtk_widget_destroyed), &tip); } - - gtk_widget_set_uposition (tip, root_x, root_y); + gtk_label_set_markup (GTK_LABEL (label), markup_text); + + /* FIXME should also handle Xinerama here, just to be + * really cool + */ + gtk_window_get_size (GTK_WINDOW (tip), &w, &h); + if ((root_x + w) > screen_width) + root_x -= (root_x + w) - screen_width; + + gtk_window_move (GTK_WINDOW (tip), root_x, root_y); gtk_widget_show (tip); } diff --git a/src/stack.c b/src/stack.c index 1b1cf8af9..6222bdd47 100644 --- a/src/stack.c +++ b/src/stack.c @@ -376,6 +376,13 @@ raise_window_relative_to_managed_windows (MetaScreen *screen, { /* This function is used to avoid raising a window above popup * menus and other such things. + * + * FIXME This is sort of an expensive function, should probably + * do something to avoid it. One approach would be to reverse + * the stacking algorithm to work by placing each window above + * the others, and start by lowering a window to the bottom + * (instead of the current way, which works by placing each + * window below another and starting with a raise) */ Window ignored1, ignored2; diff --git a/src/window.c b/src/window.c index b5339f96a..86134de3a 100644 --- a/src/window.c +++ b/src/window.c @@ -5473,9 +5473,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, { switch (event->type) { - case ButtonRelease: - meta_display_end_grab_op (window->display, event->xbutton.time); - + case ButtonRelease: switch (window->display->grab_op) { case META_GRAB_OP_MOVING: @@ -5496,7 +5494,9 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, default: break; - } + } + + meta_display_end_grab_op (window->display, event->xbutton.time); break; case MotionNotify: