pinosaur
/
surf.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adapt clipboard()
[surf.git]
/
surf.c
diff --git
a/surf.c
b/surf.c
index
6c83405
..
5e1aa8d
100644
(file)
--- a/
surf.c
+++ b/
surf.c
@@
-107,7
+107,7
@@
static char *buildfile(const char *path);
static char *buildpath(const char *path);
static gboolean buttonreleased(GtkWidget *w, GdkEventKey *e, Client *c);
static void cleanup(void);
static char *buildpath(const char *path);
static gboolean buttonreleased(GtkWidget *w, GdkEventKey *e, Client *c);
static void cleanup(void);
-static void clipboard(Client *c, const Arg *a
rg
);
+static void clipboard(Client *c, const Arg *a);
static WebKitCookieAcceptPolicy cookiepolicy_get(void);
static char cookiepolicy_set(const WebKitCookieAcceptPolicy p);
static WebKitCookieAcceptPolicy cookiepolicy_get(void);
static char cookiepolicy_set(const WebKitCookieAcceptPolicy p);
@@
-127,7
+127,7
@@
static void die(const char *errstr, ...);
static void evalscript(Client *c, const char *jsstr, ...);
static void runscript(Client *c);
static void find(Client *c, const Arg *arg);
static void evalscript(Client *c, const char *jsstr, ...);
static void runscript(Client *c);
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,
WebKitPermissionRequest *r, Client *c);
static const char *getatom(Client *c, int a);
static gboolean permissionrequested(WebKitWebView *v,
WebKitPermissionRequest *r, Client *c);
static const char *getatom(Client *c, int a);
@@
-362,18
+362,16
@@
runscript(Client *c)
}
void
}
void
-clipboard(Client *c, const Arg *a
rg
)
+clipboard(Client *c, const Arg *a)
{
{
- gboolean paste = *(gboolean *)arg;
-
- if (paste) {
+ if (a->b) { /* load clipboard uri */
gtk_clipboard_request_text(gtk_clipboard_get(
GDK_SELECTION_PRIMARY),
pasteuri, c);
gtk_clipboard_request_text(gtk_clipboard_get(
GDK_SELECTION_PRIMARY),
pasteuri, c);
- } else {
+ } else {
/* copy uri */
gtk_clipboard_set_text(gtk_clipboard_get(
gtk_clipboard_set_text(gtk_clipboard_get(
- GDK_SELECTION_PRIMARY), c->
linkhover
- ? c->
linkhover
: geturi(c), -1);
+ GDK_SELECTION_PRIMARY), c->
targeturi
+ ? c->
targeturi
: geturi(c), -1);
}
}
}
}
@@
-600,13
+598,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)
gtk_window_unfullscreen(GTK_WINDOW(c->win));
else
gtk_window_fullscreen(GTK_WINDOW(c->win));
if (c->fullscreen)
gtk_window_unfullscreen(GTK_WINDOW(c->win));
else
gtk_window_fullscreen(GTK_WINDOW(c->win));
- c->fullscreen = !c->fullscreen;
}
gboolean
}
gboolean
@@
-1037,7
+1035,7
@@
showview(WebKitWebView *v, Client *c)
webkit_web_view_set_zoom_level(c->view, zoomlevel);
if (runinfullscreen)
webkit_web_view_set_zoom_level(c->view, zoomlevel);
if (runinfullscreen)
- fullscreen(c, NULL);
+
toggle
fullscreen(c, NULL);
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
@@
-1127,6
+1125,8
@@
createwindow(Client *c)
G_CALLBACK(destroywin), c);
g_signal_connect(G_OBJECT(w), "leave-notify-event",
G_CALLBACK(winevent), c);
G_CALLBACK(destroywin), c);
g_signal_connect(G_OBJECT(w), "leave-notify-event",
G_CALLBACK(winevent), c);
+ g_signal_connect(G_OBJECT(w), "window-state-event",
+ G_CALLBACK(winevent), c);
return w;
}
return w;
}
@@
-1339,6
+1339,13
@@
winevent(GtkWidget *w, GdkEvent *e, Client *c)
c->targeturi = NULL;
updatetitle(c);
break;
c->targeturi = NULL;
updatetitle(c);
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:
return FALSE;
}
default:
return FALSE;
}