[gtk+/wip/attachment-parameters: 2/20] gdkwindow-x11: move window on map
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/attachment-parameters: 2/20] gdkwindow-x11: move window on map
- Date: Mon, 28 Sep 2015 20:52:10 +0000 (UTC)
commit 4bd63aece65afb0b014e72e922c2bf8f6586bc63
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 ee8bd80..ee3baaa 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5690,6 +5690,7 @@ gdk_x11_window_set_attachment_parameters (GdkWindow *window,
GdkPoint offset;
GdkAttachmentOption primary_option;
GdkAttachmentOption secondary_option;
+ GdkToplevelX11 *toplevel;
if (!parameters || !parameters->has_attachment_rectangle)
return;
@@ -5701,7 +5702,15 @@ gdk_x11_window_set_attachment_parameters (GdkWindow *window,
&primary_option,
&secondary_option))
{
- 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]