[hackers] [surf] adding autozoom lock when site is already zoomed. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Tue, 20 Oct 2009 18:47:04 +0000 (UTC)

changeset: 143:1cf8e947a961
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Tue Oct 20 20:49:33 2009 +0200
files: surf.c
description:
adding autozoom lock when site is already zoomed.

diff -r f25786dd737d -r 1cf8e947a961 surf.c
--- a/surf.c Tue Oct 20 20:34:13 2009 +0200
+++ b/surf.c Tue Oct 20 20:49:33 2009 +0200
@@ -37,6 +37,7 @@
         char *title, *linkhover;
         gint progress;
         struct Client *next;
+ gboolean zoomed;
 } Client;
 
 typedef struct {
@@ -680,8 +681,10 @@
 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 @@
 
 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[]) {
Received on Tue Oct 20 2009 - 18:47:04 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 20 2009 - 18:48:05 UTC