Implementing fullscreen mode. Thanks Krol, Willem van de!

This commit is contained in:
Christoph Lohmann 2012-12-03 21:19:16 +01:00
parent 1f30ddf224
commit 0dfdb75804
3 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,5 @@
* suckless adblocking * suckless adblocking
* integrate the WebKitWebInspector API * integrate the WebKitWebInspector API
* make scrollbars a switch and allow them to be disabled * make scrollbars a switch and allow them to be disabled
* implement fullscreen mode (F11)
* replace webkit with something sane * replace webkit with something sane

View File

@ -66,6 +66,7 @@ static Key keys[] = {
{ MODKEY, GDK_i, scroll_h, { .i = +1 } }, { MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_u, scroll_h, { .i = -1 } }, { MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ 0, GDK_F11, fullscreen, { 0 } },
{ 0, GDK_Escape, stop, { 0 } }, { 0, GDK_Escape, stop, { 0 } },
{ MODKEY, GDK_o, source, { 0 } }, { MODKEY, GDK_o, source, { 0 } },

13
surf.c
View File

@ -46,7 +46,7 @@ typedef struct Client {
gint progress; gint progress;
gboolean sslfailed; gboolean sslfailed;
struct Client *next; struct Client *next;
gboolean zoomed; gboolean zoomed, fullscreen;
} Client; } Client;
typedef struct { typedef struct {
@ -101,6 +101,7 @@ static void die(char *str);
static void drawindicator(Client *c); static void drawindicator(Client *c);
static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c); static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, 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 const char *getatom(Client *c, int a); static const char *getatom(Client *c, int a);
static char *geturi(Client *c); static char *geturi(Client *c);
static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c); static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c);
@ -399,6 +400,16 @@ find(Client *c, const Arg *arg) {
webkit_web_view_search_text(c->view, s, FALSE, forward, TRUE); webkit_web_view_search_text(c->view, s, FALSE, forward, TRUE);
} }
void
fullscreen(Client *c, const Arg *arg) {
if(c->fullscreen) {
gtk_window_unfullscreen(GTK_WINDOW(c->win));
} else {
gtk_window_fullscreen(GTK_WINDOW(c->win));
}
c->fullscreen = !c->fullscreen;
}
const char * const char *
getatom(Client *c, int a) { getatom(Client *c, int a) {
static char buf[BUFSIZ]; static char buf[BUFSIZ];