Skip to content
Snippets Groups Projects
Commit 1de1d68c authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add Alt+Home to centre window on screen

Works in SDL mode and X11 mode with an appropriate Window Manager
(I was going to use center window gravity, but since my WM doesn't
support that, I just assume that all the good ones dont).

Not tested in Win32-GDI mode, but should likely work I suppose.
parent 1cce9144
No related branches found
No related tags found
No related merge requests found
Pipeline #8054 failed
...@@ -190,18 +190,20 @@ program to create exactly the desired mode. ...@@ -190,18 +190,20 @@ program to create exactly the desired mode.
== Fonts == Fonts
There are a large number of built in fonts that ciolib supports. Most There are a large number of built in fonts that ciolib supports. Most
are codepage fonts, but there is also Commodore, Atari, and Amiga fonts are codepage fonts, but there is also Commodore, Atari, Amiga, and "Prestel"
included in the default set. Not all builtin fonts are available in (SAA5050 as used in BBC Micro Model 7 and others) fonts included in the
every size. The following table summarizes the available fonts. default set. Not all builtin fonts are available in every size. The
following table summarizes the available fonts.
[%autowidth,cols="1,^2,^3,^4,5"] [%autowidth,cols="1,^2,^3,^4,^5,6"]
|=== |===
|Name |8x16 |8x12 |8x8 |Character Set |Name |8x16 |8x12 |8x8 |12x20| Character Set
|Codepage 437 English |Codepage 437 English
|√ |√
|√ |√
|√ |√
|√
|CP437 |CP437
|Codepage 1251 Cyrillic, (swiss) |Codepage 1251 Cyrillic, (swiss)
...@@ -214,251 +216,293 @@ every size. The following table summarizes the available fonts. ...@@ -214,251 +216,293 @@ every size. The following table summarizes the available fonts.
|√ |√
|√ |√
|√ |√
|
|KOI8_R |KOI8_R
|ISO-8859-2 Central European |ISO-8859-2 Central European
|√ |√
|√ |√
|√ |√
|
|ISO_8859_2 |ISO_8859_2
|ISO-8859-4 Baltic wide (VGA 9bit mapped) |ISO-8859-4 Baltic wide (VGA 9bit mapped)
|√ |√
| |
| |
|
|ISO_8859_4 |ISO_8859_4
|Codepage 866 (c) Russian |Codepage 866 (c) Russian
|√ |√
| |
| |
|
|CP866M |CP866M
|ISO-8859-9 Turkish |ISO-8859-9 Turkish
|√ |√
| |
| |
|
|ISO_8859_9 |ISO_8859_9
|haik8 codepage (use only with armscii8 screenmap) |haik8 codepage (use only with armscii8 screenmap)
|√ |√
|√ |√
|√ |√
|
|HAIK8 |HAIK8
|ISO-8859-8 Hebrew |ISO-8859-8 Hebrew
|√ |√
|√ |√
|√ |√
|
|ISO_8859_8 |ISO_8859_8
|Ukrainian font koi8-u |Ukrainian font koi8-u
|√ |√
|√ |√
|√ |√
|
|KOI8_U |KOI8_U
|ISO-8859-15 West European, (thin) |ISO-8859-15 West European, (thin)
|√ |√
| |
| |
|
|ISO_8859_15 |ISO_8859_15
|ISO-8859-4 Baltic (VGA 9bit mapped) |ISO-8859-4 Baltic (VGA 9bit mapped)
|√ |√
|√ |√
|√ |√
|
|ISO_8859_4 |ISO_8859_4
|Russian koi8-r (b) |Russian koi8-r (b)
|√ |√
| |
| |
|
|KOI8_R |KOI8_R
|ISO-8859-4 Baltic wide |ISO-8859-4 Baltic wide
|√ |√
| |
| |
|
|ISO_8859_4 |ISO_8859_4
|ISO-8859-5 Cyrillic |ISO-8859-5 Cyrillic
|√ |√
|√ |√
|√ |√
|
|ISO_8859_5 |ISO_8859_5
|ARMSCII-8 Character set |ARMSCII-8 Character set
|√ |√
|√ |√
|√ |√
|
|ARMSCII8 |ARMSCII8
|ISO-8859-15 West European |ISO-8859-15 West European
|√ |√
|√ |√
|√ |√
|
|ISO_8859_15 |ISO_8859_15
|Codepage 850 Multilingual Latin I, (thin) |Codepage 850 Multilingual Latin I, (thin)
|√ |√
| |
|√ |√
|
|CP850 |CP850
|Codepage 850 Multilingual Latin I |Codepage 850 Multilingual Latin I
|√ |√
|√ |√
|√ |√
|
|CP850 |CP850
|Codepage 865 Norwegian, (thin) |Codepage 865 Norwegian, (thin)
|√ |√
| |
|√ |√
|
|CP865 |CP865
|Codepage 1251 Cyrillic |Codepage 1251 Cyrillic
|√ |√
|√ |√
|√ |√
|
|CP1251 |CP1251
|ISO-8859-7 Greek |ISO-8859-7 Greek
|√ |√
|√ |√
|√ |√
|
|ISO_8859_7 |ISO_8859_7
|Russian koi8-r (c) |Russian koi8-r (c)
|√ |√
| |
| |
|
|KOI8_R |KOI8_R
|ISO-8859-4 Baltic |ISO-8859-4 Baltic
|√ |√
|√ |√
|√ |√
|
|ISO_8859_4 |ISO_8859_4
|ISO-8859-1 West European |ISO-8859-1 West European
|√ |√
|√ |√
|√ |√
|
|ISO_8859_1 |ISO_8859_1
|Codepage 866 Russian |Codepage 866 Russian
|√ |√
|√ |√
|√ |√
|
|CP866M2 |CP866M2
|Codepage 437 English, (thin) |Codepage 437 English, (thin)
|√ |√
| |
|√ |√
|
|CP437 |CP437
|Codepage 866 (b) Russian |Codepage 866 (b) Russian
|√ |√
| |
| |
|
|CP866M2 |CP866M2
|Codepage 865 Norwegian |Codepage 865 Norwegian
|√ |√
|√ |√
|√ |√
|
|CP865 |CP865
|Ukrainian font cp866u |Ukrainian font cp866u
|√ |√
|√ |√
|√ |√
|
|CP866U |CP866U
|ISO-8859-1 West European, (thin) |ISO-8859-1 West European, (thin)
|√ |√
| |
| |
|
|ISO_8859_1 |ISO_8859_1
|Codepage 1131 Belarusian, (swiss) |Codepage 1131 Belarusian, (swiss)
|√ |√
| |
| |
|
|CP1131 |CP1131
|Commodore 64 (UPPER) |Commodore 64 (UPPER)
|√ |√
| |
|√ |√
|
|PETSCIIU |PETSCIIU
|Commodore 64 (Lower) |Commodore 64 (Lower)
|√ |√
| |
|√ |√
|
|PETSCIIL |PETSCIIL
|Commodore 128 (UPPER) |Commodore 128 (UPPER)
|√ |√
| |
|√ |√
|
|PETSCIIU |PETSCIIU
|Commodore 128 (Lower) |Commodore 128 (Lower)
|√ |√
| |
|√ |√
|
|PETSCIIL |PETSCIIL
|Atari |Atari
|√ |√
| |
|√ |√
|
|ATASCII |ATASCII
|P0T NOoDLE (Amiga) |P0T NOoDLE (Amiga)
|√ |√
|√ |√
| |
|
|ISO_8859_1 |ISO_8859_1
|mO'sOul (Amiga) |mO'sOul (Amiga)
|√ |√
| |
|√ |√
|
|ISO_8859_1 |ISO_8859_1
|MicroKnight Plus (Amiga) |MicroKnight Plus (Amiga)
|√ |√
| |
| |
|
|ISO_8859_1 |ISO_8859_1
|Topaz Plus (Amiga) |Topaz Plus (Amiga)
|√ |√
| |
| |
|
|ISO_8859_1 |ISO_8859_1
|MicroKnight (Amiga) |MicroKnight (Amiga)
|√ |√
| |
|√ |√
|
|ISO_8859_1 |ISO_8859_1
|Topaz (Amiga) |Topaz (Amiga)
|√ |√
|√ |√
| |
|
|ISO_8859_1 |ISO_8859_1
|Prestel |Prestel
|√ |√
| |
| |
|√
|ISO_8859_1 |ISO_8859_1
|=== |===
...@@ -751,6 +751,11 @@ static void sdl_add_key(unsigned int keyval, struct video_stats *vs) ...@@ -751,6 +751,11 @@ static void sdl_add_key(unsigned int keyval, struct video_stats *vs)
if (keyval == 0xe0) if (keyval == 0xe0)
keyval = CIO_KEY_LITERAL_E0; keyval = CIO_KEY_LITERAL_E0;
if (keyval == 0x9700) { // Alt-Home, centre screen
assert_pthread_mutex_lock(&win_mutex);
sdl.SetWindowPosition(win, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
assert_pthread_mutex_unlock(&win_mutex);
}
if(keyval==0xa600 && vs != NULL) { if(keyval==0xa600 && vs != NULL) {
assert_pthread_mutex_lock(&win_mutex); assert_pthread_mutex_lock(&win_mutex);
fullscreen = !(sdl.GetWindowFlags(win) & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)); fullscreen = !(sdl.GetWindowFlags(win) & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP));
......
...@@ -925,6 +925,15 @@ magic_message(MSG msg) ...@@ -925,6 +925,15 @@ magic_message(MSG msg)
PostMessageW(win, WM_USER_SETPOS, window_left, window_top); PostMessageW(win, WM_USER_SETPOS, window_left, window_top);
} }
} }
else if (k->VirtualKeyCode == VK_HOME) {
// Centre window
// Now make the inside of the window the size we want (sigh)
LONG w, h;
int mw, mh, xpos, ypos;
gdi_get_windowsize_at_dpi(false, &w, &h, 0);
if (get_monitor_size_pos(&mw, &mh, &xpos, &ypos))
SetWindowPos(win, NULL, xpos + ((mw - w) / 2), ypos + ((mh - h) / 2), 0, 0, SWP_NOOWNERZORDER|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE);
}
if (k->ALT == 0x6b00) { // ALT-F4 if (k->ALT == 0x6b00) { // ALT-F4
gdi_add_key(CIO_KEY_QUIT); gdi_add_key(CIO_KEY_QUIT);
} }
......
...@@ -2144,6 +2144,16 @@ x11_event(XEvent *ev) ...@@ -2144,6 +2144,16 @@ x11_event(XEvent *ev)
nlock = 1; nlock = 1;
case XK_Home: case XK_Home:
case XK_KP_Home: case XK_KP_Home:
// ALT-Home, centre window
if (ev->xkey.state & Mod1Mask) {
int x_org, y_org, w, h;
if (fullscreen_geometry(&x_org, &y_org, &w, &h)) {
int l, r, t, b;
if (get_frame_extents(&l, &r, &t, &b)) {
x11.XMoveWindow(dpy, win, x_org + ((w - vstat.winwidth + l + r) / 2), y_org + ((h - vstat.winheight + t + b) / 2));
}
}
}
scan = 71; scan = 71;
goto docode; goto docode;
......
...@@ -5,6 +5,7 @@ Use the SAA5050 font for Prestel mode ...@@ -5,6 +5,7 @@ Use the SAA5050 font for Prestel mode
Prestel mode is 25 rows, not 24 Prestel mode is 25 rows, not 24
Add setting to invert mouse wheel Add setting to invert mouse wheel
Support web-based dialing directories Support web-based dialing directories
Alt+Home now centres the window on the screen
Version 1.5a Version 1.5a
------------ ------------
......
...@@ -236,6 +236,12 @@ Keyboard Controls:: ...@@ -236,6 +236,12 @@ Keyboard Controls::
Snap the window size to the next larger smaller integer zoom Snap the window size to the next larger smaller integer zoom
level level
kbd:[Alt+Return]:::
Toggle fullscreen mode
kbd:[Alt+Home]:::
Centre window on the screen
In addition, you can directly enter characters either by their "codepage" In addition, you can directly enter characters either by their "codepage"
value or their unicode value. A "codepage" value is an 8-bit value that value or their unicode value. A "codepage" value is an 8-bit value that
indicates a character in the current codepage (such as the default CP437). indicates a character in the current codepage (such as the default CP437).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment