wlt: toggle fullscreen on F11
This adds a --grab-fullscreen parameter which configures the key that toggles fullscreen. This is handled in the theme widget as we consider it the main window-handler. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
c28ea5c974
commit
ead84b9dca
@ -234,6 +234,9 @@ static void print_help()
|
|||||||
"\t Shortcut to scroll page up\n"
|
"\t Shortcut to scroll page up\n"
|
||||||
"\t --grab-page-down <grab> [<Shift>Next]\n"
|
"\t --grab-page-down <grab> [<Shift>Next]\n"
|
||||||
"\t Shortcut to scroll page down\n"
|
"\t Shortcut to scroll page down\n"
|
||||||
|
"\t --grab-fullscreen <grab> [F11]\n"
|
||||||
|
"\t Shortcut to toggle fullscreen mode\n"
|
||||||
|
"\n"
|
||||||
"Font Options:\n"
|
"Font Options:\n"
|
||||||
"\t --font-engine <engine> [pango]\n"
|
"\t --font-engine <engine> [pango]\n"
|
||||||
"\t Font engine\n"
|
"\t Font engine\n"
|
||||||
@ -321,6 +324,11 @@ static struct conf_grab def_grab_page_down = {
|
|||||||
.keysym = XKB_KEY_Next,
|
.keysym = XKB_KEY_Next,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct conf_grab def_grab_fullscreen = {
|
||||||
|
.mods = 0,
|
||||||
|
.keysym = XKB_KEY_F11,
|
||||||
|
};
|
||||||
|
|
||||||
struct conf_option options[] = {
|
struct conf_option options[] = {
|
||||||
CONF_OPTION_BOOL('h', "help", aftercheck_help, &wlt_conf.help, false),
|
CONF_OPTION_BOOL('h', "help", aftercheck_help, &wlt_conf.help, false),
|
||||||
CONF_OPTION_BOOL('v', "verbose", NULL, &wlt_conf.verbose, false),
|
CONF_OPTION_BOOL('v', "verbose", NULL, &wlt_conf.verbose, false),
|
||||||
@ -336,6 +344,7 @@ struct conf_option options[] = {
|
|||||||
CONF_OPTION_GRAB(0, "grab-scroll-down", NULL, &wlt_conf.grab_scroll_down, &def_grab_scroll_down),
|
CONF_OPTION_GRAB(0, "grab-scroll-down", NULL, &wlt_conf.grab_scroll_down, &def_grab_scroll_down),
|
||||||
CONF_OPTION_GRAB(0, "grab-page-up", NULL, &wlt_conf.grab_page_up, &def_grab_page_up),
|
CONF_OPTION_GRAB(0, "grab-page-up", NULL, &wlt_conf.grab_page_up, &def_grab_page_up),
|
||||||
CONF_OPTION_GRAB(0, "grab-page-down", NULL, &wlt_conf.grab_page_down, &def_grab_page_down),
|
CONF_OPTION_GRAB(0, "grab-page-down", NULL, &wlt_conf.grab_page_down, &def_grab_page_down),
|
||||||
|
CONF_OPTION_GRAB(0, "grab-fullscreen", NULL, &wlt_conf.grab_fullscreen, &def_grab_fullscreen),
|
||||||
|
|
||||||
CONF_OPTION_STRING(0, "font-engine", NULL, &wlt_conf.font_engine, "pango"),
|
CONF_OPTION_STRING(0, "font-engine", NULL, &wlt_conf.font_engine, "pango"),
|
||||||
CONF_OPTION_UINT(0, "font-size", NULL, &wlt_conf.font_size, 12),
|
CONF_OPTION_UINT(0, "font-size", NULL, &wlt_conf.font_size, 12),
|
||||||
|
@ -65,6 +65,8 @@ struct wlt_conf_t {
|
|||||||
struct conf_grab *grab_page_up;
|
struct conf_grab *grab_page_up;
|
||||||
/* page-down grab */
|
/* page-down grab */
|
||||||
struct conf_grab *grab_page_down;
|
struct conf_grab *grab_page_down;
|
||||||
|
/* fullscreen grab */
|
||||||
|
struct conf_grab *grab_fullscreen;
|
||||||
|
|
||||||
/* font engine */
|
/* font engine */
|
||||||
char *font_engine;
|
char *font_engine;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "shl_misc.h"
|
||||||
|
#include "wlt_main.h"
|
||||||
#include "wlt_theme.h"
|
#include "wlt_theme.h"
|
||||||
#include "wlt_toolkit.h"
|
#include "wlt_toolkit.h"
|
||||||
|
|
||||||
@ -519,6 +521,24 @@ static void widget_pointer_button(struct wlt_widget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool widget_key(struct wlt_widget *widget, unsigned int mask,
|
||||||
|
uint32_t sym, uint32_t state, bool handled, void *data)
|
||||||
|
{
|
||||||
|
struct wlt_theme *theme = data;
|
||||||
|
|
||||||
|
if (handled || state != WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (SHL_HAS_BITS(mask, wlt_conf.grab_fullscreen->mods) &&
|
||||||
|
sym == wlt_conf.grab_fullscreen->keysym) {
|
||||||
|
wlt_window_toggle_fullscreen(theme->wnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void widget_destroy(struct wlt_widget *widget, void *data)
|
static void widget_destroy(struct wlt_widget *widget, void *data)
|
||||||
{
|
{
|
||||||
struct wlt_theme *theme = data;
|
struct wlt_theme *theme = data;
|
||||||
@ -565,6 +585,7 @@ int wlt_theme_new(struct wlt_theme **out, struct wlt_window *wnd)
|
|||||||
wlt_widget_set_pointer_cb(theme->widget, widget_pointer_enter,
|
wlt_widget_set_pointer_cb(theme->widget, widget_pointer_enter,
|
||||||
widget_pointer_leave, widget_pointer_motion,
|
widget_pointer_leave, widget_pointer_motion,
|
||||||
widget_pointer_button);
|
widget_pointer_button);
|
||||||
|
wlt_widget_set_keyboard_cb(theme->widget, widget_key);
|
||||||
*out = theme;
|
*out = theme;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user