mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
Merge branch 'experimental' into 'experimental'
Option-Command Menu shortcuts This adds an option modifier to all the SDL menu keyboard shortcuts (Command-Q to quit becomes Option+Command-Q). See merge request !9
This commit is contained in:
commit
15e37c5de2
26
src/fix_mac_menu.m
Normal file
26
src/fix_mac_menu.m
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
void fix_mac_menu(void) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* add an option-key modifier to all menu shortcuts
|
||||||
|
* eg, command-Q -> option+command-Q
|
||||||
|
*/
|
||||||
|
|
||||||
|
@autoreleasepool {
|
||||||
|
if (NSApp) {
|
||||||
|
NSMenu *menu = [NSApp mainMenu];
|
||||||
|
|
||||||
|
for (NSMenuItem *a in [menu itemArray]) {
|
||||||
|
for (NSMenuItem *b in [[a submenu] itemArray]) {
|
||||||
|
unsigned m = [b keyEquivalentModifierMask];
|
||||||
|
if (m & NSEventModifierFlagCommand)
|
||||||
|
[b setKeyEquivalentModifierMask: m | NSEventModifierFlagOption];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -288,6 +288,11 @@ void do_icon() {
|
|||||||
void dev_video_init_sdl() {
|
void dev_video_init_sdl() {
|
||||||
SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2
|
SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2
|
||||||
|
|
||||||
|
#if defined __APPLE__
|
||||||
|
extern void fix_mac_menu();
|
||||||
|
fix_mac_menu();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create an application window with the following settings:
|
// Create an application window with the following settings:
|
||||||
char window_title[32];
|
char window_title[32];
|
||||||
sprintf(window_title, "GSplus v%-6s", g_gsplus_version_str),
|
sprintf(window_title, "GSplus v%-6s", g_gsplus_version_str),
|
||||||
@ -439,19 +444,11 @@ void check_input_events_sdl() {
|
|||||||
motion |= handle_sdl_mouse_motion_event(event);
|
motion |= handle_sdl_mouse_motion_event(event);
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
{
|
|
||||||
const Uint8 *state = SDL_GetKeyboardState(NULL);
|
|
||||||
if (state[SDL_SCANCODE_Q]) {
|
|
||||||
glog("Skipping keyboard quit event. Not allowed.");
|
|
||||||
} else {
|
|
||||||
//quit = 1; /* SDL_QUIT event (window close) */
|
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
iwm_shut();
|
iwm_shut();
|
||||||
// Clean up
|
// Clean up
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
my_exit(1);
|
my_exit(1);
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SDL_DROPFILE:
|
case SDL_DROPFILE:
|
||||||
{
|
{
|
||||||
|
@ -5,17 +5,17 @@ CC = clang
|
|||||||
LD = clang++
|
LD = clang++
|
||||||
AS = cc
|
AS = cc
|
||||||
|
|
||||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) $(FSTOBJ) sdl2_driver.o sdl2snd_driver.o
|
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) $(FSTOBJ) sdl2_driver.o sdl2snd_driver.o fix_mac_menu.o
|
||||||
ARCHS = ppc, i386, ppc64, x86_64
|
ARCHS = ppc, i386, ppc64, x86_64
|
||||||
|
|
||||||
# OPTIONS FOR COMPILING C SOURCE
|
# OPTIONS FOR COMPILING C SOURCE
|
||||||
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_ICON -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2
|
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_ICON -DHAVE_SDL -DTOGGLE_STATUS `sdl2-config --cflags`
|
||||||
# OPTIONS FOR COMPILING C++ SOURCE
|
# OPTIONS FOR COMPILING C++ SOURCE
|
||||||
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2
|
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS `freetype-config --cflags` `sdl2-config --cflags`
|
||||||
|
|
||||||
EXTRA_LIBS = -lSDL2 -lSDL2_image -lfreetype
|
EXTRA_LIBS = -lSDL2_image
|
||||||
OPTS = -DGSPLUS_LITTLE_ENDIAN -g
|
OPTS = -DGSPLUS_LITTLE_ENDIAN -g
|
||||||
SUFFIX =
|
SUFFIX =
|
||||||
LDFLAGS = `sdl2-config --static-libs` -L/usr/local/lib
|
LDFLAGS = `sdl2-config --static-libs` `freetype-config --libs` -framework Cocoa
|
||||||
LDOPTS = -I.
|
LDOPTS =
|
||||||
EXTRA_SPECIALS =
|
EXTRA_SPECIALS =
|
||||||
|
Loading…
Reference in New Issue
Block a user