mirror of
https://github.com/vim/vim.git
synced 2025-10-21 08:24:06 -04:00
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 <rymdbar@x20.se> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
6d68508e62
commit
cd9d30486a
@@ -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 ----------------
|
||||
|
||||
|
@@ -724,6 +724,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1743,
|
||||
/**/
|
||||
1742,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user