Rename fullscreen() to togglefullscreen()
And handle c->fullscreen value in winevent(). This way we keep track of fullscreen state even if we did not directly initiate the fullscreen.
This commit is contained in:
parent
b4e78555d0
commit
d6794e0d75
2 changed files with 14 additions and 5 deletions
|
@ -107,7 +107,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, GDK_KEY_i, scroll_h, { .i = +1 } },
|
{ MODKEY, GDK_KEY_i, scroll_h, { .i = +1 } },
|
||||||
{ MODKEY, GDK_KEY_u, 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 } },
|
{ 0, GDK_KEY_Escape, stop, { 0 } },
|
||||||
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, inspector, { 0 } },
|
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, inspector, { 0 } },
|
||||||
|
|
||||||
|
|
17
surf.c
17
surf.c
|
@ -127,7 +127,7 @@ static void die(const char *errstr, ...);
|
||||||
static void evalscript(Client *c, const char *jsstr, ...);
|
static void evalscript(Client *c, const char *jsstr, ...);
|
||||||
static void runscript(Client *c);
|
static void runscript(Client *c);
|
||||||
static void find(Client *c, const Arg *arg);
|
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,
|
static gboolean permissionrequested(WebKitWebView *v,
|
||||||
WebKitPermissionRequest *r, Client *c);
|
WebKitPermissionRequest *r, Client *c);
|
||||||
static const char *getatom(Client *c, int a);
|
static const char *getatom(Client *c, int a);
|
||||||
|
@ -600,13 +600,13 @@ find(Client *c, const Arg *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fullscreen(Client *c, const Arg *arg)
|
togglefullscreen(Client *c, const Arg *a)
|
||||||
{
|
{
|
||||||
|
/* toggling value is handled in winevent() */
|
||||||
if (c->fullscreen)
|
if (c->fullscreen)
|
||||||
gtk_window_unfullscreen(GTK_WINDOW(c->win));
|
gtk_window_unfullscreen(GTK_WINDOW(c->win));
|
||||||
else
|
else
|
||||||
gtk_window_fullscreen(GTK_WINDOW(c->win));
|
gtk_window_fullscreen(GTK_WINDOW(c->win));
|
||||||
c->fullscreen = !c->fullscreen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -1037,7 +1037,7 @@ showview(WebKitWebView *v, Client *c)
|
||||||
webkit_web_view_set_zoom_level(c->view, zoomlevel);
|
webkit_web_view_set_zoom_level(c->view, zoomlevel);
|
||||||
|
|
||||||
if (runinfullscreen)
|
if (runinfullscreen)
|
||||||
fullscreen(c, NULL);
|
togglefullscreen(c, NULL);
|
||||||
|
|
||||||
setatom(c, AtomFind, "");
|
setatom(c, AtomFind, "");
|
||||||
setatom(c, AtomUri, "about:blank");
|
setatom(c, AtomUri, "about:blank");
|
||||||
|
@ -1127,6 +1127,8 @@ createwindow(Client *c)
|
||||||
G_CALLBACK(destroywin), c);
|
G_CALLBACK(destroywin), c);
|
||||||
g_signal_connect(G_OBJECT(w), "leave-notify-event",
|
g_signal_connect(G_OBJECT(w), "leave-notify-event",
|
||||||
G_CALLBACK(winevent), c);
|
G_CALLBACK(winevent), c);
|
||||||
|
g_signal_connect(G_OBJECT(w), "window-state-event",
|
||||||
|
G_CALLBACK(winevent), c);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
@ -1339,6 +1341,13 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c)
|
||||||
c->targeturi = NULL;
|
c->targeturi = NULL;
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
break;
|
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:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue