From 1886246f6f40b8c376467f71605141035959cae0 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sun, 25 Jun 2017 11:33:25 +0200 Subject: Provide additional support for child frames Provide mouse dragging and resizing of frames. Allow resizing frames proportionally. Provide additional functionality for child frames. Minor bug fixes. * lisp/frame.el (frame-border-width, frame-pixel-width) (frame-pixel-height): Alias to `frame-internal-border-width', `frame-native-width' and `frame-native-height'. (frame-inner-width, frame-inner-height, frame-outer-width) (frame-outer-height): New functions. * lisp/minibuffer.el (completion-auto-help): Fix typo. * lisp/mouse.el (mouse-drag-line, mouse-drag-mode-line) (mouse-drag-header-line): Allow moving a frame by dragging the mode line of its bottommost window (on a minibuffer-less frame) or the header line of its topmost window. (mouse-drag-vertical-line): Mention argument in doc-string. (mouse-resize-frame, mouse-drag-frame, mouse-drag-left-edge) (mouse-drag-top-left-corner, mouse-drag-top-edge) (mouse-drag-top-right-corner, mouse-drag-right-edge) (mouse-drag-bottom-right-corner, mouse-drag-bottom-edge) (mouse-drag-bottom-left-corner): New functions for resizing a frame by dragging its internal border together with corresponding key bindings. * lisp/tooltip.el (tooltip-frame-parameters): Add 'no-special-glyphs' to default parameters and update version tag. * lisp/window.el (frame-auto-hide-function): Add choice to make frame invisible and update version tag. (window--delete): Handle 'auto-hide-function' frame parameter. (window--maybe-raise-frame): Respect 'no-focus-on-map' and 'no-accept-focus' frame parameters. (display-buffer--action-function-custom-type): Add `display-buffer-in-child-frame'. (display-buffer): Mention `display-buffer-in-child-frame' in doc-string. (display-buffer-in-child-frame): New action function for `display-buffer'. (window--sanitize-margin): Return zero when MARGIN cannot be sanitized. (fit-frame-to-buffer): Major rewrite to handle child frames and 'fit-frame-to-buffer-sizes' and 'fit-frame-to-buffer-margins' frame parameters. (window-largest-empty-rectangle--maximums-1) (window-largest-empty-rectangle--maximums) (window-largest-empty-rectangle--disjoint-maximums) (window-largest-empty-rectangle): New functions. * src/dispextern.h (WINDOW_WANTS_MODELINE_P) (WINDOW_WANTS_HEADER_LINE_P): Remove. Functionality is now provided by corresponding functions window_wants_modeline and window_wants_header_line in window.c. Adjust users. * src/dispnew.c (adjust_glyph_matrix) (buffer_posn_from_coords): Use window_wants_modeline and window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P. * src/frame.c (keep_ratio): New function. (adjust_frame_size): Call keep_ratio for each of F's child frames. (make_frame): Initialize no_special_glyphs slot. (frame_internal_border_part): New function. (Fframe_pixel_width, Fframe_pixel_height, Fborder_width): Rename to Fframe_native_width, Fframe_native_height mand Fframe_internal_border_width. (frame_parm_table): Add Qno_special_glyphs entry. (frame_float_type): New enumeration type. (frame_float): New function to handle frame size and position ratios. (x_set_frame_parameters): Handle size and position ratios. (x_set_no_special_glyphs): New function (x_figure_window_size): Handle size and position ratios. (syms_of_frame): Add Qdisplay_monitor_attributes_list, Qno_special_glyphs, Qframe_edges, Qkeep_ratio, Qwidth_only, Qheight_only, Qleft_only and Qtop_only. * src/frame.h (internal_border_part): New enumeration type. (struct frame): New slot no_special_glyphs. (FRAME_NO_SPECIAL_GLYPHS): New macro. * src/gtkutil.c (xg_frame_restack): Return immediately for GTK versions before 2.18.0. * src/keyboard.c (internal_border_parts): New array constant. (make_lispy_position): For frames with border dragging enabled return internal border part. (syms_of_keyboard): New symbols Qdrag_internal_border, Qleft_edge, Qtop_left_corner, Qtop_edge, Qtop_right_corner, Qright_edge, Qbottom_right_corner, Qbottom_edge and Qbottom_left_corner. * src/minibuf.c (read_minibuf_unwind): When exiting the minibuffer deal with frames that have the 'minibuffer-exit' parameter set. (syms_of_minibuf): New symbol Qminibuffer_exit. * src/nsfns.m (frame_parm_handler): Add entry for x_set_no_special_glyphs. (Fx_create_frame): Handle 'no-special-glyphs' parameter. Intitialize new cursor types for dragging frame borders. * src/nsterm.h (struct ns_output): Add new cursor types for dragging frame borders. * src/w32fns.c (w32_frame_parm_handlers): Add entry for x_set_no_special_glyphs. (Fx_create_frame): Handle 'no-special-glyphs' parameter. Intitialize new cursor types for dragging frame borders. * src/w32term.h (struct w32_output): Add new cursor types for dragging frame borders. * src/window.c (coordinates_in_window) (Fwindow_line_height, window_internal_height): Use window_wants_modeline and window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P. (Fwindow_lines_pixel_dimensions): New function. (window_parameter): New function. (Fwindow_parameter): Call window_parameter. (window_wants_mode_line, window_wants_header_line): New functions replacing the macros WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P from dispextern.h. (syms_of_window): New symbols Qmode_line_format and Qheader_line_format. * src/window.h: Reorganize and re-comment macros. Use window_wants_modeline and window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P): Minor rewrite. (WINDOW_BUFFER): New macro. (WINDOW_BOX_LEFT_EDGE_COL, WINDOW_BOX_RIGHT_EDGE_COL): Remove. * src/xdisp.c (window_text_bottom_y, window_box_height) (window_box, start_display) (compute_window_start_on_continuation_line) (try_cursor_movement, redisplay_window) (try_window_reusing_current_matrix, try_window_id) (display_line, expose_window): Use window_wants_modeline and window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P. (pos_visible_p, display_mode_lines): Respect W's 'mode-line-format' and 'header-line-format' window parameters. (init_iterator): Use window_wants_modeline and window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P. For tip frames respect no_special_glyphs value. (note_mouse_highlight): Set frame border cursors when on internal border. (x_draw_right_divider, x_draw_bottom_divider): Try to improve drawing of window dividers. * src/xfns.c (mouse_cursor): Add entries for border parts. (mouse_cursor_types): Add entries for cursor types to drag frame borders. (INSTALL_CURSOR): Add entries for new cursor types to drag frame borders. (Fx_create_frame): Handle 'no-special-glyphs' parameter. (x_frame_parm_handlers): Add entry for x_set_no_special_glyphs. (Vx_window_left_edge_shape, Vx_window_top_left_corner_shape) (Vx_window_top_edge_shape, Vx_window_top_right_corner_shape) (Vx_window_right_edge_shape) (Vx_window_bottom_right_corner_shape) (Vx_window_bottom_edge_shape) (Vx_window_bottom_left_corner_shape): New variables. (x_frame_restack): Call xg_frame_restack only for GTK versions starting with 2.18.0. * src/xterm.c (x_free_frame_resources): Remove new cursors for dragging frame borders. * src/xterm.h (struct x_output): Add new cursor types for dragging frame borders. * doc/lispref/display.texi (Size of Displayed Text): Document `window-lines-pixel-dimensions'. * doc/lispref/elisp.texi (Top): Add entry for "Mouse Dragging Parameters". * doc/lispref/frames.texi (Frame Size): Replace frame-pixel-width/-height by frame-native-width/-height. Add frame-inner-width/-height and frame-outer-width/-height docs. (Position Parameters): Describe specifying position as ratios. Clarify remark about positions relative to bottom/ridge display edge. (Size Parameters): Describe specifying sizes as ratios. Describe 'fit-frame-to-buffer-margins' and 'fit-frame-to-buffer-sizes' parameters. (Layout Parameters): Describe 'no-special-glyphs' parameter. (Frame Interaction Parameters): Describe 'auto-hide-function', 'minibuffer-exit' and 'keep-ratio' parameters. (Mouse Dragging Parameters): New section describing 'drag-internal-border', 'drag-with-header-line', 'drag-with-mode-line', 'snap-width', 'top-visible' and 'bottom-visible' parameters. (Management Parameters): Mention that `override-redirect' has no effect on MS Windows. (Font and Color Parameters): Mention child frames for `alpha' parameter. (Child Frames): Rewrite section with description and cross references to new frame parameters added. * doc/lispref/modes.texi (Mode Line Basics): Mention 'mode-line-format' and 'header-line-format' window parameters. * doc/lispref/windows.texi (Resizing Windows): Mention effect of `fit-frame-to-buffer-margins' for child frames. (Display Action Functions): New action function `display-buffer-in-child-frame'. (Quitting Windows): Mention `make-frame-invisible' as optional value of `frame-auto-hide-function' and `auto-hide-function' frame paameter. (Coordinates and Windows): Describe new function `window-largest-empty-rectangle'. (Window Parameters): Describe new parameters 'mode-line-format' and 'header-line-format'. Index all window parameters described in this section. --- src/gtkutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 16eb284d7c7..2d4abefa969 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1503,6 +1503,7 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated) void xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) { +#if GTK_CHECK_VERSION (2, 18, 0) block_input (); if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2)) { @@ -1517,6 +1518,7 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) x_sync (f1); } unblock_input (); +#endif } -- cgit v1.2.1 From 4198b4d985db77ad6ae372fa048250e93de5013c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 16:42:26 +0200 Subject: Get positions of menus and tooltips right on HiDPI * src/gtkutil.c (xg_get_scale): New function. (xg_show_tooltip): Use it. * src/xmenu.c (create_and_show_popup_menu): Put menus in the right place. --- src/gtkutil.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 2d4abefa969..255091559e9 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -204,6 +204,14 @@ xg_display_open (char *display_name, Display **dpy) *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL; } +/* Scaling/HiDPI functions. */ +int +xg_get_scale (struct frame *f) +{ + if (FRAME_VISIBLE_P (f) && FRAME_GTK_WIDGET (f)) + return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); + return 1; +} /* Close display DPY. */ @@ -724,7 +732,8 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y) if (x->ttip_window) { block_input (); - gtk_window_move (x->ttip_window, root_x, root_y); + gtk_window_move (x->ttip_window, root_x / xg_get_scale (f), + root_y / xg_get_scale (f)); gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); unblock_input (); } -- cgit v1.2.1 From 36cf0791ba75ee16dfbedfe437567ec6dd945b8a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 16:50:57 +0200 Subject: Remove usage of the GDK_SCALE variable * src/gtkutil.c (xg_get_gdk_scale): Remove. (xg_get_default_scrollbar_height) (xg_get_default_scrollbar_width): Pass in a frame to check for scaling. (xg_frame_set_char_size): Use the API for querying scale instead of looking at the GDK_SCALE variable. (xg_get_default_scrollbar_width): Ditto. (xg_get_default_scrollbar_height): Ditto. (xg_update_scrollbar_pos): Ditto. * src/xfns.c (x_set_scroll_bar_default_height): Pass in the frame to get the width. --- src/gtkutil.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 255091559e9..ccc42773217 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -845,21 +845,6 @@ xg_set_geometry (struct frame *f) } } -static int -xg_get_gdk_scale (void) -{ - const char *sscale = getenv ("GDK_SCALE"); - - if (sscale) - { - long scale = atol (sscale); - if (0 < scale) - return min (scale, INT_MAX); - } - - return 1; -} - /* Function to handle resize of our frame. As we have a Gtk+ tool bar and a Gtk+ menu bar, we get resize events for the edit part of the frame only. We let Gtk+ deal with the Gtk+ parts. @@ -921,12 +906,8 @@ xg_frame_set_char_size (struct frame *f, int width, int height) /* Do this before resize, as we don't know yet if we will be resized. */ x_clear_under_internal_border (f); - if (FRAME_VISIBLE_P (f)) - { - int scale = xg_get_gdk_scale (); - totalheight /= scale; - totalwidth /= scale; - } + totalheight /= xg_get_scale (f); + totalwidth /= xg_get_scale (f); x_wm_set_size_hint (f, 0, 0); @@ -1352,7 +1333,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) int min_rows = 0, min_cols = 0; int win_gravity = f->win_gravity; Lisp_Object fs_state, frame; - int scale = xg_get_gdk_scale (); + int scale = xg_get_scale (f); /* Don't set size hints during initialization; that apparently leads to a race condition. See the thread at @@ -3668,16 +3649,16 @@ update_theme_scrollbar_height (void) } int -xg_get_default_scrollbar_width (void) +xg_get_default_scrollbar_width (struct frame *f) { - return scroll_bar_width_for_theme * xg_get_gdk_scale (); + return scroll_bar_width_for_theme * xg_get_scale (f); } int -xg_get_default_scrollbar_height (void) +xg_get_default_scrollbar_height (struct frame *f) { /* Apparently there's no default height for themes. */ - return scroll_bar_width_for_theme * xg_get_gdk_scale (); + return scroll_bar_width_for_theme * xg_get_scale (f); } /* Return the scrollbar id for X Window WID on display DPY. @@ -3867,7 +3848,7 @@ xg_update_scrollbar_pos (struct frame *f, GtkWidget *wfixed = f->output_data.x->edit_widget; GtkWidget *wparent = gtk_widget_get_parent (wscroll); gint msl; - int scale = xg_get_gdk_scale (); + int scale = xg_get_scale (f); top /= scale; left /= scale; -- cgit v1.2.1 From b04132754e845d84e7e1b5c8bca581c64200aa64 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 16:54:51 +0200 Subject: Always return the GDK scale * src/gtkutil.c (xg_get_scale): Return the GDK scale always. --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index ccc42773217..6c9e069001e 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -208,7 +208,7 @@ xg_display_open (char *display_name, Display **dpy) int xg_get_scale (struct frame *f) { - if (FRAME_VISIBLE_P (f) && FRAME_GTK_WIDGET (f)) + if (FRAME_GTK_WIDGET (f)) return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); return 1; } -- cgit v1.2.1 From 552c90edb8cbf673b9a7d07ea39338585fce904a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 17:31:54 +0200 Subject: Make scaling work (?) on pre-GTK3 systems * src/gtkutil.c (xg_get_gdk_scale): Reinstate function. (xg_get_scale): Use it on non-GTK3 systems. --- src/gtkutil.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 6c9e069001e..dddf8b1c25c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -204,13 +204,30 @@ xg_display_open (char *display_name, Display **dpy) *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL; } +static int +xg_get_gdk_scale (void) +{ + const char *sscale = getenv ("GDK_SCALE"); + + if (sscale) + { + long scale = atol (sscale); + if (0 < scale) + return min (scale, INT_MAX); + } + + return 1; +} + /* Scaling/HiDPI functions. */ int xg_get_scale (struct frame *f) { +#ifdef HAVE_GTK3 if (FRAME_GTK_WIDGET (f)) return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); - return 1; +#endif + return xg_get_gdk_scale (); } /* Close display DPY. */ -- cgit v1.2.1 From 727b3df056d978c05bb5dbce5cef715b3b7c31db Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 17:32:43 +0200 Subject: Move comments around --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index dddf8b1c25c..03319726f09 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -204,6 +204,7 @@ xg_display_open (char *display_name, Display **dpy) *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL; } +/* Scaling/HiDPI functions. */ static int xg_get_gdk_scale (void) { @@ -219,7 +220,6 @@ xg_get_gdk_scale (void) return 1; } -/* Scaling/HiDPI functions. */ int xg_get_scale (struct frame *f) { -- cgit v1.2.1 From 742caff3b80b199020ea3d66b5f162cc43ec6174 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 18 Jul 2017 15:31:28 +0200 Subject: Don't use gtk_widget_get_scale_factor on old GTK3 versions * src/gtkutil.c (xg_get_scale): gtk_widget_get_scale_factor is only present since GTK 3.10. --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 03319726f09..0c8395efe9b 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -223,7 +223,7 @@ xg_get_gdk_scale (void) int xg_get_scale (struct frame *f) { -#ifdef HAVE_GTK3 +#if GTK_CHECK_VERSION (3, 10, 0) if (FRAME_GTK_WIDGET (f)) return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); #endif -- cgit v1.2.1 From 7cb3d3bba149ec69fc03bf261556cfe92a9d2b40 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 13:53:36 +0200 Subject: Use GdkSeat in new GDK versions * src/gtkutil.c (xg_event_is_for_scrollbar): Use GdkSeat instead of GdkDeviceManager in GDK 3.20+ --- src/gtkutil.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 0c8395efe9b..2675cd51586 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4138,8 +4138,13 @@ xg_event_is_for_scrollbar (struct frame *f, const XEvent *event) GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); GdkWindow *gwin; #ifdef HAVE_GTK3 +#if GTK_CHECK_VERSION (3, 20, 0) + GdkDevice *gdev + = gdk_seat_get_pointer (gdk_display_get_default_seat (gdpy)); +#else GdkDevice *gdev = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdpy)); +#endif gwin = gdk_device_get_window_at_position (gdev, NULL, NULL); #else gwin = gdk_display_get_window_at_pointer (gdpy, NULL, NULL); -- cgit v1.2.1 From d309ce429912a39c4f19877f23cf36116b679818 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 13:11:55 +0200 Subject: Remove use of a deprecated GTK+ function in new versions * src/gtkutil.c (xg_make_tool_item): Use gtk_widget_set_focus_on_click if available --- src/gtkutil.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 2675cd51586..7a110daef1e 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4617,7 +4617,11 @@ xg_make_tool_item (struct frame *f, if (wimage && text_image) gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); +#if GTK_CHECK_VERSION (3, 20, 0) + gtk_widget_set_focus_on_click (wb, FALSE); +#else gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE); +#endif gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE); gtk_container_add (GTK_CONTAINER (wb), vb); gtk_container_add (GTK_CONTAINER (weventbox), wb); -- cgit v1.2.1 From fe49aa17d505f13926eac2212b89effec9bd3c98 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 12:38:46 +0200 Subject: Always use gtk_window_move in new versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/gtkutil.c (my_log_handler): Don’t define in new versions of GTK+. (xg_set_geometry): Always use gtk_window_move in new versions of GTK+. * src/xterm.c (syms_of_xterm): Document that x-gtk-use-window-move is ignored. * lisp/subr.el (x-gtk-use-window-move): Make obsolete. --- src/gtkutil.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 7a110daef1e..a2e9f266758 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -792,6 +792,7 @@ xg_hide_tooltip (struct frame *f) General functions for creating widgets, resizing, events, e.t.c. ***********************************************************************/ +#if ! GTK_CHECK_VERSION (3, 22, 0) static void my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) @@ -799,6 +800,7 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, if (!strstr (msg, "visible children")) fprintf (stderr, "XX %s-WARNING **: %s\n", log_domain, msg); } +#endif /* Make a geometry string and pass that to GTK. It seems this is the only way to get geometry position right if the user explicitly @@ -810,8 +812,10 @@ xg_set_geometry (struct frame *f) { if (f->size_hint_flags & (USPosition | PPosition)) { +#if ! GTK_CHECK_VERSION (3, 22, 0) if (x_gtk_use_window_move) { +#endif /* Handle negative positions without consulting gtk_window_parse_geometry (Bug#25851). The position will be off by scrollbar width + window manager decorations. */ @@ -828,6 +832,7 @@ xg_set_geometry (struct frame *f) /* Reset size hint flags. */ f->size_hint_flags &= ~ (XNegative | YNegative); +# if ! GTK_CHECK_VERSION (3, 22, 0) } else { @@ -859,6 +864,7 @@ xg_set_geometry (struct frame *f) g_log_remove_handler ("Gtk", id); } +#endif } } -- cgit v1.2.1 From 853ed4533bbddf16c50ad12ed1db70fa252715fb Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 13:13:16 +0200 Subject: Fix GdkSettings-related deprecation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/gtkutil.c (xg_initialize): Don’t set deprecated and ignored gtk-menu-bar-accel setting in new versions of GTK+. Use g_object_set instead of deprecated gtk_settngs_set_string_property otherwise. --- src/gtkutil.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index a2e9f266758..a2e322b1dac 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -5244,6 +5244,7 @@ xg_initialize (void) settings = gtk_settings_get_for_screen (gdk_display_get_default_screen (gdk_display_get_default ())); +#if ! GTK_CHECK_VERSION (3, 10, 0) /* Remove F10 as a menu accelerator, it does not mix well with Emacs key bindings. It doesn't seem to be any way to remove properties, so we set it to "" which in means "no key". */ @@ -5251,13 +5252,18 @@ xg_initialize (void) "gtk-menu-bar-accel", "", EMACS_CLASS); +#endif /* Make GTK text input widgets use Emacs style keybindings. This is Emacs after all. */ +#if GTK_CHECK_VERSION (3, 16, 0) + g_object_set (settings, "gtk-key-theme-name", "Emacs", NULL); +#else gtk_settings_set_string_property (settings, "gtk-key-theme-name", "Emacs", EMACS_CLASS); +#endif /* Make dialogs close on C-g. Since file dialog inherits from dialog, this works for them also. */ -- cgit v1.2.1 From bc511a64f6da9ab51acc7c8865e80c4a4cb655c2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Sep 2017 15:52:52 -0700 Subject: Prefer HTTPS to FTP and HTTP in documentation Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now. --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index a2e322b1dac..0203a5d5c1a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ +along with GNU Emacs. If not, see . */ #include -- cgit v1.2.1 From b1f83c10df7d1bbb16f4e13d18119ad4aa1a2137 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 12:41:06 +0200 Subject: Don't call deprecated GTK function gtk_adjustment_changed * src/gtkutil.c (xg_set_toolkit_scroll_bar_thumb) (xg_set_toolkit_horizontal_scroll_bar_thumb): Remove calls to deprecated function gtk_adjustment_changed. This function has been deprecated since GTK+ 3.18. --- src/gtkutil.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 0203a5d5c1a..1073bd9384a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4085,8 +4085,10 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); +#if ! GTK_CHECK_VERSION (3, 18, 0) else if (changed) gtk_adjustment_changed (adj); +#endif xg_ignore_gtk_scrollbar = 0; @@ -4123,7 +4125,9 @@ xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, gtk_adjustment_configure (adj, (gdouble) value, (gdouble) lower, (gdouble) upper, (gdouble) step_increment, (gdouble) page_increment, (gdouble) pagesize); +#if ! GTK_CHECK_VERSION (3, 18, 0) gtk_adjustment_changed (adj); +#endif unblock_input (); } } -- cgit v1.2.1 From 7144e5e9f54ee41abe2e8f91ccd5901c86d38c4e Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 12:42:56 +0200 Subject: GTK+: Use a style provider instead of deprecated function * src/gtkutil.c (xg_set_widget_bg): Use a CSS style provider instead of the deprecated gtk_widget_override_background_color. --- src/gtkutil.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 1073bd9384a..03c404f86bb 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1050,16 +1050,23 @@ static void xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel) { #ifdef HAVE_GTK3 - GdkRGBA bg; XColor xbg; xbg.pixel = pixel; if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg)) { - bg.red = (double)xbg.red/65535.0; - bg.green = (double)xbg.green/65535.0; - bg.blue = (double)xbg.blue/65535.0; - bg.alpha = 1.0; - gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg); + const char format[] = "* { background-color: #%02x%02x%02x; }"; + /* The format is always longer than the resulting string. */ + char buffer[sizeof format]; + int n = snprintf(buffer, sizeof buffer, format, + xbg.red >> 8, xbg.green >> 8, xbg.blue >> 8); + eassert (n > 0); + eassert (n < sizeof buffer); + GtkCssProvider *provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, buffer, -1, NULL); + gtk_style_context_add_provider (gtk_widget_get_style_context(w), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_clear_object (&provider); } #else GdkColor bg; -- cgit v1.2.1 From f02e76fb8f8a862e43795056d61df5641c8a669b Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 13:08:37 +0200 Subject: GTK+: stop calling 'gtk_window_set_wmclass' in new versions * src/gtkutil.c (xg_create_frame_widgets): Stop calling deprecated function 'gtk_window_set_wmclass' in GTK+ 3.22. --- src/gtkutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 03c404f86bb..f3e89c82c66 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1227,9 +1227,11 @@ xg_create_frame_widgets (struct frame *f) a lot, so we turn off double buffering. */ gtk_widget_set_double_buffered (wfixed, FALSE); +#if ! GTK_CHECK_VERSION (3, 22, 0) gtk_window_set_wmclass (GTK_WINDOW (wtop), SSDATA (Vx_resource_name), SSDATA (Vx_resource_class)); +#endif /* Add callback to do nothing on WM_DELETE_WINDOW. The default in GTK is to destroy the widget. We want Emacs to do that instead. */ -- cgit v1.2.1 From f6818e761eaafe095e07249180dc8f9a329f1473 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 12:31:37 +0200 Subject: GTK+: Stop querying for background colors. * src/gtkutil.c (xg_check_special_colors): Don't call deprecated function gtk_style_context_get_background_color in newer versions of GTK+. --- src/gtkutil.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index f3e89c82c66..b98b0d08e7a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -566,6 +566,14 @@ xg_check_special_colors (struct frame *f, if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) return success_p; +#if GTK_CHECK_VERSION (3, 16, 0) + if (get_bg) + /* gtk_style_context_get_background_color is deprecated in + GTK+ 3.16. New versions of GTK+ don't use the concept of a + single background color any more, so we can't query for it. */ + return false; +#endif + block_input (); { #ifdef HAVE_GTK3 @@ -577,7 +585,12 @@ xg_check_special_colors (struct frame *f, if (get_fg) gtk_style_context_get_color (gsty, state, &col); else +#if GTK_CHECK_VERSION (3, 16, 0) + /* We can't get here. */ + emacs_abort (); +#else gtk_style_context_get_background_color (gsty, state, &col); +#endif unsigned short r = col.red * 65535, -- cgit v1.2.1 From c0af83b6ccf2dab9a515dd7f52eb9d4500275ae3 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 27 Aug 2017 12:45:52 +0200 Subject: Don't attempt to disable double buffering in newer GTK+ versions * src/gtkutil.c (xg_create_frame_widgets): Stop calling deprecated function gtk_widget_set_double_buffered. --- src/gtkutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index b98b0d08e7a..8ecbc5c91ed 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1233,12 +1233,14 @@ xg_create_frame_widgets (struct frame *f) if (FRAME_EXTERNAL_TOOL_BAR (f)) update_frame_tool_bar (f); +#if ! GTK_CHECK_VERSION (3, 14, 0) /* We don't want this widget double buffered, because we draw on it with regular X drawing primitives, so from a GTK/GDK point of view, the widget is totally blank. When an expose comes, this will make the widget blank, and then Emacs redraws it. This flickers a lot, so we turn off double buffering. */ gtk_widget_set_double_buffered (wfixed, FALSE); +#endif #if ! GTK_CHECK_VERSION (3, 22, 0) gtk_window_set_wmclass (GTK_WINDOW (wtop), -- cgit v1.2.1 From 2fa19cc5510cdbf00c54991a9959be984dd99fbe Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Tue, 26 Sep 2017 20:28:29 +0200 Subject: Revert "Don't attempt to disable double buffering in newer GTK+ versions" This reverts commit c0af83b6ccf2dab9a515dd7f52eb9d4500275ae3. --- src/gtkutil.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 8ecbc5c91ed..b98b0d08e7a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1233,14 +1233,12 @@ xg_create_frame_widgets (struct frame *f) if (FRAME_EXTERNAL_TOOL_BAR (f)) update_frame_tool_bar (f); -#if ! GTK_CHECK_VERSION (3, 14, 0) /* We don't want this widget double buffered, because we draw on it with regular X drawing primitives, so from a GTK/GDK point of view, the widget is totally blank. When an expose comes, this will make the widget blank, and then Emacs redraws it. This flickers a lot, so we turn off double buffering. */ gtk_widget_set_double_buffered (wfixed, FALSE); -#endif #if ! GTK_CHECK_VERSION (3, 22, 0) gtk_window_set_wmclass (GTK_WINDOW (wtop), -- cgit v1.2.1 From 1e5949642a19a21fd9d47f66c66fd4d3bd99e910 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Tue, 26 Sep 2017 20:34:27 +0200 Subject: ; * src/gtkutil.c (xg_create_frame_widgets): Add FIXME re. X drawing --- src/gtkutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 0203a5d5c1a..0da70399193 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1217,7 +1217,10 @@ xg_create_frame_widgets (struct frame *f) with regular X drawing primitives, so from a GTK/GDK point of view, the widget is totally blank. When an expose comes, this will make the widget blank, and then Emacs redraws it. This flickers - a lot, so we turn off double buffering. */ + a lot, so we turn off double buffering. + FIXME: gtk_widget_set_double_buffered is deprecated and might stop + working in the future. We need to migrate away from combining + X and GTK+ drawing to a pure GTK+ build. */ gtk_widget_set_double_buffered (wfixed, FALSE); gtk_window_set_wmclass (GTK_WINDOW (wtop), -- cgit v1.2.1 From 5406be4db6528095b5e5b8bf94b06b2c06610340 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 29 Sep 2017 22:43:19 +0200 Subject: Revert "GTK+: Stop querying for background colors." This reverts commit f6818e761eaafe095e07249180dc8f9a329f1473. --- src/gtkutil.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index b98b0d08e7a..f3e89c82c66 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -566,14 +566,6 @@ xg_check_special_colors (struct frame *f, if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) return success_p; -#if GTK_CHECK_VERSION (3, 16, 0) - if (get_bg) - /* gtk_style_context_get_background_color is deprecated in - GTK+ 3.16. New versions of GTK+ don't use the concept of a - single background color any more, so we can't query for it. */ - return false; -#endif - block_input (); { #ifdef HAVE_GTK3 @@ -585,12 +577,7 @@ xg_check_special_colors (struct frame *f, if (get_fg) gtk_style_context_get_color (gsty, state, &col); else -#if GTK_CHECK_VERSION (3, 16, 0) - /* We can't get here. */ - emacs_abort (); -#else gtk_style_context_get_background_color (gsty, state, &col); -#endif unsigned short r = col.red * 65535, -- cgit v1.2.1 From bccf635217b0ba887d95b429f7d5d6903007a7b1 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 29 Sep 2017 22:47:33 +0200 Subject: ; * src/gtkutil.c (xg_check_special_colors): Add another GTK+ FIXME. --- src/gtkutil.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 0da70399193..9f05524738b 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -577,6 +577,10 @@ xg_check_special_colors (struct frame *f, if (get_fg) gtk_style_context_get_color (gsty, state, &col); else + /* FIXME: gtk_style_context_get_background_color is deprecated + in GTK+ 3.16. New versions of GTK+ don’t use the concept of + a single background color any more, so we shouldn’t query for + it. */ gtk_style_context_get_background_color (gsty, state, &col); unsigned short -- cgit v1.2.1 From 5172fa02cccaab2500ecf85aaf65b8deed54d42e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 1 Oct 2017 19:53:56 -0700 Subject: Prefer HTTPS to HTTP for gnu.org This fixes some URLs I omitted from my previous pass, notably those in lists.gnu.org. Although lists.gnu.org does not yet support TLS 1.1, TLS 1.0 is better than nothing. * lisp/erc/erc.el (erc-official-location): * lisp/mail/emacsbug.el (report-emacs-bug): Use https:, not http:. --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index 9f05524738b..a07ee4b1b02 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1367,7 +1367,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) /* Don't set size hints during initialization; that apparently leads to a race condition. See the thread at - http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00033.html */ + https://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00033.html */ if (NILP (Vafter_init_time) || !FRAME_GTK_OUTER_WIDGET (f) || FRAME_PARENT_FRAME (f)) -- cgit v1.2.1 From 0fff900c18c3ae497294f26fd42b70990638d3ed Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 29 Sep 2017 23:55:57 +0200 Subject: Work around deprecation of gtk_style_context_get_background_color * src/gtkutil.c (xg_check_special_colors): Replace call to gtk_style_context_get_background_color with its definition. --- src/gtkutil.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index a07ee4b1b02..c7d8f92829a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -577,11 +577,18 @@ xg_check_special_colors (struct frame *f, if (get_fg) gtk_style_context_get_color (gsty, state, &col); else - /* FIXME: gtk_style_context_get_background_color is deprecated - in GTK+ 3.16. New versions of GTK+ don’t use the concept of - a single background color any more, so we shouldn’t query for - it. */ - gtk_style_context_get_background_color (gsty, state, &col); + { + GdkRGBA *c; + /* FIXME: Retrieving the background color is deprecated in + GTK+ 3.16. New versions of GTK+ don’t use the concept of a + single background color any more, so we shouldn’t query for + it. */ + gtk_style_context_get (gsty, state, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c, + NULL); + col = *c; + gdk_rgba_free (c); + } unsigned short r = col.red * 65535, -- cgit v1.2.1 From a89f0b6f33f9eb8910a1fceda9028d76ef50b05d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 25 Nov 2017 22:45:41 -0800 Subject: maint: shorten https://lists.gnu.org/archive/html/... links --- src/gtkutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtkutil.c') diff --git a/src/gtkutil.c b/src/gtkutil.c index c7d8f92829a..2708e5f0f7c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1374,7 +1374,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) /* Don't set size hints during initialization; that apparently leads to a race condition. See the thread at - https://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00033.html */ + https://lists.gnu.org/r/emacs-devel/2008-10/msg00033.html */ if (NILP (Vafter_init_time) || !FRAME_GTK_OUTER_WIDGET (f) || FRAME_PARENT_FRAME (f)) -- cgit v1.2.1