all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70138: Do not intercept C-TAB on Haiku OS
@ 2024-04-02  6:33 Tor-björn Claesson
  2024-04-02 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Tor-björn Claesson @ 2024-04-02  6:33 UTC (permalink / raw)
  To: 70138


[-- Attachment #1.1: Type: text/plain, Size: 467 bytes --]

Hello!

On Haiku, C-TAB switches between application windows. Emacs unfortunately
intercepts this keystroke, breaking window switching.

This patch makes Emacs instead pass C-TAB to Haiku, while introducing the
variable haiku-pass-control-tab-to-system, allowing the current behaviour.

I would be grateful for feedback on this patch, and am willing to work on
it until it is ok. If necessary, I'm happy to assign copyright.

Cheers,
Tor-björn Claesson

[-- Attachment #1.2: Type: text/html, Size: 618 bytes --]

[-- Attachment #2: 0001-Add-haiku-pass-control-tab-to-system.patch --]
[-- Type: application/x-patch, Size: 2723 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-02  6:33 bug#70138: Do not intercept C-TAB on Haiku OS Tor-björn Claesson
@ 2024-04-02 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-02 15:07   ` Eli Zaretskii
  2024-04-03  8:48   ` Tor-björn Claesson
  0 siblings, 2 replies; 8+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-02 13:00 UTC (permalink / raw)
  To: Tor-björn Claesson; +Cc: Eli Zaretskii, 70138

Tor-björn Claesson <tclaesson@gmail.com> writes:

> Hello! 
>
> On Haiku, C-TAB switches between application windows. Emacs
> unfortunately intercepts this keystroke, breaking window switching.
>
> This patch makes Emacs instead pass C-TAB to Haiku, while introducing
> the variable haiku-pass-control-tab-to-system, allowing the current
> behaviour.
>
> I would be grateful for feedback on this patch, and am willing to work
> on it until it is ok. If necessary, I'm happy to assign copyright.

Thanks.  Please insert an entry in etc/NEWS documenting this change, and
format the code consistently with its surroundings, thus:

> +	if (haiku_should_pass_control_tab_to_system() &&
> +	    mods & B_CONTROL_KEY && key == 38) {
> +	  BWindow::DispatchMessage (msg, handler);
> +	  return;
> +	}

  if (haiku_should_pass_control_tab_to_system ()
      && (mods & B_CONTROL_KEY) && key == 38)
    {
      BWindow::DispatchMessage (msg, handler);
      return;
    }

> +bool
> +haiku_should_pass_control_tab_to_system (void) {
> +  return haiku_pass_control_tab_to_system;
> +}

Please position the opening brace of this defun on its own line.


> +  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.
> +		       Settings this variable will cause Emacs to pass C-TAB to the system (allowing window switching on Haiku), rather than intercepting it for use in Emacs."  */);
> +  haiku_pass_control_tab_to_system = true;

Please move the second paragraph of the doc string to column zero and
fill it with M-q.

Last but not least, please write ChangeLog entries for the commit
message as specified in our CONTRIBUTE document.  I'm willing to write
them on your behalf, as a first time contributor, but it would better
acquaint you with our practices to apply yourself to the task.

Thanks.

Eli, will we require copyright assignment for this change?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-02 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-02 15:07   ` Eli Zaretskii
  2024-04-03  8:48   ` Tor-björn Claesson
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-04-02 15:07 UTC (permalink / raw)
  To: Po Lu; +Cc: 70138, tclaesson

> From: Po Lu <luangruo@yahoo.com>
> Cc: 70138@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> Date: Tue, 02 Apr 2024 21:00:58 +0800
> 
> Eli, will we require copyright assignment for this change?

No, it's small enough to not require copyright assignment.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-02 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-02 15:07   ` Eli Zaretskii
@ 2024-04-03  8:48   ` Tor-björn Claesson
  2024-04-03 13:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 8+ messages in thread
From: Tor-björn Claesson @ 2024-04-03  8:48 UTC (permalink / raw)
  To: Po Lu; +Cc: 70138

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

Hi!

Thanks for the feedback!

I have updated the patch and commit message, and am happy to fix it
further if needed.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-variable-haiku-pass-control-tab-to-system.patch --]
[-- Type: text/x-diff, Size: 3824 bytes --]

From 3007bb534c36deacbbc667b9eb2989cadde16270 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor-bj=C3=B6rn=20Claesson?= <tclaesson@gmail.com>
Date: Wed, 3 Apr 2024 10:25:59 +0300
Subject: [PATCH] New variable haiku-pass-control-tab-to-system

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
---
 etc/NEWS             |  5 +++++
 src/haiku_support.cc |  7 +++++++
 src/haiku_support.h  |  2 ++
 src/haikufns.c       | 14 ++++++++++++++
 4 files changed, 28 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 2654d9d7995..32cec82f970 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1916,6 +1916,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
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 1b9c5acdf14..a87ba0a08e3 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1063,6 +1063,13 @@ class EmacsWindow : public BWindow
 
 	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;
 
diff --git a/src/haiku_support.h b/src/haiku_support.h
index e9ac7005d75..6c0e5fa7acd 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -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 *);
diff --git a/src/haikufns.c b/src/haikufns.c
index 173c1e369df..00293194a41 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -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
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 32 bytes --]


Cheers,
Tor-björn Claesson

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-03  8:48   ` Tor-björn Claesson
@ 2024-04-03 13:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-03 15:25       ` Tor-björn Claesson
  0 siblings, 1 reply; 8+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-03 13:47 UTC (permalink / raw)
  To: Tor-björn Claesson; +Cc: 70138

Tor-björn Claesson <tclaesson@gmail.com> writes:

> Hi!
>
> Thanks for the feedback!
>
> I have updated the patch and commit message, and am happy to fix it
> further if needed.

Thanks.  Three minor (or perhaps trifling) issues:

> Allow passing C-TAB on to the Haiku operating system, fixing window
> switching when  an Emacs frame has focus (Bug#70138).
                --

Duplicate whitespace.

> * 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.

C should be capitalized, as should the first word in each sentence.
Please also fill the message to 64 columns; in a vc-log buffer, simply
typing M-q should suffice.

> +  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.*/);
                  -

Missing whitespace.  Otherwise, you're good to go.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-03 13:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-03 15:25       ` Tor-björn Claesson
  2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 8+ messages in thread
From: Tor-björn Claesson @ 2024-04-03 15:25 UTC (permalink / raw)
  To: Po Lu; +Cc: 70138

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]

Hi!

Thanks, well spotted!

Here is a new version of the patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-variable-haiku-pass-control-tab-to-system-rev2.patch --]
[-- Type: text/x-diff, Size: 3826 bytes --]

From 7ae1155360c1c8807809c7427b96192535627811 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor-bj=C3=B6rn=20Claesson?= <tclaesson@gmail.com>
Date: Wed, 3 Apr 2024 10:25:59 +0300
Subject: [PATCH] New variable haiku-pass-control-tab-to-system

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
---
 etc/NEWS             |  5 +++++
 src/haiku_support.cc |  7 +++++++
 src/haiku_support.h  |  2 ++
 src/haikufns.c       | 14 ++++++++++++++
 4 files changed, 28 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 2654d9d7995..32cec82f970 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1916,6 +1916,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
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 1b9c5acdf14..a87ba0a08e3 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1063,6 +1063,13 @@ class EmacsWindow : public BWindow
 
 	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;
 
diff --git a/src/haiku_support.h b/src/haiku_support.h
index e9ac7005d75..6c0e5fa7acd 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -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 *);
diff --git a/src/haikufns.c b/src/haikufns.c
index 173c1e369df..a9bfa5b61e1 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -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
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 1503 bytes --]


