summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnno Boland (tox) <tox@s01.de>2009-10-20 20:49:33 +0200
committerEnno Boland (tox) <tox@s01.de>2009-10-20 20:49:33 +0200
commit31441e93f73029017fb59ac9f7e36ba74206ced4 (patch)
treea297310c4fdea17b2f77737408fa865631dc4341
parent92afa03d80ba077f7a5b1dc1bd44d82ab1d35b8f (diff)
downloadsurf-31441e93f73029017fb59ac9f7e36ba74206ced4.tar.gz
surf-31441e93f73029017fb59ac9f7e36ba74206ced4.tar.bz2
surf-31441e93f73029017fb59ac9f7e36ba74206ced4.zip
adding autozoom lock when site is already zoomed.
-rw-r--r--surf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/surf.c b/surf.c
index cd01b83..ecdbbed 100644
--- a/surf.c
+++ b/surf.c
@@ -37,6 +37,7 @@ typedef struct Client {
char *title, *linkhover;
gint progress;
struct Client *next;
+ gboolean zoomed;
} Client;
typedef struct {
@@ -680,8 +681,10 @@ void
resize(GtkWidget *w, GtkAllocation *a, Client *c) {
double zoom;
+ if(c->zoomed)
+ return;
zoom = webkit_web_view_get_zoom_level(c->view);
- if(a->width * a->height < 300 * 300 && zoom != 0.2)
+ if(a->width * a->height < 300 * 400 && zoom != 0.2)
webkit_web_view_set_zoom_level(c->view, 0.2);
else if(zoom != 1.0)
webkit_web_view_set_zoom_level(c->view, 1.0);
@@ -839,12 +842,15 @@ windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObje
void
zoom(Client *c, const Arg *arg) {
+ c->zoomed = TRUE;
if(arg->i < 0) /* zoom out */
webkit_web_view_zoom_out(c->view);
else if(arg->i > 0) /* zoom in */
webkit_web_view_zoom_in(c->view);
- else /* reset */
+ else { /* reset */
+ c->zoomed = FALSE;
webkit_web_view_set_zoom_level(c->view, 1.0);
+ }
}
int main(int argc, char *argv[]) {