diff options
author | Michael Jennings <mej@kainx.org> | 1999-09-23 22:14:31 +0000 |
---|---|---|
committer | Michael Jennings <mej@kainx.org> | 1999-09-23 22:14:31 +0000 |
commit | fcc0522f12739dc8c01272f1c8bbb6143795d5fc (patch) | |
tree | 51715ceaaadd24dd9d498fb2cdff14b187025c42 /src | |
parent | dac3e8e0a5e2edf4b616ab56260955a3a16d7ee4 (diff) | |
download | eterm-fcc0522f12739dc8c01272f1c8bbb6143795d5fc.tar.gz |
Thu Sep 23 15:56:35 PDT 1999 Michael Jennings <mej@eterm.org>
Auto mode lives. Still a little flaky with the submenu pixmap, but
everything else seems to work peachily. It requires an Enlightenment
themes that contains the needed imageclasses, but that's not hard to
do. Here are the classes you need:
ETERM_BG Background image
ETERM_ARROW_UP Up arrow
ETERM_ARROW_DOWN Down arrow
ETERM_ARROW_LEFT Left arrow (for future use)
ETERM_ARROW_RIGHT Right arrow (for future use)
ETERM_TROUGH Scrollbar trough
ETERM_ANCHOR Scrollbar anchor
ETERM_MENU_BOX Menu background
ETERM_MENU_ITEM Menu item
ETERM_MENU_SUBMENU Submenu item
Currently, ETERM_MENU_BOX doesn't work; Eterm uses ETERM_MENU_ITEM
instead. This is a design issue I have to fix. :-) Everything else,
however, should work as noted above.
SVN revision: 387
Diffstat (limited to 'src')
-rw-r--r-- | src/e.c | 8 | ||||
-rw-r--r-- | src/pixmap.c | 56 |
2 files changed, 42 insertions, 22 deletions
@@ -123,15 +123,18 @@ enl_ipc_send(char *str) ASSERT(str != NULL); + D_ENL(("enl_ipc_send(): Sending \"%s\" to Enlightenment.\n", str)); + if (ipc_win == None) { if ((ipc_win = enl_ipc_get_win()) == None) { + D_ENL((" ...or perhaps not, since Enlightenment doesn't seem to be running. No IPC window, no IPC. Sorry....\n")); return; } } len = strlen(str); - ipc_atom = XInternAtom(Xdisplay, "ENL_MSG", True); + ipc_atom = XInternAtom(Xdisplay, "ENL_MSG", False); if (ipc_atom == None) { - D_ENL(("enl_ipc_send(): IPC error: ENL_MSG atom does not exist.\n")); + D_ENL(("enl_ipc_send(): IPC error: Unable to find/create ENL_MSG atom.\n")); return; } ev.xclient.type = ClientMessage; @@ -155,6 +158,7 @@ enl_ipc_send(char *str) } XSendEvent(Xdisplay, ipc_win, False, 0, (XEvent *) & ev); } + D_ENL(("enl_ipc_send(): Message sent.\n")); } char * diff --git a/src/pixmap.c b/src/pixmap.c index e30b5a1..e1659c6 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -412,34 +412,50 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short pixmap = simg->pmap->pixmap; /* Save this for later */ if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO) && (which != image_bg)) { - char buff[255], *iclass = NULL, *state = NULL; + char buff[255], *iclass = NULL, *state = NULL, *reply; switch (which) { - case image_up: iclass = "BUTTON_ARROW_UP"; break; - case image_down: iclass = "BUTTON_ARROW_DOWN"; break; - case image_left: iclass = "BUTTON_ARROW_LEFT"; break; - case image_right: iclass = "BUTTON_ARROW_RIGHT"; break; + case image_bg: iclass = "ETERM_BG"; break; + case image_up: iclass = "ETERM_ARROW_UP"; break; + case image_down: iclass = "ETERM_ARROW_DOWN"; break; + case image_left: iclass = "ETERM_ARROW_LEFT"; break; + case image_right: iclass = "ETERM_ARROW_RIGHT"; break; # ifdef PIXMAP_SCROLLBAR - case image_sb: iclass = "BAR_VERTICAL"; state = "clicked"; break; - case image_sa: iclass = "BAR_VERTICAL"; ((images[which].current == images[which].selected) ? (state = "hilited") : (state = "clicked")); break; + case image_sb: iclass = "ETERM_TROUGH"; break; + case image_sa: iclass = "ETERM_ANCHOR"; break; # endif - case image_menu: iclass = "BAR_HORIZONTAL"; state = "normal"; break; - case image_submenu: iclass = "DEFAULT_MENU_SUB"; break; + case image_menu: iclass = "ETERM_MENU_ITEM"; break; + case image_submenu: iclass = "ETERM_MENU_SUBMENU"; break; default: break; } - if (!state) { - if (images[which].current == images[which].selected) { - state = "hilited"; - } else if (images[which].current == images[which].clicked) { - state = "clicked"; - } else { - state = "normal"; - } + if (images[which].current == images[which].selected) { + state = "hilited"; + } else if (images[which].current == images[which].clicked) { + state = "clicked"; + } else { + state = "normal"; } - if (iclass && state) { - snprintf(buff, sizeof(buff), "imageclass %s apply %ld %s", iclass, (long int) win, state); + if (iclass) { + snprintf(buff, sizeof(buff), "imageclass %s query", iclass); enl_ipc_send(buff); - return; + for (; !(reply = enl_ipc_get(enl_wait_for_reply()));); + if (strstr(reply, "not")) { + print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass); + if (image_mode_is(which, ALLOW_IMAGE)) { + image_set_mode(which, MODE_IMAGE); + } else { + image_set_mode(which, MODE_SOLID); + } + } else if (strstr(reply, "Error")) { + print_error("Looks like this version of Enlightenment doesn't support the IPC commands I need. Disallowing \"auto\" mode for all images.\n"); + FOREACH_IMAGE(if (image_mode_is(idx, MODE_AUTO)) {if (image_mode_is(idx, ALLOW_IMAGE)) {image_set_mode(idx, MODE_IMAGE);} else {image_set_mode(idx, MODE_SOLID);}} \ + if (image_mode_is(idx, ALLOW_AUTO)) {image_disallow_mode(idx, ALLOW_AUTO);}); + } else { + snprintf(buff, sizeof(buff), "imageclass %s apply 0x%x %s", iclass, (int) win, state); + enl_ipc_send(buff); + for (; !(reply = enl_ipc_get(enl_wait_for_reply()));); + return; + } } } |