]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1743: Haiku: no full-screen support v9.1.1743
authorrymdbar <rymdbar@x20.se>
Mon, 8 Sep 2025 19:42:25 +0000 (15:42 -0400)
committerChristian Brabandt <cb@256bit.org>
Mon, 8 Sep 2025 19:42:25 +0000 (15:42 -0400)
Problem:  Haiku: no full-screen support
Solution: Add support for toggling full-screen using the keyboard
          (rymdbar)

Makes toggling using keyboard possible. This change does not add any
`:fullscreen` command (Which currently only macVim has).

See https://www.haiku-os.org/docs/userguide/en/keyboard-shortcuts.html
for motivation on key combination used, as well as terminology choice.
With vim being inconsistent (`:help intro` suggests <A> and <M>, while
<Alt> is used at a dozen other places) following Haiku nomenclature
seems most appropriate.

closes: #18235

Signed-off-by: rymdbar <rymdbar@x20.se>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/os_haiku.txt
runtime/doc/version9.txt
runtime/doc/vi_diff.txt
src/gui_haiku.cc
src/version.c

index 8fe8c9f56c378ec2e7788602baa46f1d652a12e0..01785507eee1b976f1051dc6be92e63a9ca50440 100644 (file)
@@ -1,4 +1,4 @@
-*os_haiku.txt* For Vim version 9.1.  Last change: 2020 May 13
+*os_haiku.txt* For Vim version 9.1.  Last change: 2025 Sep 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -76,6 +76,9 @@ version with GUI tries to determine if it was started from the Tracker instead
 of the Terminal, and if so, uses the GUI anyway.  However, the current detection
 scheme is fooled if you use the command "vim - </dev/null".
 
+Toggling between normal managed window and fullscreen mode can be done by
+pressing <Alt-Enter>.
+
 Stuff that does not work yet:
 
 - Mouse up events are not generated when outside the window.  You can notice
@@ -86,7 +89,9 @@ Stuff that does not work yet:
   in when the window is activated or deactivated (so it works best with focus-
   follows-mouse turned on).
 - The cursor does not flash.
-
+- Switching windows using <C-Tab-Up> and <C-Tab-Down> in Twitcher does not
+  work. This is due to each gvim window being managed by a separate instance
+  completely unaware of other vim processes.
 
 4. The $VIM directory                                  *haiku-vimdir*
 
index e7c7183fdf76d146b383cdafd535e30b27a96628..e95405269e5bd61e199d17e07a9234e38d6f1342 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2025 Sep 02
+*version9.txt*  For Vim version 9.1.  Last change: 2025 Sep 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41619,6 +41619,8 @@ Platform specific~
 - Python3 support in OpenVMS is now available.
 
 - The Win32 GUI comes with better toolbar icons.
+
+- Better fullscreen support for Haiku |os_haiku.txt|.
                                                        *new-other-9.2*
 Other new features ~
 ------------------
index 1c5d7245b9efc0bbe2f7a7b6aede87cac90c5dd9..cf977380cc36f7303cd61af9251052a9630ff9e6 100644 (file)
@@ -1,4 +1,4 @@
-*vi_diff.txt*   For Vim version 9.1.  Last change: 2025 Sep 04
+*vi_diff.txt*   For Vim version 9.1.  Last change: 2025 Sep 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1379,13 +1379,13 @@ support is verified as part of the CI test suite.
 System                         | Status:~
 --------------------------------+-----------------------------------------
 Amiga (OS4, AROS & MorphOS):   | still supported (?)
-Haiku:                         | still supported (?)
+Haiku:                         | supported
 Linux:                         | fully supported (on maintained versions)
 Mac OS:                                | fully supported up until v10.6 (?)
 MS-Windows 7, 8, 10, 11:       | fully supported
-UNIX:                          | supported (on maintained versions)
 OpenVMS:                       | supported
 QNX:                           | still supported (?)
+UNIX:                          | supported (on maintained versions)
 zOS/OS390:                     | still supported (?)
 
 The following operating systems are no longer supported:
index 3865a4f4df58cf9786f34d99579b7882707d19b5..5d32607aa4212ae65a2cabd430af70bbb528ca4e 100644 (file)
@@ -175,7 +175,7 @@ class VimWindow: public BWindow
     VimWindow();
     ~VimWindow();
 
-    //   virtual void DispatchMessage(BMessage *m, BHandler *h);
+    virtual void DispatchMessage(BMessage *m, BHandler *h);
     virtual void WindowActivated(bool active);
     virtual bool QuitRequested();
 
@@ -184,6 +184,9 @@ class VimWindow: public BWindow
     private:
     void init();
 
+    bool is_fullscreen = false;
+    BRect saved_frame;
+    window_look saved_look;
 };
 
 class VimFormView: public BView
@@ -971,6 +974,48 @@ VimWindow::QuitRequested()
     write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km));
     return false;
 }
+    void
+VimWindow::DispatchMessage(BMessage *m, BHandler *h)
+{
+    bool should_propagate = true;
+
+    switch (m->what)
+    {
+       case B_KEY_DOWN:
+           {
+               int32 scancode = 0;
+               int32 beModifiers = 0;
+               m->FindInt32("raw_char", &scancode);
+               m->FindInt32("modifiers", &beModifiers);
+
+               if (scancode == B_ENTER && (beModifiers & B_LEFT_COMMAND_KEY))
+                   {
+                       should_propagate = false;
+                       if (this->is_fullscreen)
+                           {
+                               this->is_fullscreen = false;
+                               ResizeTo(this->saved_frame.Width(), this->saved_frame.Height());
+                               MoveTo(this->saved_frame.left, this->saved_frame.top);
+                               SetLook(this->saved_look);
+                               SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
+                           } else {
+                               this->saved_frame = Frame();
+                               this->saved_look = Look();
+                               this->is_fullscreen = true;
+                               BScreen s(this);
+                               SetLook(B_NO_BORDER_WINDOW_LOOK);
+                               ResizeTo(s.Frame().Width() + 1, s.Frame().Height() + 1);
+                               MoveTo(s.Frame().left, s.Frame().top);
+                               SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE));
+                           }
+                   }
+           }
+    }
+
+    if (should_propagate)
+       Inherited::DispatchMessage(m, h);
+}
+
 
 // ---------------- VimFormView ----------------
 
index d6431471efd65f5069c63c3c4224976169b6f8a2..20ee00095b08d193fcc62bf69096370694c910e1 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1743,
 /**/
     1742,
 /**/