1. 20 Nov, 2021 4 commits
    • Po Lu's avatar
      Prevent crashes when scrolling in an unknown Window on XI2 · 7294a286
      Po Lu authored
      * src/xterm.c (handle_one_xevent): Fix XI2 frame lookup to
      handle foreign windows.
      7294a286
    • Po Lu's avatar
      Fix a comment in XInput related code · 6b0424c1
      Po Lu authored
      * src/xterm.c (x_term_init): Fix comment to say "XInput 2.1"
      instead of "XInput 1.1".
      6b0424c1
    • Po Lu's avatar
      Expose pixel-wise wheel events to Lisp · 0c51c1b5
      Po Lu authored
      * doc/lispref/commands.texi (Misc Events): Document changes to
      wheel events.
      
      * src/keyboard.c (make_lispy_event): Handle wheel events with
      pixel delta data.
      * src/termhooks.h (WHEEL_EVENT): Document changes to
      WHEEL_EVENT args.
      * src/xfns.c (syms_of_xfns): Declare new symbols.
      * src/xterm.c (handle_one_xevent): Give wheel events pixel delta
      data.
      (x_coalesce_scroll_events): New user option.
      0c51c1b5
    • Po Lu's avatar
      Add support for event processing via XInput 2 · 487ec3cf
      Po Lu authored
      * configure.ac: Add an option to use XInput 2 if available.
      * src/Makefile.in (XINPUT_LIBS, XINPUT_CFLAGS): New variables.
      (EMACS_CFLAGS): Add Xinput CFLAGS.
      (LIBES): Add XInput libs.
      * src/xmenu.c (popup_activated_flag): Expose flag if
      XInput 2 is available.
      * src/xfns.c (x_window): Set XInput 2 event mask.
      (setup_xi_event_mask): New function.
      (syms_of_xfns): Provide XInput 2 feature.
      * src/xterm.c (x_detect_focus_change): Handle XInput 2
      GenericEvents.
      (handle_one_xevent): Handle XInput 2 events.
      (x_term_init): Ask the server for XInput 2 support and set
      xkb_desc if available.
      (x_delete_terminal): Free XKB kb desc if it exists, and free
      XI2 devices if they exist.
      (xi_grab_or_ungrab_device)
      (xi_reset_scroll_valuators_for_device_id)
      (x_free_xi_devices, x_init_master_valuators): New functions.
      (x_get_scroll_valuator_delta): New function.
      (init_xterm): Don't tell GTK to only use Core Input when built
      with XInput 2 support.
      * src/xterm.h (struct x_display_info): Add fields for XKB
      and XI2 support.
      * src/gtkutil.c (xg_event_is_for_menubar): Handle
      XIDeviceEvents.
      (xg_is_menu_window): New function.
      (xg_event_is_for_scrollbar): Handle XIDeviceEvents.
      * etc/NEWS: Document changes.
      
      * lisp/mwheel.el (mouse-wheel-down-alternate-event)
      (mouse-wheel-up-alternate-event)
      (mouse-wheel-left-alternate-event)
      (mouse-wheel-right-alternate-event): New user options.
      
      (mouse-wheel-text-scale)
      (mwheel-scroll): Test for alternate events.
      (mouse-wheel--setup-bindings): Set up bindings for alternate
      buttons.
      487ec3cf
  2. 16 Nov, 2021 1 commit
  3. 15 Nov, 2021 1 commit
    • Po Lu's avatar
      Stop assuming xwidget views will only be displayed in TEXT_AREA · d9e91da7
      Po Lu authored
      * src/xterm.c (x_scroll_run): Use view->area when calculating
      xwidget view clipping.
      
      * src/xwidget.c (x_draw_xwidget_glyph_string): Set view->area
      to s->area and use that instead.
      
      * src/xwidget.h (struct xwidget_view): Add glyph row area field.
      d9e91da7
  4. 13 Nov, 2021 2 commits
  5. 10 Nov, 2021 2 commits
    • Po Lu's avatar
      Revert "Add support for event processing via XInput 2" · b21f1cab
      Po Lu authored
      This reverts commit 346cfc81.
      b21f1cab
    • oldosfan's avatar
      Add support for event processing via XInput 2 · 346cfc81
      oldosfan authored
      * configure.ac: Add an option to use XInput 2 if available
      * src/Makefile.in (XINPUT_LIBS, XINPUT_CFLAGS): New variables
      (EMACS_CFLAGS): Add Xinput CFLAGS
      (LIBES): Add XInput libs
      * src/xmenu.c (popup_activated_flag): Expose flag if XInput 2 is
      available
      * src/xfns.c (x_window): Set XInput 2 event mask
      * src/xterm.c (x_detect_focus_change): Handle XInput 2 GenericEvents
      (handle_one_xevent): Handle XInput 2 events
      (x_term_init): Ask the server for XInput 2 support and set xkb_desc if
      available
      (x_delete_terminal): Free XKB kb desc if it exists, and free XI2
      devices if they exist
      (x_free_xi_devices, x_init_master_valuators): New functions
      (x_get_scroll_valuator_delta): New function
      (init_xterm): Don't tell GTK to only use Core Input when built with
      XInput 2 support
      * src/xterm.h (struct x_display_info): Add fields for XKB and XI2
      support
      * src/gtkutil.c (xg_event_is_for_menubar): Handle XIDeviceEvents
      (xg_is_menu_window): New function
      (xg_event_is_for_scrollbar): Handle XIDeviceEvents
      346cfc81
  6. 09 Nov, 2021 2 commits
  7. 07 Nov, 2021 10 commits
    • Lars Ingebrigtsen's avatar
      Ensure that the x_show_hourglass is seen · c5767603
      Lars Ingebrigtsen authored
      * src/xterm.c (x_show_hourglass): Ensure that the hourglass is
      seen (bug#51649).
      c5767603
    • Lars Ingebrigtsen's avatar
      Remove too-agressive window refresh in the hourglass code · b42a4884
      Lars Ingebrigtsen authored
      * src/xterm.c (x_show_hourglass): Don't force a spurious refresh
      (bug#51649).
      b42a4884
    • Po Lu's avatar
      Select window when clicking on an xwidget view · 49ed7066
      Po Lu authored
      * src/xterm.c (handle_one_xevent): Select window when clicking on an
      xwidget view.
      49ed7066
    • Po Lu's avatar
      Fix xwidget scrolling · 650e5e8e
      Po Lu authored
      * src/xterm.c (x_scroll_run): Use from_y and height.
      650e5e8e
    • Po Lu's avatar
      Handle crossing events on xwidget windows correctly · 3e640399
      Po Lu authored
      * src/xterm.c (handle_one_xevent): Clear help and mouse face
      when handling xwidget entry events.
      * src/xwidget.c (xwidget_motion_or_crossing): Add device to crossing
      events.
      (x_draw_xwidget_glyph_string): Add EnterWindowMask and
      LeaveWindowMask.
      3e640399
    • Po Lu's avatar
      Implement function for sending events to widgets · b39f1f15
      Po Lu authored
      * doc/lispref/display.texi (Xwidgets): Document changes.
      * src/keyboard.c (lispy_function_keys): Make non-static on X.
      * src/keyboard.h (lispy_function_keys): Expose lispy_function_keys on
      X.
      * src/xterm.c (x_emacs_to_x_modifiers): Export function.
      * src/xterm.h (x_emacs_to_x_modifiers): Likewise.
      * src/xwidget.c (Fxwidget_perform_lispy_event)
      (find_suitable_keyboard): New functions.
      (syms_of_xwidget): Define new subr.
      b39f1f15
    • Po Lu's avatar
      Allow xwidgets to accept motion and button events · f52f7725
      Po Lu authored
      * src/xterm.c (handle_one_xevent): Pass through some events to
      xwidgets.
      
      * src/xwidget.c (synthesize_focus_in_event)
      (find_suitable_pointer, xwidget_button_1)
      (xwidget_button, xwidget_motion_or_crossing): New functions.
      (xwidget_view_from_window): Draw offscreen window instead of the
      widget.
      (x_draw_xwidget_glyph_string): Set appropriate event masks.
      
      * src/xwidget.h (xwidget_button, xwidget_motion_or_crossing): New
      functions.
      f52f7725
    • Po Lu's avatar
      Destroy xwidgets when destroying frames · 9c9e15a0
      Po Lu authored
      * src/xterm.c (x_free_frame_resources): Make sure to kill xwidget views.
      * src/xwidget.c (Fmake_xwidget): Attach damage event signal.
      (offscreen_damage_event): Operate on xwidgets and not individual
      views.
      (xwidget_init_view): Don't attach damage event signal here.
      (Fdelete_xwidget_view): Destroy window correctly and stop removing
      damage event signal.
      (kill_frame_xwidget_views): New function.
      * src/xwidget.c (kill_frame_xwidget_views): New function.
      9c9e15a0
    • Po Lu's avatar
      Enable scrolling optimization for xwidgets · 5c387ad4
      Po Lu authored
      * src/dispextern.h (struct glyph): Store xwidget ID instead of a
      reference.
      * src/dispnew.c (scrolling_window): Enable scrolling optimization on
      xwidget builds.
      * src/xdisp.c (fill_xwidget_glyph_string, produce_xwidget_glyph):
      Obtain xwidget from ID.
      * src/xterm.c (x_scroll_run): Scroll xwidget windows.
      * src/xwidget.c (id_to_xwidget_map, xwidget_counter): New xwidget
      variables.
      (Fmake_xwidget): Assign each xwidget a unique ID, and keep track of
      that ID.
      (xwidget_from_id): New function.
      (syms_of_xwidget): Initialize id_to_xwidget_map.
      (xwidget_end_redisplay): Lookup xwidgets via ID.
      * src/xwidget.h (struct xwidget): Add ID field.
      (xwidget_from_id): New function.
      5c387ad4
    • Po Lu's avatar
      Use an X window to display xwidgets on X11 · 61d049aa
      Po Lu authored
      Since Emacs draws using X11 primitives, Emacs drawing operations can
      erase the GtkDrawingArea used to draw the offscreen widget, which
      leads to unpleasant flickering effects, all of which can be prevented
      by creating a native X window and drawing to that instead.
      
      * src/xterm.c (x_window_to_frame): Return xwidget window if
      appropriate.
      (handle_one_xevent): Handle xwidget expose events.
      
      * src/xwidget.c (x_window_to_xvw_map): New variable.
      (xwidget_view_from_window): New function.
      
      (xwidget_show_view, xwidget_hide_view)
      (offscreen_damage_event): Move to drawing xwidgets with X windows.
      
      (xv_do_draw)
      (xwidget_expose): New function.
      
      (xwidget_osr_draw_cb, xwidget_osr_event_forward)
      (xwidget_osr_event_set_embedder): Removed.
      
      (xwidget_init_view): Replace use of GtkDrawingArea with that of an X
      window.
      
      (x_draw_xwidget_glyph_string): Prevent xwidget views from constantly
      generating expose events, and use an X window instead of a
      GtkDrawingArea.
      
      (syms_of_xwidget): Initialize x_window_to_xwv_map.
      
      src/xwidget.h (struct xwidget_view): Replace GTK widgets with
      X-related fields.
      
      (xwidget_view_from_window, xwidget_expose): New functions.
      61d049aa
  8. 27 Oct, 2021 1 commit
  9. 17 Oct, 2021 1 commit
    • Po Lu's avatar
      Fix minor issues with text display when cursor is in mouse face · 2028df78
      Po Lu authored
       * src/xdisp.c (get_cursor_offset_for_mouse_face): Don't calculate
      offsets for the glyph the cursor is on, and move some logic to
      get_glyph_pixel_width_delta_for_mouse_face.
      (fill_composite_glyph_string)
      (fill_gstring_glyph_string)
      (fill_glyphless_glyph_string)
      (fill_glyph_string)
      (fill_image_glyph_string)
      (fill_xwidget_glyph_string)
      (fill_stretch_glyph_string): Set s->face to mouse face whenever
      appropriate.
      (get_glyph_pixel_width_delta_for_mouse_face): New function.
      (set_glyph_string_background_width): Update background width and
      s->width to take into account differing :box properties of the mouse
      face, when producing strings for the cursor.
      (erase_phys_cursor): Redraw mouse face when erasing a cursor on top of
      the mouse face.
       * src/xterm.c (x_set_mouse_face_gc): Stop setting s->face when under
      mouse face because redisplay now does that for us.
       * src/w32term.c (w32_set_mouse_face_gc): Likewise.
      2028df78
  10. 04 Oct, 2021 2 commits
    • Paul Eggert's avatar
      Tweak x_connection_closed when I/O error · e1fb7313
      Paul Eggert authored
      * src/xterm.c (x_connection_closed): Don’t dereference dpyinfo
      in the unlikely case where it is null and ioerror is true.
      This pacifies gcc 11.2.1 -Wanalyzer-null-dereference.
      e1fb7313
    • Paul Eggert's avatar
      Port unused decls to C2x · d00f3d4c
      Paul Eggert authored
      * src/conf_post.h (ATTRIBUTE_UNUSED): Remove.  All uses replaced
      by MAYBE_UNUSED, and moved to start as needed for C2x.
      d00f3d4c
  11. 17 Sep, 2021 1 commit
    • Eli Zaretskii's avatar
      Fix display of stretch glyphs · 6397faaa
      Eli Zaretskii authored
      * src/xterm.c (x_draw_stretch_glyph_string):
      * src/w32term.c (w32_draw_stretch_glyph_string): Fix drawing
      stretch glyphs when the window is hscrolled.  (The original
      pre-Jan-2021 code was almost correct, except that it used
      'window_box_left_offset' instead of 'window_box_left', and didn't
      restrict the background_width fixup to text-area.)  (Bug#50564)
      6397faaa
  12. 11 Sep, 2021 1 commit
    • Alan Third's avatar
      Fix display of tab-bar buttons · e40f5a91
      Alan Third authored
      * src/xterm.c (x_draw_image_relief):
      * src/w32term.c (w32_draw_image_relief): Fix the display of
      tab-bar buttons when mouse pointer moves off the button.
      (Bug#50424)
      e40f5a91
  13. 07 Sep, 2021 1 commit
    • Eli Zaretskii's avatar
      Fix display of tab-bar buttons · db74a936
      Eli Zaretskii authored
      * src/xterm.c (x_draw_image_relief):
      * src/w32term.c (w32_draw_image_relief): Fix calculation of relief
      thickness for tab-bar buttons.
      
      * lisp/tab-bar.el (tab-bar--load-buttons)
      (tab-bar-history-mode): Fix the :margin specification for tab-bar
      buttons.  (Bug#50424)
      db74a936
  14. 05 Sep, 2021 1 commit
    • Juri Linkov's avatar
      Improve tab-bar event handling (bug#41343) · 794fdce5
      Juri Linkov authored
      * lisp/tab-bar.el (tab-bar--key-to-number): Rename from tab--key-to-number.
      (tab-bar--event-to-item): New function from tab-bar-handle-mouse.
      (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab)
      (tab-bar-mouse-context-menu, tab-bar-mouse-move-tab):
      Use tab-bar--event-to-item.
      
      * src/menu.c (x_popup_menu_1): Handle Qtab_bar in the second list element.
      
      * src/xdisp.c (tty_get_tab_bar_item): Change arg 'end' to bool 'close_p'.
      (tty_get_tab_bar_item): Detect if the close button was clicked.
      (tty_handle_tab_bar_click): Return a list with caption that has
      text properties.
      794fdce5
  15. 18 Aug, 2021 2 commits
    • Juri Linkov's avatar
      Mouse wheel scrolling on the tab bar · ad9c57f5
      Juri Linkov authored
      * lisp/tab-bar.el (tab-bar-map): Bind mouse-4/wheel-up/wheel-left
      to tab-previous and mouse-5/wheel-down/wheel-right to tab-next.
      Bind S-mouse-4/wheel-up/wheel-left to tab-bar-move-tab-backward
      and S-mouse-5/wheel-down/wheel-right to tab-bar-move-tab.
      (tab-bar-move-tab-backward): New command.
      (tab-bar-move-repeat-map): Use tab-bar-move-tab-backward
      instead of lambda.
      
      * src/xterm.c (handle_one_xevent): Remove restriction
      to allow clicking mouse-4 and mouse-5.
      ad9c57f5
    • Juri Linkov's avatar
      Redesign tab-bar event processing (bug#41342, bug#41343) · e6bea0cb
      Juri Linkov authored
      Instead of emitting menu-item keys like [tab-1],
      emit normal mouse events like [mouse-1] and [down-mouse-3]
      for all mouse clicks issued on the tab-bar.
      
      * lisp/mouse.el (mouse-posn-property): Handle 'tab-bar' posn-area.
      
      * lisp/tab-bar.el (tab--key-to-number): New internal function.
      (tab-bar-handle-mouse): Use tab key to select/close tab.
      (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab)
      (tab-bar-mouse-context-menu): New commands.
      (tab-bar-map): Bind [down-mouse-1] to tab-bar-mouse-select-tab,
      [down-mouse-2] to tab-bar-mouse-close-tab,
      [down-mouse-3] to tab-bar-mouse-context-menu.
      (tab-bar-keymap-cache): Remove.
      (tab-bar-make-keymap): Don't use cache.
      (tab-bar--format-tab): Remove default bindings from menu items.
      (tab-bar-make-keymap-1): Prepend tab-bar-map.
      
      * src/keyboard.c (make_lispy_event): Append event->arg to position
      for Qtab_bar.
      
      * src/term.c (handle_one_term_event): Simplify to set event arg.
      
      * src/w32inevt.c (do_mouse_event): Set emacs_ev->arg to the value
      returned from tty_handle_tab_bar_click.
      
      * src/w32term.c (w32_handle_tab_bar_click): Return value from
      handle_tab_bar_click.
      (w32_read_socket): Set tab_bar_key to value returned from
      w32_handle_tab_bar_click, and set event arg from it.
      
      * src/xdisp.c (handle_tab_bar_click): Instead of emitting event,
      return a list with Qtab_bar and tab caption with text properties
      that contain Qmenu_item with key and binding.
      (tty_handle_tab_bar_click): Simplify to return a list of Qtab_bar,
      key and close_p, instead of emitting event.
      
      * src/xterm.c (handle_one_xevent): Set tab_bar_key to value
      returned from handle_tab_bar_click, and set event arg from it.
      e6bea0cb
  16. 15 May, 2021 1 commit
  17. 13 May, 2021 1 commit
  18. 12 May, 2021 1 commit
    • Martin Rudalics's avatar
      Handle Bug#24526 without breaking Emacs on tiling WMs (Bug#48268) · b41f39d2
      Martin Rudalics authored
      Since tiling window managers may react allergically to resize
      requests immediately following MapNotify events on X, make sure
      that such requests are issued only when a new frame should not
      become visible and a size has been explicitly requested for it.
      
      * lisp/faces.el (x-create-frame-with-faces): Mark frame as
      'was-invisible' if it should be initially invisible or iconified
      and has its size specified explicitly.
      * src/frame.c (make_frame): Initialize new frame's was_invisible
      flag.
      (Fframe__set_was_invisible): New internal function.
      * src/frame.h (struct frame): Specify size of new_size_p slot.
      New flag was_invisible.
      * src/w32fns.c (Fx_create_frame)
      * src/nsfns.m (Fx_create_frame)
      * src/xfns.c (Fx_create_frame): Set new frame's was_invisible
      flag.
      * src/xterm.c (handle_one_xevent): Call xg_frame_set_char_size
      after a PropertyNotify or MapNotify event only if F's
      was_invisible flag was set.
      b41f39d2
  19. 05 May, 2021 1 commit
    • Martin Rudalics's avatar
      Fix two GTK3 event handling issues · 483c5e95
      Martin Rudalics authored
      * src/xterm.c (handle_one_xevent): For GTK3 PropertyNotify and
      MapNotify events explicitly request the stored frame sizes when
      the frame changes from iconified to a non-hidden state
      (Bug#24526).  For Expose events do not change the frame's
      visibility or iconified state.  For FocusIn events on GTK3 do
      not apply the fix for Bug#42655.  The latter two changes are to
      avoid that plain invisible frames get reported as iconified.
      483c5e95
  20. 04 May, 2021 1 commit
    • Martin Rudalics's avatar
      Fix a problem with x_set_tab_bar_lines (Bug#46827) · 8a4bb6b0
      Martin Rudalics authored
      * src/xfns.c (x_set_tab_bar_lines): Call
      x_change_tab_bar_height only if the number of tab bar lines
      changed from or to zero (Bug#46827).
      * src/xterm.c (x_make_frame_visible): Make frame_size_history
      update less noisy by doing it only if the frame wasn't visible
      before.
      8a4bb6b0
  21. 02 May, 2021 1 commit
    • Martin Rudalics's avatar
      Make adjust_frame_size set up frame's new_width/_height too (Bug#17120) · 8a4081c3
      Martin Rudalics authored
      The purpose of this change is to have implied frame size changes
      pick up sizes requested by previous explicit size changes not
      only after they have been confirmed by the WM but already when
      they are initially passed to adjust_frame_size (Bug#17120).
      
      * src/dispextern.h (delayed_size_change): Remove extern.
      * src/dispnew.c (delayed_size_change): Make static again.
      (do_pending_window_change): Call change_frame_size only if F's
      new_size_p flag is set.
      (change_frame_size_1): Set/reset F's new_size_p flag
      * src/frame.c (adjust_frame_size): Remove extra
      inhibit_horizontal/_vertical checks.  Improve the implied
      resizes check with INHIBIT equals 2.  Set F's new_width and
      new_height and reset F's new_size_p flag when we run
      set_window_size_hook with INHIBIT 0 or 1.
      * src/frame.h (struct frame): New bit slot new_size_p.
      * src/gtkutil.c (xg_frame_resized): Use F's new_size_p flag
      instead of delayed_size_change to decide whether to call
      change_frame_size.
      (xg_frame_set_char_size): Call frame_size_history_extra before
      waiting for the ConfigureNotify event.
      * src/xterm.c (handle_one_xevent): Use F's new_size_p flag
      instead of delayed_size_change to decide whether to call
      change_frame_size.
      8a4081c3
  22. 27 Apr, 2021 2 commits
    • Martin Rudalics's avatar
      Major rewrite of adjust_frame_size · a190b4cf
      Martin Rudalics authored
      Have adjust_frame_size pass native frame sizes to backends
      instead of text sizes.  Expand frame size history management.
      Drop PIXELWISE argument from change_frame_size and convert
      native to text sizes only when calling adjust_frame_size.  Use
      convention in arguments that -1 instead of 0 means that no size
      change is required.  When adjusting frame sizes pick up delayed
      size changes (Bug#46827).
      
      * lisp/frame.el (frame-notice-user-settings, make-frame): Don't
      set frame size history.
      (frame--size-history): Rewrite doc-string.  Handle new formats
      of `frame-size-history' entries.
      * src/dispextern.h (delayed_size_change): Extern it.
      (change_frame_size): Drop last argument from extern.
      * src/dispnew.c (delayed_size_change): Make it global.
      (handle_window_change_signal): Reformat.  Drop last argument
      from change_frame_size call.
      (do_pending_window_change, init_display_interactive): Drop last
      argument from change_frame_size call.
      (change_frame_size_1): NEW_WIDTH and NEW_HEIGHT now specify
      native sizes.  Drop last argument PIXELWISE.  Queue a change
      when it either differs from F's current pixel sizes or F's
      previously queued sizes.  Inject frame_size_history_extra call
      when queuing.  Adopt convention that for queued sizes -1 means
      that no size change is required.  Convert from native to text
      sizes when calling adjust_frame_size.
      (change_frame_size): Drop last argument PIXELWISE and drop it
      also in change_frame_size_1 calls.
      * src/frame.c (frame_size_history_add): Remove.
      (frame_inhibit_resize): Remove call to frame_size_history_add.
      (set_menu_bar_lines, set_tab_bar_lines): Simplify.  Drop last
      argument from change_frame_size call.
      (frame_windows_min_size): No more static.
      (keep_ratio): Minor rewrite using macros.
      (frame_size_history_adjust, frame_size_history_plain)
      (frame_size_history_extra): New functions.
      (adjust_frame_size): Major rewrite.  Adopt new convention that
      negative values for new sizes mean no change.  Pick up delayed
      size changes from F's new_width and new_height slots
      (Bug#46827).  Call set_window_size_hook with native instead of
      text sizes.  Do not sanitize window sizes any more.  Call
      frame_size_history_adjust instead of frame_size_history_add.
      Always set F's resized_p slot to true.
      (make_frame): Initialize new_width and new_height slots to -1.
      Simplify setup of initial sizes and an adjust_frame_size call.
      (Fframe_parameters): Drop processing F's new_pixelwise slot.
      (check_frame_pixels): Reorder to make declarations appear first.
      (Fset_frame_height, Fset_frame_width, Fset_frame_size): Pass
      explicit width and height values to adjust_frame_size instead of
      -1.
      (gui_set_frame_parameters): Minor rewrite making sure that
      explicit sizes and the corresponding parameter are passed to
      adjust_frame_size.  Remove frame_size_history_add call.
      (gui_figure_window_size): Drop last two arguments.  Simplify
      assignment of initial size.  Set new_height and new_width slots
      to -1.  Use adjust_frame_size to set sizes instead of returning
      them to caller.
      (syms_of_frame): Drop symbols used by frame size history; these
      are now built on-the-fly.  Also drop some menu bar related
      symbols in favor of Qmenu_bar_lines.
      * src/frame.h (struct frame): Remove new_pixelwise.
      (SET_FRAME_COLS, SET_FRAME_LINES, SET_FRAME_WIDTH)
      (SET_FRAME_HEIGHT): Remove macros.
      (frame_size_history_add): Remove externs.
      (frame_windows_min_size, frame_size_history_plain)
      (frame_size_history_extra): Add externs.
      (FRAME_WINDOWS_WIDTH, FRAME_WINDOWS_HEIGHT): Rename to
      FRAME_INNER_WIDTH and FRAME_INNER_HEIGHT.
      (gui_figure_window_size): Drop last two arguments from
      extern.
      * src/gtkutil.c (xg_frame_resized): Rename arguments to WIDTH
      and HEIGHT.  Consult delayed_size_change to handle case where
      WIDTH and HEIGHT do not match F's new_width and new_height
      values.  Call change_frame_size with native sizes and without
      PIXELWISE argument.  Instead of frame_size_history_add call
      frame_size_history_extra.
      (xg_frame_set_char_size): WIDTH and HEIGHT are native sizes now;
      fix adjust_frame_size call accordingly.  Instead of
      frame_size_history_add call frame_size_history_extra.
      (style_changed_cb): Call xg_frame_set_char_size with native
      instead of text sizes.
      (tb_size_cb): Remove frame_size_history_add call.  Call
      adjust_frame_size with INHIBIT 5.
      (free_frame_tool_bar, xg_change_toolbar_position): Remove
      frame_size_history_add call.
      (update_frame_tool_bar): Call adjust_frame_size with INHIBIT 2
      and let it handle frame_inhibit_implied_resize and
      fullheight/-width.  Remove frame_size_history_add call.
      * src/keyboard.c (Fsuspend_emacs): Call change_frame_size with
      native sizes.
      * src/nsfns.m (ns_set_tool_bar_lines): Call adjust_frame_size
      with INHIBIT 2 and let it handle frame_inhibit_implied_resize
      and fullheight/-width.  Remove frame_size_history_add call.
      (Fx_create_frame): Drop two last arguments in
      gui_figure_window_size call.  Do not SET_FRAME_WIDTH and
      SET_FRAME_HEIGHT, the adjust_frame_size in
      gui_figure_window_size did that already.
      * src/nsterm.m (ns_set_window_size): Drop PIXELWISE argument and
      its processing; WIDTH and HEIGHT represent native pixel sizes
      now.  Call change_frame_size with native sizes.  Remove call to
      frame_size_history_add.
      ([EmacsView viewDidResize:]): Call change_frame_size with native
      sizes.
      * src/term.c (Fresume_tty): Call change_frame_size with native
      sizes.
      * src/termhooks.h (*set_window_size_hook): Drop last argument
      PIXELWISE.
      * src/w32fns.c (w32_change_tab_bar_height)
      (w32_change_tool_bar_height): Fix handling of these in the initial
      phase before they have been resized at least once.
      (Fx_create_frame, w32_create_tip_frame): Drop two last arguments
      in gui_figure_window_size call.  Do not SET_FRAME_WIDTH and
      SET_FRAME_HEIGHT (or SET_FRAME_COLS and SET_FRAME_LINES), the
      adjust_frame_size in gui_figure_window_size did that already.
      * src/w32inevt.c (resize_event, maybe_generate_resize_event):
      Pass native sizes to change_frame_size.
      * src/w32term.c (w32_read_socket): When WM_WINDOWPOSCHANGED pass
      native sizes to change_frame_size.
      (w32_new_font): Recalculate FRAME_TAB_BAR_HEIGHT.  Simplify
      code.
      (w32fullscreen_hook): Call change_frame_size with native sizes.
      (w32_set_window_size): Drop argument PIXELWISE and its
      processing; WIDTH and HEIGHT are native sizes now.  Remove
      frame_size_history_add calls.  Pass native sizes to
      change_frame_size.
      * src/widget.c (set_frame_size): Set width and height of widget
      directly.  Call frame_size_history_plain instead of
      frame_size_history_add.
      (update_from_various_frame_slots): Call
      frame_size_history_extra.
      (EmacsFrameRealize): Call frame_size_history_plain.
      (EmacsFrameResize): Call change_frame_size with native sizes.
      Call frame_size_history_extra instead of frame_size_history_add.
      (EmacsFrameSetCharSize): Call frame_size_history_extra.  Drop
      PIXELWISE argument in x_set_window_size call and specify pixels.
      (pixel_to_text_size): Remove function.
      * src/xdisp.c (resize_mini_window): Replace FRAME_WINDOWS_HEIGHT
      with FRAME_INNER_HEIGHT.
      (redisplay_tab_bar): Don't set tab_bar_redisplayed when we did
      not redisplay it.
      (redisplay_tool_bar): Don't call it for external tool bar.
      Don't set tool_bar_redisplayed when we did not redisplay it.
      (redisplay_window): When the tool bar is external call
      update_frame_tool_bar directly.
      * src/xfns.c (x_set_menu_bar_lines): Call adjust_frame_size only
      if number of menu bar lines changed and fix 6th argument.
      (x_change_tab_bar_height, x_change_tool_bar_height): Fix
      handling of these in the initial phase before they have been
      resized at least once.
      (Fx_create_frame, x_create_tip_frame): Drop two last arguments
      in gui_figure_window_size call.  Do not SET_FRAME_WIDTH and
      SET_FRAME_HEIGHT (or SET_FRAME_COLS and SET_FRAME_LINES), the
      adjust_frame_size in gui_figure_window_size did that already.
      * src/xmenu.c (update_frame_menubar): Fix 6th arg of
      adjust_frame_size call.
      (free_frame_menubar): For Motif frames fix fullscreen and
      `frame-inhibit-implied-resize' handling.  Fix 6th arg of
      adjust_frame_size calls.
      * src/xterm.c (x_net_wm_state): Remove call to
      frame_size_history_add.
      (handle_one_xevent): For PropertyNotify and UnmapNotify events
      add frame_size_history_plain calls.  For MapNotify and
      ConfigureNotify events add a frame_size_history_extra call.  For
      ConfigureNotify events also handle delayed size changes and call
      change_frame_size with native sizes.
      (x_new_font): Recalculate FRAME_TAB_BAR_HEIGHT.  Simplify code.
      (x_handle_net_wm_state): Remove frame_size_history_add call.
      (x_check_fullscreen): Remove frame_size_history_add call.  Call
      change_frame_size with native height.
      (x_set_window_size_1): WIDTH and HEIGHT are now native.  Remove
      some frame_size_history_add calls and add frame_size_history_extra
      calls instead.  If the frame is not visible call adjust_frame_size
      directly instead of calling change_frame_size.
      (x_set_window_size): Drop PIXELWISE argument.  WIDTH and HEIGHT
      represent native sizes now.
      (x_make_frame_visible, x_make_frame_invisible): Call
      frame_size_history_plain.
      * src/xterm.h (x_set_window_size): Drop last argument from
      extern declaration.
      a190b4cf
    • Lars Ingebrigtsen's avatar
      Fix compilation warnings in non-toolkit builds · 8f52c5da
      Lars Ingebrigtsen authored
      * src/xterm.c (x_create_toolkit_scroll_bar)
      (x_create_horizontal_toolkit_scroll_bar): String constants for
      XtSetArg are defined as const strings (in
      /usr/include/X11/Xaw3d/ThreeD.h, for instance), but the argument
      in XtSetArg is defined as either a const char* or a regular char*
      in /usr/include/X11/Intrinsic.h.  Cast the argument to String
      (which should be correct on all platforms, hopefully) to avoid a
      compilation warning (bug#47452).
      8f52c5da