From 0537734ec014cb9b7d0072c55934681bc33ddd1a Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 29 Jun 2006 15:00:20 +0000 Subject: [PATCH] move browser_show() back into the device plug since the core code should not have any concept of "windows", "desktops" or "browsers" --- lib/gvc/gvevent.c | 37 ------------------------------------- plugin/xlib/gvdevice_xlib.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/lib/gvc/gvevent.c b/lib/gvc/gvevent.c index 318007f80..cc1248cc6 100644 --- a/lib/gvc/gvevent.c +++ b/lib/gvc/gvevent.c @@ -20,19 +20,6 @@ #include -#ifdef HAVE_GNOMEUI -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif - #include "gvplugin_layout.h" #include "graph.h" #include "gvcint.h" @@ -446,30 +433,6 @@ static void gvevent_button_release(GVJ_t *job, int button, pointf pointer) { job->click = 0; job->button = 0; - if (job->selected_href && job->selected_href[0]) { -#ifdef HAVE_GNOMEUI - gnome_url_show(job->selected_href, NULL); -#else -#if defined HAVE_SYS_TYPES_H && defined HAVE_UNISTD_Y && defined HAVE_ERRNO_H - char *exec_argv[3] = {"firefox", NULL, NULL}; - pid_t pid; - int err; - - exec_argv[1] = job->selected_href; - - pid = fork(); - if (pid == -1) { - fprintf(stderr,"fork failed: %s\n", strerror(errno)); - } - else if (pid == 0) { - err = execvp(exec_argv[0], exec_argv); - fprintf(stderr,"error starting %s: %s\n", exec_argv[0], strerror(errno)); - } -#else - fprintf(stdout,"%s\n", job->selected_href); -#endif -#endif - } } static void gvevent_motion(GVJ_t * job, pointf pointer) diff --git a/plugin/xlib/gvdevice_xlib.c b/plugin/xlib/gvdevice_xlib.c index 6b011350f..d77d4677d 100644 --- a/plugin/xlib/gvdevice_xlib.c +++ b/plugin/xlib/gvdevice_xlib.c @@ -137,6 +137,32 @@ static Visual *find_argb_visual(Display * dpy, int scr) return visual; } +static void browser_show(GVJ_t *job) +{ +#ifdef HAVE_GNOMEUI + gnome_url_show(job->selected_href, NULL); +#else +#if defined HAVE_SYS_TYPES_H && defined HAVE_UNISTD_Y && defined HAVE_ERRNO_H + char *exec_argv[3] = {"firefox", NULL, NULL}; + pid_t pid; + int err; + + exec_argv[1] = job->selected_href; + + pid = fork(); + if (pid == -1) { + fprintf(stderr,"fork failed: %s\n", strerror(errno)); + } + else if (pid == 0) { + err = execvp(exec_argv[0], exec_argv); + fprintf(stderr,"error starting %s: %s\n", exec_argv[0], strerror(errno)); + } +#else + fprintf(stdout,"browser_show: %s\n", job->selected_href); +#endif +#endif +} + static int handle_xlib_events (GVJ_t *firstjob, Display *dpy) { GVJ_t *job; @@ -168,6 +194,8 @@ static int handle_xlib_events (GVJ_t *firstjob, Display *dpy) pointer.x = (double)xev.xbutton.x; pointer.y = (double)xev.xbutton.y; (job->callbacks->button_release)(job, xev.xbutton.button, pointer); + if (job->selected_href && job->selected_href[0]) + browser_show(job); rc++; break; case KeyPress: -- 2.40.0