diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/window/key.c | 18 | ||||
-rw-r--r-- | src/window/window.c | 13 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/window/key.c b/src/window/key.c index 34084b3..ffef2b4 100644 --- a/src/window/key.c +++ b/src/window/key.c @@ -120,6 +120,15 @@ const char* mgl_key_to_string(mgl_key key) { case MGL_KEY_AUDIO_FORWARD: return "Audio Forward"; case MGL_KEY_DEAD_ACUTE: return "ยด"; case MGL_KEY_APOSTROPHE: return "'"; + case MGL_KEY_F16: return "F16"; + case MGL_KEY_F17: return "F17"; + case MGL_KEY_F18: return "F18"; + case MGL_KEY_F19: return "F19"; + case MGL_KEY_F20: return "F20"; + case MGL_KEY_F21: return "F21"; + case MGL_KEY_F22: return "F22"; + case MGL_KEY_F23: return "F23"; + case MGL_KEY_F24: return "F24"; case __MGL_NUM_KEYS__: return ""; } return ""; @@ -192,6 +201,15 @@ uint64_t mgl_key_to_x11_keysym(mgl_key key) { case MGL_KEY_AUDIO_FORWARD: return XF86XK_AudioForward; case MGL_KEY_DEAD_ACUTE: return XK_dead_acute; case MGL_KEY_APOSTROPHE: return XK_apostrophe; + case MGL_KEY_F16: return XK_F16; + case MGL_KEY_F17: return XK_F17; + case MGL_KEY_F18: return XK_F18; + case MGL_KEY_F19: return XK_F19; + case MGL_KEY_F20: return XK_F20; + case MGL_KEY_F21: return XK_F21; + case MGL_KEY_F22: return XK_F22; + case MGL_KEY_F23: return XK_F23; + case MGL_KEY_F24: return XK_F24; default: return XK_VoidSymbol; } return XK_VoidSymbol; diff --git a/src/window/window.c b/src/window/window.c index 6dbf3df..55efffd 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -800,7 +800,7 @@ static void mgl_window_on_resize(mgl_window *self, int width, int height) { static unsigned long mgl_color_to_x11_pixel(mgl_color color) { if(color.a == 0) return 0; - return ((uint32_t)color.a << 24) | ((uint32_t)color.r << 16) | ((uint32_t)color.g << 8) | (uint32_t)color.b; + return ((uint32_t)color.a << 24) | (((uint32_t)color.r * color.a / 0xFF) << 16) | (((uint32_t)color.g * color.a / 0xFF) << 8) | ((uint32_t)color.b * color.a / 0xFF); } static void mgl_set_window_type(mgl_window *self, mgl_window_type window_type) { @@ -911,7 +911,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window XSetWindowAttributes window_attr; window_attr.override_redirect = params ? params->override_redirect : false; window_attr.colormap = x11_context->color_map; - window_attr.background_pixel = mgl_color_to_x11_pixel(params ? params->background_color : (mgl_color){ .r = 0, .g = 0, .b = 0, .a = 0 }); + window_attr.background_pixel = mgl_color_to_x11_pixel(params ? params->background_color : (mgl_color){ .r = 0, .g = 0, .b = 0, .a = 255 }); window_attr.border_pixel = 0; window_attr.bit_gravity = NorthWestGravity; window_attr.event_mask = @@ -1163,6 +1163,15 @@ static mgl_key x11_keysym_to_mgl_key(KeySym key_sym) { case XF86XK_AudioForward: return MGL_KEY_AUDIO_FORWARD; case XK_dead_acute: return MGL_KEY_DEAD_ACUTE; case XK_apostrophe: return MGL_KEY_APOSTROPHE; + case XK_F16: return MGL_KEY_F16; + case XK_F17: return MGL_KEY_F17; + case XK_F18: return MGL_KEY_F18; + case XK_F19: return MGL_KEY_F19; + case XK_F20: return MGL_KEY_F20; + case XK_F21: return MGL_KEY_F21; + case XK_F22: return MGL_KEY_F22; + case XK_F23: return MGL_KEY_F23; + case XK_F24: return MGL_KEY_F24; } return MGL_KEY_UNKNOWN; } |