Thank you very much for helping me fix this=)

Cheers,
Tor-björn

Po Lu <luangruo@yahoo.com> writes:

> Tor-björn Claesson <tclaesson@gmail.com> writes:
>
>> Hi!
>>
>> Thanks for the feedback!
>>
>> I have updated the patch and commit message, and am happy to fix it
>> further if needed.
>
> Thanks.  Three minor (or perhaps trifling) issues:
>
>> Allow passing C-TAB on to the Haiku operating system, fixing window
>> switching when  an Emacs frame has focus (Bug#70138).
>                 --
>
> Duplicate whitespace.
>
>> * 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.
>
> C should be capitalized, as should the first word in each sentence.
> Please also fill the message to 64 columns; in a vc-log buffer, simply
> typing M-q should suffice.
>
>> +  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.*/);
>                   -
>
> Missing whitespace.  Otherwise, you're good to go.


-- 
Mvh,
Tor-björn Claesson

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-03 15:25       ` Tor-björn Claesson
@ 2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 8+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-04  0:30 UTC (permalink / raw)
  To: Tor-björn Claesson; +Cc: 70138-done

Tor-björn Claesson <tclaesson@gmail.com> writes:

> Hi!
>
> Thanks, well spotted!
>
> Here is a new version of the patch.

Installed, and closing.  Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70138: Do not intercept C-TAB on Haiku OS
  2024-04-03 15:25       ` Tor-björn Claesson
  2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 8+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-04  0:30 UTC (permalink / raw)
  To: Tor-björn Claesson; +Cc: 70138-done

Tor-björn Claesson <tclaesson@gmail.com> writes:

> Hi!
>
> Thanks, well spotted!
>
> Here is a new version of the patch.

Installed, and closing.  Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-04  0:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02  6:33 bug#70138: Do not intercept C-TAB on Haiku OS Tor-björn Claesson
2024-04-02 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-02 15:07   ` Eli Zaretskii
2024-04-03  8:48   ` Tor-björn Claesson
2024-04-03 13:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-03 15:25       ` Tor-björn Claesson
2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-04  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.