{ MODKEY, GDK_KEY_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_KEY_u, scroll_h, { .i = -1 } },
- { 0, GDK_KEY_F11, fullscreen, { 0 } },
+ { 0, GDK_KEY_F11, togglefullscreen, { 0 } },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, inspector, { 0 } },
static void evalscript(Client *c, const char *jsstr, ...);
static void runscript(Client *c);
static void find(Client *c, const Arg *arg);
-static void fullscreen(Client *c, const Arg *arg);
+static void togglefullscreen(Client *c, const Arg *a);
static gboolean permissionrequested(WebKitWebView *v,
WebKitPermissionRequest *r, Client *c);
static const char *getatom(Client *c, int a);
}
void
-fullscreen(Client *c, const Arg *arg)
+togglefullscreen(Client *c, const Arg *a)
{
+ /* toggling value is handled in winevent() */
if (c->fullscreen)
gtk_window_unfullscreen(GTK_WINDOW(c->win));
else
gtk_window_fullscreen(GTK_WINDOW(c->win));
- c->fullscreen = !c->fullscreen;
}
gboolean
webkit_web_view_set_zoom_level(c->view, zoomlevel);
if (runinfullscreen)
- fullscreen(c, NULL);
+ togglefullscreen(c, NULL);
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
G_CALLBACK(destroywin), c);
g_signal_connect(G_OBJECT(w), "leave-notify-event",
G_CALLBACK(winevent), c);
+ g_signal_connect(G_OBJECT(w), "window-state-event",
+ G_CALLBACK(winevent), c);
return w;
}
c->targeturi = NULL;
updatetitle(c);
break;
+ case GDK_WINDOW_STATE: /* fallthrough */
+ if (e->window_state.changed_mask ==
+ GDK_WINDOW_STATE_FULLSCREEN) {
+ c->fullscreen = e->window_state.new_window_state &
+ GDK_WINDOW_STATE_FULLSCREEN;
+ break;
+ }
default:
return FALSE;
}