summaryrefslogtreecommitdiff
path: root/emerald
diff options
context:
space:
mode:
authortest-tools <test-tools@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-09 21:04:31 +0000
committertest-tools <test-tools@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-09 21:04:31 +0000
commitadf8e45f15757a0130e8b136f449bbb324f5b6e4 (patch)
tree0d3406866113efee9dd38514bc641b7136426ffd /emerald
parentadd4badbcee21c2f9f6e0d2956d4a767f6b3223c (diff)
downloadmarex-dev-adf8e45f15757a0130e8b136f449bbb324f5b6e4.tar.gz
marex-dev-adf8e45f15757a0130e8b136f449bbb324f5b6e4.tar.bz2
emerald: Fixed reload of settings, when emerald was invoked with anothername, e.g. x-window-deocorator.
Related to #119. Prerequiste for #120 git-svn-id: file:///beryl/trunk@1626 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'emerald')
-rw-r--r--emerald/libengine/themer.c66
-rw-r--r--emerald/src/main.c12
2 files changed, 70 insertions, 8 deletions
diff --git a/emerald/libengine/themer.c b/emerald/libengine/themer.c
index 0c19b97..eb3fab3 100644
--- a/emerald/libengine/themer.c
+++ b/emerald/libengine/themer.c
@@ -42,6 +42,25 @@ DBusConnection *dbcon;
#endif
gchar * active_engine = NULL;
+static gchar* display_part(const gchar *p)
+{
+ gchar *name = g_strdup(p);
+ gchar *tmp;
+
+ if ((tmp = g_strrstr(name,":"))) {
+ *tmp++ = 0;
+ tmp = g_strdup(tmp);
+ g_free(name);
+ name = tmp;
+ }
+
+ if ((tmp = g_strrstr(name,"."))) {
+ *tmp = 0;
+ }
+
+ return name;
+}
+
GSList * get_setting_list()
{
return SettingList;
@@ -224,12 +243,47 @@ void send_reload_signal()
dbus_connection_send(dbcon,message,NULL);
dbus_message_unref(message);
#else
- gchar * args[]=
- {"killall","-u",(gchar *)g_get_user_name(),"-SIGUSR1","emerald",NULL};
- gchar * ret=NULL;
- if (!g_spawn_sync(NULL,args,NULL,G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
- NULL,NULL,&ret,NULL,NULL,NULL) || !ret)
- g_warning("Couldn't find running emerald, no reload signal sent.");
+ Atom wmAtom = 0;
+ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+
+ char buffer[128];
+ char *part = display_part(getenv("DISPLAY"));
+
+ sprintf(buffer, "DM_S%s", part);
+ free(part);
+
+ if (dpy)
+ wmAtom = XInternAtom(dpy,buffer,0);
+
+ if (wmAtom) {
+ XEvent clientEvent;
+ Status missed;
+ Window w = XGetSelectionOwner(dpy,wmAtom);
+ Atom ReloadIt = XInternAtom(dpy, "emerald-sigusr1", 0);
+ clientEvent.xclient.type = ClientMessage;
+ clientEvent.xclient.window = w;
+ clientEvent.xclient.message_type = ReloadIt;
+ clientEvent.xclient.format = 32;
+ clientEvent.xclient.display = dpy;
+ clientEvent.xclient.data.l[0] = 0;
+ clientEvent.xclient.data.l[1] = 0;
+ clientEvent.xclient.data.l[2] = 0;
+ clientEvent.xclient.data.l[3] = 0;
+ clientEvent.xclient.data.l[4] = 0;
+ missed = XSendEvent(dpy,w,
+ False,
+ NoEventMask,
+ &clientEvent);
+ XSync (dpy, False);
+ } else {
+ /* The old way */
+ gchar * args[]=
+ {"killall","-u",(gchar *)g_get_user_name(),"-SIGUSR1","emerald",NULL};
+ gchar * ret=NULL;
+ if (!g_spawn_sync(NULL,args,NULL,G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
+ NULL,NULL,&ret,NULL,NULL,NULL) || !ret)
+ g_warning("Couldn't find running emerald, no reload signal sent.");
+ }
#endif
}
void apply_settings()
diff --git a/emerald/src/main.c b/emerald/src/main.c
index 382220b..b0525e0 100644
--- a/emerald/src/main.c
+++ b/emerald/src/main.c
@@ -15,6 +15,8 @@
#define DECOR_INTERFACE_VERSION 0
#endif
+void reload_all_settings (int sig);
+
GdkPixmap * pdeb;
static gboolean do_reload=FALSE;
@@ -80,6 +82,7 @@ static Atom multiple_atom;
static Atom timestamp_atom;
static Atom version_atom;
static Atom atom_pair_atom;
+static Atom emerald_sigusr1_atom;
static Atom utf8_string_atom;
@@ -3300,7 +3303,7 @@ update_window_decoration_actions (WnckWindow *win)
if(data)
XFree((void *) data);
fprintf(stderr,"XGetWindowProperty() returned non-success value (%d).\n",result);
- fprintf(stderr,"Please report this to the development team.\n",result);
+ fprintf(stderr,"Please report this to the development team.\n" /* ,result */);
break;
}
}
@@ -5202,7 +5205,10 @@ event_filter_func (GdkXEvent *gdkxevent,
hide_force_quit_dialog (win);
}
}
- }
+ } else if (xevent->xclient.message_type == emerald_sigusr1_atom) {
+ reload_all_settings(SIGUSR1);
+ }
+
default:
break;
}
@@ -6417,6 +6423,8 @@ main (int argc, char *argv[])
timestamp_atom = XInternAtom (xdisplay, "TIMESTAMP", FALSE);
version_atom = XInternAtom (xdisplay, "VERSION", FALSE);
atom_pair_atom = XInternAtom (xdisplay, "ATOM_PAIR", FALSE);
+ emerald_sigusr1_atom = XInternAtom (xdisplay, "emerals-sigusr1", FALSE);
+
utf8_string_atom = XInternAtom (xdisplay, "UTF8_STRING", FALSE);