[gtk+/wip/attachment-parameters: 5/15] gdkwindow-x11: move window on map
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/attachment-parameters: 5/15] gdkwindow-x11: move window on map
- Date: Thu, 24 Sep 2015 09:54:45 +0000 (UTC)
commit 2561fb2f505a22bfc9aa7d2a71533449285daa93
Author: William Hua <william hua canonical com>
Date: Mon Sep 21 18:43:17 2015 -0400
gdkwindow-x11: move window on map
X11 doesn't seem to allow us to move the window before it's mapped.
This means we must wait for a MapNotify, then move the window.
gdk/x11/gdkdisplay-x11.c | 22 ++++++++++++++++++++--
gdk/x11/gdkwindow-x11.c | 11 ++++++++++-
gdk/x11/gdkwindow-x11.h | 4 ++++
3 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 0030c6c..f53df9b 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -705,7 +705,11 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
}
if (toplevel)
- gdk_window_freeze_toplevel_updates (window);
+ {
+ gdk_window_freeze_toplevel_updates (window);
+
+ toplevel->is_mapped = FALSE;
+ }
_gdk_x11_window_grab_check_unmap (window, xevent->xany.serial);
}
@@ -729,7 +733,21 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
0);
if (toplevel)
- gdk_window_thaw_toplevel_updates (window);
+ {
+ if (!toplevel->is_mapped)
+ {
+ toplevel->is_mapped = TRUE;
+
+ if (toplevel->move_on_map)
+ {
+ toplevel->move_on_map = FALSE;
+
+ gdk_window_move (window, toplevel->initial_position.x, toplevel->initial_position.y);
+ }
+ }
+
+ gdk_window_thaw_toplevel_updates (window);
+ }
}
break;
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index c449e3a..cb67136 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -6036,6 +6036,7 @@ gdk_x11_window_set_attachment_parameters (GdkWindow *window,
gint secondary_value;
GdkPoint position = { 0 };
GdkPoint offset = { 0 };
+ GdkToplevelX11 *toplevel;
if (!parameters || !parameters->has_attachment_rectangle)
return;
@@ -6281,7 +6282,15 @@ gdk_x11_window_set_attachment_parameters (GdkWindow *window,
position.y = bounds.y;
}
- gdk_window_move (window, position.x, position.y);
+ toplevel = _gdk_x11_window_get_toplevel (window);
+
+ if (toplevel && !toplevel->is_mapped)
+ {
+ toplevel->move_on_map = TRUE;
+ toplevel->initial_position = position;
+ }
+ else
+ gdk_window_move (window, position.x, position.y);
if (parameters->position_callback)
parameters->position_callback (window,
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 2bc2417..64a7f75 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -147,6 +147,10 @@ struct _GdkToplevelX11
guint pending_counter_value_is_extended : 1;
guint configure_counter_value_is_extended : 1;
+ guint is_mapped : 1;
+ guint move_on_map : 1;
+ GdkPoint initial_position;
+
gulong map_serial; /* Serial of last transition from unmapped */
cairo_surface_t *icon_pixmap;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]