Adapt zoom()

This commit is contained in:
Quentin Rameau 2015-11-20 01:03:32 +01:00
parent acec16e685
commit 320e4e4388

25
surf.c
View file

@ -65,7 +65,7 @@ typedef struct Client {
const char *needle; const char *needle;
gint progress; gint progress;
struct Client *next; struct Client *next;
gboolean zoomed, fullscreen; gboolean fullscreen;
} Client; } Client;
typedef struct { typedef struct {
@ -182,7 +182,7 @@ static void togglestyle(Client *c, const Arg *arg);
static void updatetitle(Client *c); static void updatetitle(Client *c);
static void updatewinid(Client *c); static void updatewinid(Client *c);
static void usage(void); static void usage(void);
static void zoom(Client *c, const Arg *arg); static void zoom(Client *c, const Arg *a);
/* configuration, allows nested code to access above variables */ /* configuration, allows nested code to access above variables */
#include "config.h" #include "config.h"
@ -996,7 +996,6 @@ showview(WebKitWebView *v, Client *c)
gdk_window_set_events(gwin, GDK_ALL_EVENTS_MASK); gdk_window_set_events(gwin, GDK_ALL_EVENTS_MASK);
gdk_window_add_filter(gwin, processx, c); gdk_window_add_filter(gwin, processx, c);
/* This might conflict with _zoomto96dpi_. */
if (zoomlevel != 1.0) if (zoomlevel != 1.0)
webkit_web_view_set_zoom_level(c->view, zoomlevel); webkit_web_view_set_zoom_level(c->view, zoomlevel);
@ -1423,20 +1422,16 @@ usage(void)
} }
void void
zoom(Client *c, const Arg *arg) zoom(Client *c, const Arg *a)
{ {
c->zoomed = TRUE; if (a->i > 0)
if (arg->i < 0) { webkit_web_view_set_zoom_level(c->view, zoomlevel + 0.1);
/* zoom out */ else if (a->i < 0)
webkit_web_view_zoom_out(c->view); webkit_web_view_set_zoom_level(c->view, zoomlevel - 0.1);
} else if (arg->i > 0) { else
/* zoom in */
webkit_web_view_zoom_in(c->view);
} else {
/* reset */
c->zoomed = FALSE;
webkit_web_view_set_zoom_level(c->view, 1.0); webkit_web_view_set_zoom_level(c->view, 1.0);
}
zoomlevel = webkit_web_view_get_zoom_level(c->view);
} }
int int