diff options
| author | Martin Rudalics | 2017-03-23 07:51:19 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2017-03-23 07:51:19 +0100 |
| commit | fe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f (patch) | |
| tree | a91409b89ffda17d6813738195d0ca3f3487c5f0 /src | |
| parent | 560d6f91246ee90ac6e630ae941097a4d4f8f730 (diff) | |
| download | emacs-fe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f.tar.gz emacs-fe3af8d4f2a4cd67958f76d1b708e8a78e68cd4f.zip | |
c:/Temp/gtk-window-move/ChangeLog.txt
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 83 | ||||
| -rw-r--r-- | src/xterm.c | 22 |
2 files changed, 78 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; |
diff --git a/src/xterm.c b/src/xterm.c index 7856793f8dc..4f9eff6c5e6 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10056,11 +10056,26 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ | |||
| 10056 | f->size_hint_flags |= YNegative; | 10056 | f->size_hint_flags |= YNegative; |
| 10057 | f->win_gravity = NorthWestGravity; | 10057 | f->win_gravity = NorthWestGravity; |
| 10058 | } | 10058 | } |
| 10059 | |||
| 10059 | x_calc_absolute_position (f); | 10060 | x_calc_absolute_position (f); |
| 10060 | 10061 | ||
| 10061 | block_input (); | 10062 | block_input (); |
| 10062 | x_wm_set_size_hint (f, 0, false); | 10063 | x_wm_set_size_hint (f, 0, false); |
| 10063 | 10064 | ||
| 10065 | #ifdef USE_GTK | ||
| 10066 | if (x_gtk_use_window_move) | ||
| 10067 | { | ||
| 10068 | /* When a position change was requested and the outer GTK widget | ||
| 10069 | has been realized already, leave it to gtk_window_move to DTRT | ||
| 10070 | and return. Used for Bug#25851 and Bug#25943. */ | ||
| 10071 | if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f)) | ||
| 10072 | gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | ||
| 10073 | f->left_pos, f->top_pos); | ||
| 10074 | unblock_input (); | ||
| 10075 | return; | ||
| 10076 | } | ||
| 10077 | #endif /* USE_GTK */ | ||
| 10078 | |||
| 10064 | modified_left = f->left_pos; | 10079 | modified_left = f->left_pos; |
| 10065 | modified_top = f->top_pos; | 10080 | modified_top = f->top_pos; |
| 10066 | 10081 | ||
| @@ -12905,4 +12920,11 @@ state. | |||
| 12905 | Set this variable only if your window manager cannot handle the | 12920 | Set this variable only if your window manager cannot handle the |
| 12906 | transition between the various maximization states. */); | 12921 | transition between the various maximization states. */); |
| 12907 | x_frame_normalize_before_maximize = false; | 12922 | x_frame_normalize_before_maximize = false; |
| 12923 | |||
| 12924 | DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move, | ||
| 12925 | doc: /* Non-nil means rely on gtk_window_move to set frame positions. | ||
| 12926 | If this variable is t, the GTK build uses the function gtk_window_move | ||
| 12927 | to set or store frame positions and disables some time consuming frame | ||
| 12928 | position adjustments. */); | ||
| 12929 | x_gtk_use_window_move = false; | ||
| 12908 | } | 12930 | } |