Skip to content

Commit cd9d304

Browse files
rymdbarchrisbra
authored andcommitted
patch 9.1.1743: Haiku: no full-screen support
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 6d68508 commit cd9d304

5 files changed

Lines changed: 61 additions & 7 deletions

File tree

runtime/doc/os_haiku.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*os_haiku.txt* For Vim version 9.1. Last change: 2020 May 13
1+
*os_haiku.txt* For Vim version 9.1. Last change: 2025 Sep 08
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -76,6 +76,9 @@ version with GUI tries to determine if it was started from the Tracker instead
7676
of the Terminal, and if so, uses the GUI anyway. However, the current detection
7777
scheme is fooled if you use the command "vim - </dev/null".
7878

79+
Toggling between normal managed window and fullscreen mode can be done by
80+
pressing <Alt-Enter>.
81+
7982
Stuff that does not work yet:
8083

8184
- Mouse up events are not generated when outside the window. You can notice
@@ -86,7 +89,9 @@ Stuff that does not work yet:
8689
in when the window is activated or deactivated (so it works best with focus-
8790
follows-mouse turned on).
8891
- The cursor does not flash.
89-
92+
- Switching windows using <C-Tab-Up> and <C-Tab-Down> in Twitcher does not
93+
work. This is due to each gvim window being managed by a separate instance
94+
completely unaware of other vim processes.
9095

9196
4. The $VIM directory *haiku-vimdir*
9297

runtime/doc/version9.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*version9.txt* For Vim version 9.1. Last change: 2025 Sep 02
1+
*version9.txt* For Vim version 9.1. Last change: 2025 Sep 08
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41619,6 +41619,8 @@ Platform specific~
4161941619
- Python3 support in OpenVMS is now available.
4162041620

4162141621
- The Win32 GUI comes with better toolbar icons.
41622+
41623+
- Better fullscreen support for Haiku |os_haiku.txt|.
4162241624
*new-other-9.2*
4162341625
Other new features ~
4162441626
------------------

runtime/doc/vi_diff.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vi_diff.txt* For Vim version 9.1. Last change: 2025 Sep 04
1+
*vi_diff.txt* For Vim version 9.1. Last change: 2025 Sep 08
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1379,13 +1379,13 @@ support is verified as part of the CI test suite.
13791379
System | Status:~
13801380
--------------------------------+-----------------------------------------
13811381
Amiga (OS4, AROS & MorphOS): | still supported (?)
1382-
Haiku: | still supported (?)
1382+
Haiku: | supported
13831383
Linux: | fully supported (on maintained versions)
13841384
Mac OS: | fully supported up until v10.6 (?)
13851385
MS-Windows 7, 8, 10, 11: | fully supported
1386-
UNIX: | supported (on maintained versions)
13871386
OpenVMS: | supported
13881387
QNX: | still supported (?)
1388+
UNIX: | supported (on maintained versions)
13891389
zOS/OS390: | still supported (?)
13901390

13911391
The following operating systems are no longer supported:

src/gui_haiku.cc

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class VimWindow: public BWindow
175175
VimWindow();
176176
~VimWindow();
177177

178-
// virtual void DispatchMessage(BMessage *m, BHandler *h);
178+
virtual void DispatchMessage(BMessage *m, BHandler *h);
179179
virtual void WindowActivated(bool active);
180180
virtual bool QuitRequested();
181181

@@ -184,6 +184,9 @@ class VimWindow: public BWindow
184184
private:
185185
void init();
186186

187+
bool is_fullscreen = false;
188+
BRect saved_frame;
189+
window_look saved_look;
187190
};
188191

189192
class VimFormView: public BView
@@ -971,6 +974,48 @@ VimWindow::QuitRequested()
971974
write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km));
972975
return false;
973976
}
977+
void
978+
VimWindow::DispatchMessage(BMessage *m, BHandler *h)
979+
{
980+
bool should_propagate = true;
981+
982+
switch (m->what)
983+
{
984+
case B_KEY_DOWN:
985+
{
986+
int32 scancode = 0;
987+
int32 beModifiers = 0;
988+
m->FindInt32("raw_char", &scancode);
989+
m->FindInt32("modifiers", &beModifiers);
990+
991+
if (scancode == B_ENTER && (beModifiers & B_LEFT_COMMAND_KEY))
992+
{
993+
should_propagate = false;
994+
if (this->is_fullscreen)
995+
{
996+
this->is_fullscreen = false;
997+
ResizeTo(this->saved_frame.Width(), this->saved_frame.Height());
998+
MoveTo(this->saved_frame.left, this->saved_frame.top);
999+
SetLook(this->saved_look);
1000+
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
1001+
} else {
1002+
this->saved_frame = Frame();
1003+
this->saved_look = Look();
1004+
this->is_fullscreen = true;
1005+
BScreen s(this);
1006+
SetLook(B_NO_BORDER_WINDOW_LOOK);
1007+
ResizeTo(s.Frame().Width() + 1, s.Frame().Height() + 1);
1008+
MoveTo(s.Frame().left, s.Frame().top);
1009+
SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE));
1010+
}
1011+
}
1012+
}
1013+
}
1014+
1015+
if (should_propagate)
1016+
Inherited::DispatchMessage(m, h);
1017+
}
1018+
9741019

9751020
// ---------------- VimFormView ----------------
9761021

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ static char *(features[]) =
724724

725725
static int included_patches[] =
726726
{ /* Add new patch number below this line */
727+
/**/
728+
1743,
727729
/**/
728730
1742,
729731
/**/

0 commit comments

Comments
 (0)