aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorMartin Rudalics2017-03-23 07:51:19 +0100
committerMartin Rudalics2017-03-23 07:51:19 +0100
commitfe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f (patch)
treea91409b89ffda17d6813738195d0ca3f3487c5f0 /src/gtkutil.c
parent560d6f91246ee90ac6e630ae941097a4d4f8f730 (diff)
downloademacs-fe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f.tar.gz
emacs-fe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f.zip
c:/Temp/gtk-window-move/ChangeLog.txt
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c83
1 files changed, 56 insertions, 27 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 3a00e362221..63f01436413 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -783,33 +783,55 @@ xg_set_geometry (struct frame *f)
783{ 783{
784 if (f->size_hint_flags & (USPosition | PPosition)) 784 if (f->size_hint_flags & (USPosition | PPosition))
785 { 785 {
786 int left = f->left_pos; 786 if (x_gtk_use_window_move)
787 int xneg = f->size_hint_flags & XNegative; 787 {
788 int top = f->top_pos; 788 /* Handle negative positions without consulting
789 int yneg = f->size_hint_flags & YNegative; 789 gtk_window_parse_geometry (Bug#25851). The position will
790 char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)]; 790 be off by scrollbar width + window manager decorations. */
791 guint id; 791 if (f->size_hint_flags & XNegative)
792 792 f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
793 if (xneg) 793 - FRAME_PIXEL_WIDTH (f) + f->left_pos);
794 left = -left; 794
795 if (yneg) 795 if (f->size_hint_flags & YNegative)
796 top = -top; 796 f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
797 797 - FRAME_PIXEL_HEIGHT (f) + f->top_pos);
798 sprintf (geom_str, "=%dx%d%c%d%c%d", 798
799 FRAME_PIXEL_WIDTH (f), 799 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
800 FRAME_PIXEL_HEIGHT (f), 800 f->left_pos, f->top_pos);
801 (xneg ? '-' : '+'), left, 801
802 (yneg ? '-' : '+'), top); 802 /* Reset size hint flags. */
803 803 f->size_hint_flags &= ~ (XNegative | YNegative);
804 /* Silence warning about visible children. */ 804 }
805 id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL 805 else
806 | G_LOG_FLAG_RECURSION, my_log_handler, NULL); 806 {
807 807 int left = f->left_pos;
808 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 808 int xneg = f->size_hint_flags & XNegative;
809 geom_str)) 809 int top = f->top_pos;
810 fprintf (stderr, "Failed to parse: '%s'\n", geom_str); 810 int yneg = f->size_hint_flags & YNegative;
811 811 char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
812 g_log_remove_handler ("Gtk", id); 812 guint id;
813
814 if (xneg)
815 left = -left;
816 if (yneg)
817 top = -top;
818
819 sprintf (geom_str, "=%dx%d%c%d%c%d",
820 FRAME_PIXEL_WIDTH (f),
821 FRAME_PIXEL_HEIGHT (f),
822 (xneg ? '-' : '+'), left,
823 (yneg ? '-' : '+'), top);
824
825 /* Silence warning about visible children. */
826 id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
827 | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
828
829 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
830 geom_str))
831 fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
832
833 g_log_remove_handler ("Gtk", id);
834 }
813 } 835 }
814} 836}
815 837
@@ -1406,6 +1428,13 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1406 else if (win_gravity == StaticGravity) 1428 else if (win_gravity == StaticGravity)
1407 size_hints.win_gravity = GDK_GRAVITY_STATIC; 1429 size_hints.win_gravity = GDK_GRAVITY_STATIC;
1408 1430
1431 if (x_gtk_use_window_move)
1432 {
1433 if (flags & PPosition) hint_flags |= GDK_HINT_POS;
1434 if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS;
1435 if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE;
1436 }
1437
1409 if (user_position) 1438 if (user_position)
1410 { 1439 {
1411 hint_flags &= ~GDK_HINT_POS; 1440 hint_flags &= ~GDK_HINT_POS;