[gtk+/gtk-2-24] win32: fix gdk_win32_window_raise
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] win32: fix gdk_win32_window_raise
- Date: Wed, 25 Jan 2012 19:26:44 +0000 (UTC)
commit fb87d9c90153dcfd2e126c5bca9ad2d4ffbdfdff
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Tue Dec 20 23:02:46 2011 +0100
win32: fix gdk_win32_window_raise
When calling gtk_window_present(), gdk_win32_window_raise did not
actually raise the window anymore. Replacing BringWindowToTop() with
SetForegroundWindow() fixes this.
During testing, we also discovered that sometimes SetForeGroundWindow()
will (correctly) refuse to raise the window and fail(for example: sometimes
when dragging a different application at the time of a gtk_window_present()
call). To prevent a GdkWarning from being produced, usage of the API_CALL
macro has been removed for this case.
Additional goodies of SetForeGroundWindow:
- it brings the window to the front when the process owning the
window to raise is the foreground process (for example when
gtk_window_present is called from a GtkStatusIcon's activate
signal handler)
- it limits itself to flashing the task bar button associated
with the window if the process owning the window to raise
is *not* the foreground process (for example when gtk_window_present
is called from a g_timeout_add callback function)
https://bugzilla.gnome.org/show_bug.cgi?id=665760
gdk/win32/gdkwindow-win32.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index d261f19..ebe4ce2 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1822,6 +1822,7 @@ gdk_window_win32_clear_region (GdkWindow *window,
g_free (rectangles);
}
+
static void
gdk_win32_window_raise (GdkWindow *window)
{
@@ -1835,7 +1836,11 @@ gdk_win32_window_raise (GdkWindow *window)
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
else if (((GdkWindowObject *)window)->accept_focus)
- API_CALL (BringWindowToTop, (GDK_WINDOW_HWND (window)));
+ /* Do not wrap this in an API_CALL macro as SetForegroundWindow might
+ * fail when for example dragging a window belonging to a different
+ * application at the time of a gtk_window_present() call due to focus
+ * stealing prevention. */
+ SetForegroundWindow (GDK_WINDOW_HWND (window));
else
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
0, 0, 0, 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]