]> git.eshelyaron.com Git - emacs.git/commitdiff
New variable haiku-pass-control-tab-to-system
authorTor-björn Claesson <tclaesson@gmail.com>
Wed, 3 Apr 2024 07:25:59 +0000 (10:25 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 4 Apr 2024 11:40:22 +0000 (13:40 +0200)
Allow passing C-TAB on to the Haiku operating system, fixing
window switching when an Emacs frame has focus (Bug#70138).
* src/haiku_support.cc (DispatchMessage): Conditionally pass
message to BWindow.
* src/haiku_support.h:
* src/haikufns.c (haiku_should_pass_control_tab_to_system): Add
variable haiku-pass-control-tab-to-system, and C function
haiku_should_pass_control_tab_to_system.

Co-authored-by: Po Lu <luangruo@yahoo.com>
Copyright-paperwork-exempt: yes
(cherry picked from commit ba3bf69f84e5c1143a6ff3b1e7031a10e0beed89)

etc/NEWS
src/haiku_support.cc
src/haiku_support.h
src/haikufns.c

index b75970474382ee68ea8c784cea1534b575c44a3e..ae9cd337c768122670402bbc9070f4d1aa46a369 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2054,6 +2054,11 @@ The new function 'haiku-notifications-notify' provides a subset of the
 capabilities of the 'notifications-notify' function in a manner
 analogous to 'w32-notification-notify'.
 
+** New variable 'haiku-pass-control-tab-to-system'.
+This sets whether Emacs should pass C-TAB on to the system instead of
+handling it, fixing a problem where window switching would not activate
+if an Emacs frame had focus on the Haiku operation system.
+
 +++
 ** New value 'if-regular' for the REPLACE argument to 'insert-file-contents'.
 It results in 'insert-file-contents' erasing the buffer instead of
index 1b9c5acdf1487c194666a85e4a570ce0f64ff433..08e7f29685afdf5d8687e53fd38e3269dfa3e3b2 100644 (file)
@@ -1063,6 +1063,13 @@ public:
 
        uint32_t mods = modifiers ();
 
+        if (haiku_should_pass_control_tab_to_system ()
+            && (mods & B_CONTROL_KEY) && key == 38)
+        {
+          BWindow::DispatchMessage (msg, handler);
+          return;
+        }
+
        if (mods & B_SHIFT_KEY)
          rq.modifiers |= HAIKU_MODIFIER_SHIFT;
 
index e9ac7005d75087bcc62f381a56e201345574de50..6c0e5fa7acd84edcc1e40702eca59b35eefb0488 100644 (file)
@@ -691,6 +691,8 @@ extern int be_get_display_color_cells (void);
 extern bool be_is_display_grayscale (void);
 extern void be_warp_pointer (int, int);
 
+extern bool haiku_should_pass_control_tab_to_system (void);
+
 extern void EmacsView_set_up_double_buffering (void *);
 extern void EmacsView_disable_double_buffering (void *);
 extern void EmacsView_flip_and_blit (void *);
index 173c1e369df80135bbe4268cfe112a095d2e872e..9b50099d6ac6e4721e27460229b1b8194233cbb0 100644 (file)
@@ -2194,6 +2194,12 @@ haiku_set_use_frame_synchronization (struct frame *f, Lisp_Object arg,
   be_set_use_frame_synchronization (FRAME_HAIKU_VIEW (f), !NILP (arg));
 }
 
+bool
+haiku_should_pass_control_tab_to_system (void)
+{
+  return haiku_pass_control_tab_to_system;
+}
+
 \f
 
 DEFUN ("haiku-set-mouse-absolute-pixel-position",
@@ -3302,6 +3308,14 @@ syms_of_haikufns (void)
               doc: /* SKIP: real doc in xfns.c.  */);
   Vx_sensitive_text_pointer_shape = Qnil;
 
+  DEFVAR_BOOL ("haiku-pass-control-tab-to-system",
+             haiku_pass_control_tab_to_system,
+             doc: /* Whether or not to pass C-TAB to the system.
+Setting this variable will cause Emacs to pass C-TAB to the system
+(allowing window switching on the Haiku operating system), rather than
+intercepting it.  */);
+  haiku_pass_control_tab_to_system = true;
+
   DEFVAR_LISP ("haiku-allowed-ui-colors", Vhaiku_allowed_ui_colors,
               doc: /* Vector of UI colors that Emacs can look up from the system.
 If this is set up incorrectly, Emacs can crash when encountering an