projects
/
vg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e3465d5
)
mistake with keymods
author
hgn
<hgodden00@gmail.com>
Mon, 26 Dec 2022 17:29:54 +0000
(17:29 +0000)
committer
hgn
<hgodden00@gmail.com>
Mon, 26 Dec 2022 17:29:54 +0000
(17:29 +0000)
vg.h
patch
|
blob
|
history
vg_console.h
patch
|
blob
|
history
diff --git
a/vg.h
b/vg.h
index ada54695aee189dc37a0583dceabc5cd6c17786d..17bc6eee93b817f032ce128a0e1893f9c71161ec 100644
(file)
--- a/
vg.h
+++ b/
vg.h
@@
-688,13
+688,19
@@
VG_STATIC void _vg_init_window( const char *window_name )
vg.refresh_rate = mode.refresh_rate;
vg.refresh_rate = mode.refresh_rate;
- vg_info( "CreateWindow\n" );
+ if( !vg.window_x )
+ vg.window_x = mode.w;
+
+ if( !vg.window_y )
+ vg.window_y = mode.h;
+
+ vg_info( "CreateWindow( %d %d )\n", vg.window_x, vg.window_y );
/* TODO: Allow selecting closest video mode from launch opts */
if((vg.window = SDL_CreateWindow( window_name,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
/* TODO: Allow selecting closest video mode from launch opts */
if((vg.window = SDL_CreateWindow( window_name,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
-
mode.w, mode.h
,
+
vg.window_x, vg.window_y
,
SDL_WINDOW_FULLSCREEN_DESKTOP |
SDL_WINDOW_OPENGL |
SDL_WINDOW_FULLSCREEN_DESKTOP |
SDL_WINDOW_OPENGL |
@@
-751,6
+757,16
@@
VG_STATIC void _vg_init_window( const char *window_name )
}
else
vg_success( "Using adaptive Vsync\n" );
}
else
vg_success( "Using adaptive Vsync\n" );
+
+ SDL_DisplayMode dispmode;
+ if( !SDL_GetWindowDisplayMode( vg.window, &dispmode ) )
+ {
+ if( dispmode.refresh_rate )
+ {
+ vg.refresh_rate = dispmode.refresh_rate;
+ vg_info( "Refresh rate: %d\n", dispmode.refresh_rate );
+ }
+ }
}
VG_STATIC void vg_enter( int argc, char *argv[], const char *window_name )
}
VG_STATIC void vg_enter( int argc, char *argv[], const char *window_name )
diff --git
a/vg_console.h
b/vg_console.h
index 8d35aa286fdce8933e35b39720cd5dfd6534d850..e18515d45cd029e3d422da5c09881994193a7fc0 100644
(file)
--- a/
vg_console.h
+++ b/
vg_console.h
@@
-655,7
+655,7
@@
VG_STATIC void console_proc_key( SDL_Keysym ev )
}
if( !vg_console.enabled ) return;
}
if( !vg_console.enabled ) return;
-
+
struct console_mapping
{
u16 mod;
struct console_mapping
{
u16 mod;
@@
-663,7
+663,7
@@
VG_STATIC void console_proc_key( SDL_Keysym ev )
void (*handler)(void);
}
void (*handler)(void);
}
- mapping[] =
+ mapping
s
[] =
{
{ 0, SDLK_LEFT, _console_left },
{ KMOD_SHIFT, SDLK_LEFT, _console_left_select },
{
{ 0, SDLK_LEFT, _console_left },
{ KMOD_SHIFT, SDLK_LEFT, _console_left_select },
@@
-684,23
+684,25
@@
VG_STATIC void console_proc_key( SDL_Keysym ev )
{ 0, SDLK_RETURN, _console_enter }
};
{ 0, SDLK_RETURN, _console_enter }
};
- for( int i=0; i<vg_list_size( mapping ); i++ )
+ SDL_Keymod mod = ev.mod & (KMOD_SHIFT|KMOD_CTRL|KMOD_ALT);
+
+ for( int i=0; i<vg_list_size( mappings ); i++ )
{
{
- struct console_mapping *m
k = &mapping
[i];
+ struct console_mapping *m
apping = &mappings
[i];
- if( m
k
->key == ev.sym )
+ if( m
apping
->key == ev.sym )
{
{
- if( m
k
->mod == 0 )
+ if( m
apping
->mod == 0 )
{
{
- if(
ev.
mod == 0 )
+ if( mod == 0 )
{
{
- m
k
->handler();
+ m
apping
->handler();
return;
}
}
return;
}
}
- else if( (
ev.mod & mk->mod) == mk
->mod )
+ else if( (
mod & mapping->mod) == mapping
->mod )
{
{
- m
k
->handler();
+ m
apping
->handler();
return;
}
}
return;
}
}