Thu Sep 23 17:15:27 PDT 1999 Michael Jennings <mej@eterm.org>
Well, we're to the point of asking E to render the submenu image, but it keeps returning null pixmaps. =] I'll have to dig deeper. SVN revision: 388
This commit is contained in:
parent
fcc0522f12
commit
c4163c0062
|
@ -2482,3 +2482,9 @@ Thu Sep 23 15:56:35 PDT 1999 Michael Jennings <mej@eterm.org>
|
|||
however, should work as noted above.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Thu Sep 23 17:15:27 PDT 1999 Michael Jennings <mej@eterm.org>
|
||||
|
||||
Well, we're to the point of asking E to render the submenu image, but
|
||||
it keeps returning null pixmaps. =] I'll have to dig deeper.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
13
src/events.c
13
src/events.c
|
@ -140,6 +140,7 @@ event_init_primary_dispatcher(void)
|
|||
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, KeyPress, handle_key_press);
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, PropertyNotify, handle_property_notify);
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, DestroyNotify, handle_destroy_notify);
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, ClientMessage, handle_client_message);
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, MappingNotify, handle_mapping_notify);
|
||||
EVENT_DATA_ADD_HANDLER(primary_data, VisibilityNotify, handle_visibility_notify);
|
||||
|
@ -260,6 +261,18 @@ handle_property_notify(event_t * ev)
|
|||
return 1;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
handle_destroy_notify(event_t * ev)
|
||||
{
|
||||
|
||||
D_EVENTS(("handle_destroy_notify(ev [0x%08x] on window 0x%08x)\n", ev, ev->xany.window));
|
||||
|
||||
if (ev->xany.window == ipc_win) {
|
||||
ipc_win = None;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
handle_client_message(event_t * ev)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@ extern unsigned char event_win_is_mywin(event_dispatcher_data_t *, Window);
|
|||
extern unsigned char event_win_is_parent(event_dispatcher_data_t *, Window);
|
||||
extern unsigned char handle_key_press(event_t *);
|
||||
extern unsigned char handle_property_notify(event_t *);
|
||||
extern unsigned char handle_destroy_notify(event_t *);
|
||||
extern unsigned char handle_reparent_notify(event_t *);
|
||||
extern unsigned char handle_client_message(event_t *);
|
||||
extern unsigned char handle_mapping_notify(event_t *);
|
||||
|
|
12
src/menus.c
12
src/menus.c
|
@ -769,9 +769,7 @@ menuitem_select(menu_t * menu, menuitem_t * item)
|
|||
XMoveWindow(Xdisplay, menu->swin, item->x, item->y);
|
||||
XMapWindow(Xdisplay, menu->swin);
|
||||
if (item->type == MENUITEM_SUBMENU) {
|
||||
if (image_mode_is(image_submenu, MODE_IMAGE) && image_mode_is(image_submenu, ALLOW_IMAGE)) {
|
||||
paste_simage(images[image_submenu].selected, menu->swin, 0, 0, item->w - MENU_VGAP, item->h);
|
||||
}
|
||||
paste_simage(images[image_submenu].selected, image_submenu, menu->swin, 0, 0, item->w - MENU_VGAP, item->h);
|
||||
} else {
|
||||
render_simage(images[image_menu].selected, menu->swin, item->w - MENU_VGAP, item->h, image_menu, 0);
|
||||
}
|
||||
|
@ -793,9 +791,7 @@ menuitem_deselect(menu_t * menu, menuitem_t * item)
|
|||
XUnmapWindow(Xdisplay, menu->swin);
|
||||
if (find_item_in_menu(menu, item) != (unsigned short) -1) {
|
||||
if (item->type == MENUITEM_SUBMENU) {
|
||||
if (image_mode_is(image_submenu, MODE_IMAGE) && image_mode_is(image_submenu, ALLOW_IMAGE)) {
|
||||
paste_simage(images[image_submenu].norm, menu->win, item->x, item->y, item->w - MENU_VGAP, item->h);
|
||||
}
|
||||
paste_simage(images[image_submenu].norm, image_submenu, menu->win, item->x, item->y, item->w - MENU_VGAP, item->h);
|
||||
}
|
||||
draw_string(menu->win, menu->gc, 2 * MENU_HGAP, item->y + item->h - MENU_VGAP, item->text, item->len);
|
||||
if (item->rtext) {
|
||||
|
@ -934,9 +930,7 @@ menu_draw(menu_t * menu)
|
|||
}
|
||||
switch (item->type) {
|
||||
case MENUITEM_SUBMENU:
|
||||
if (image_mode_is(image_submenu, MODE_IMAGE) && image_mode_is(image_submenu, ALLOW_IMAGE)) {
|
||||
paste_simage(images[image_submenu].norm, menu->win, item->x, item->y, item->w - MENU_VGAP, item->h);
|
||||
}
|
||||
paste_simage(images[image_submenu].norm, image_submenu, menu->win, item->x, item->y, item->w - MENU_VGAP, item->h);
|
||||
break;
|
||||
case MENUITEM_STRING:
|
||||
#if 0
|
||||
|
|
97
src/pixmap.c
97
src/pixmap.c
|
@ -313,12 +313,96 @@ reset_simage(simage_t * simg, unsigned long mask)
|
|||
}
|
||||
|
||||
void
|
||||
paste_simage(simage_t * simg, Window win, unsigned short x, unsigned short y, unsigned short w, unsigned short h)
|
||||
paste_simage(simage_t *simg, unsigned char which, Window win, unsigned short x, unsigned short y, unsigned short w, unsigned short h)
|
||||
{
|
||||
|
||||
ASSERT(simg != NULL);
|
||||
REQUIRE(win != None);
|
||||
|
||||
D_PIXMAP(("paste_simage(0x%08x, %s, 0x%08x, %hd, %hd, %hd, %hd) called.\n", (int) simg, get_image_type(which), (int) win, x, y, w, h));
|
||||
|
||||
if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO)) {
|
||||
char buff[255], *iclass = NULL, *state = NULL, *reply;
|
||||
Pixmap pmap, mask;
|
||||
|
||||
switch (which) {
|
||||
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 = "ETERM_TROUGH"; break;
|
||||
case image_sa: iclass = "ETERM_ANCHOR"; break;
|
||||
# endif
|
||||
case image_menu: iclass = "ETERM_MENU_ITEM"; break;
|
||||
case image_submenu: iclass = "ETERM_MENU_SUBMENU"; break;
|
||||
default: break;
|
||||
}
|
||||
if (simg == images[which].selected) {
|
||||
state = "hilited";
|
||||
} else if (simg == images[which].clicked) {
|
||||
state = "clicked";
|
||||
} else {
|
||||
state = "normal";
|
||||
}
|
||||
D_PIXMAP((" -> iclass == \"%s\", state == \"%s\"\n", NONULL(iclass), NONULL(state)));
|
||||
|
||||
if (iclass) {
|
||||
snprintf(buff, sizeof(buff), "imageclass %s query", iclass);
|
||||
enl_ipc_send(buff);
|
||||
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_copy 0x%x %s %hd %hd", iclass, (int) win, state, w, h);
|
||||
enl_ipc_send(buff);
|
||||
for (; !(reply = enl_ipc_get(enl_wait_for_reply())););
|
||||
if (strstr(reply, "Error")) {
|
||||
print_error("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
|
||||
if (image_mode_is(which, ALLOW_IMAGE)) {
|
||||
image_set_mode(which, MODE_IMAGE);
|
||||
} else {
|
||||
image_set_mode(which, MODE_SOLID);
|
||||
}
|
||||
} else {
|
||||
GC gc;
|
||||
XGCValues gcvalues;
|
||||
|
||||
gc = XCreateGC(Xdisplay, win, 0, &gcvalues);
|
||||
pmap = (Pixmap) strtoul(reply, (char **) NULL, 0);
|
||||
mask = (Pixmap) strtoul(PWord(2, reply), (char **) NULL, 0);
|
||||
if (pmap) {
|
||||
if (mask) {
|
||||
shaped_window_apply_mask(pmap, mask);
|
||||
}
|
||||
XCopyArea(Xdisplay, pmap, win, gc, 0, 0, w, h, x, y);
|
||||
XFreePixmap(Xdisplay, pmap);
|
||||
XFreePixmap(Xdisplay, mask);
|
||||
XFreeGC(Xdisplay, gc);
|
||||
return;
|
||||
} else {
|
||||
print_error("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
|
||||
if (image_mode_is(which, ALLOW_IMAGE)) {
|
||||
image_set_mode(which, MODE_IMAGE);
|
||||
} else {
|
||||
image_set_mode(which, MODE_SOLID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (image_mode_is(which, MODE_IMAGE) && image_mode_is(which, ALLOW_IMAGE)) {
|
||||
if (simg->iml->border) {
|
||||
Imlib_set_image_border(imlib_id, simg->iml->im, simg->iml->border);
|
||||
}
|
||||
|
@ -335,6 +419,7 @@ paste_simage(simage_t * simg, Window win, unsigned short x, unsigned short y, un
|
|||
Imlib_set_image_blue_modifier(imlib_id, simg->iml->im, simg->iml->bmod);
|
||||
}
|
||||
Imlib_paste_image(imlib_id, simg->iml->im, win, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -411,7 +496,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
|
|||
gc = XCreateGC(Xdisplay, win, GCForeground | GCBackground, &gcvalue);
|
||||
pixmap = simg->pmap->pixmap; /* Save this for later */
|
||||
|
||||
if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO) && (which != image_bg)) {
|
||||
if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO)) {
|
||||
char buff[255], *iclass = NULL, *state = NULL, *reply;
|
||||
|
||||
switch (which) {
|
||||
|
@ -1144,14 +1229,14 @@ get_desktop_pixmap(void)
|
|||
# endif /* PIXMAP_OFFSET */
|
||||
|
||||
void
|
||||
shaped_window_apply_mask(Window win, Pixmap mask)
|
||||
shaped_window_apply_mask(Drawable d, Pixmap mask)
|
||||
{
|
||||
|
||||
static signed char have_shape = -1;
|
||||
|
||||
REQUIRE(win != None && mask != None);
|
||||
REQUIRE(d != None && mask != None);
|
||||
|
||||
D_PIXMAP(("shaped_window_apply_mask(win [0x%08x], mask [0x%08x]) called.\n", win, mask));
|
||||
D_PIXMAP(("shaped_window_apply_mask(d [0x%08x], mask [0x%08x]) called.\n", d, mask));
|
||||
|
||||
# ifdef HAVE_X_SHAPE_EXT
|
||||
if (have_shape == -1) { /* Don't know yet. */
|
||||
|
@ -1166,7 +1251,7 @@ shaped_window_apply_mask(Window win, Pixmap mask)
|
|||
}
|
||||
if (have_shape == 1) {
|
||||
D_PIXMAP(("shaped_window_apply_mask(): Shape extension available, applying mask.\n"));
|
||||
XShapeCombineMask(Xdisplay, win, ShapeBounding, 0, 0, mask, ShapeSet);
|
||||
XShapeCombineMask(Xdisplay, d, ShapeBounding, 0, 0, mask, ShapeSet);
|
||||
} else if (have_shape == 0) {
|
||||
D_PIXMAP(("shaped_window_apply_mask(): Shape extension not available.\n"));
|
||||
return;
|
||||
|
|
|
@ -160,7 +160,7 @@ extern const char *get_image_type(unsigned short);
|
|||
extern unsigned short parse_pixmap_ops(char *);
|
||||
extern unsigned short set_pixmap_scale(const char *, pixmap_t *);
|
||||
extern void reset_simage(simage_t *, unsigned long);
|
||||
extern void paste_simage(simage_t *, Window, unsigned short, unsigned short, unsigned short, unsigned short);
|
||||
extern void paste_simage(simage_t *, unsigned char, Window, unsigned short, unsigned short, unsigned short, unsigned short);
|
||||
extern void redraw_image(unsigned char);
|
||||
extern void render_simage(simage_t *, Window, unsigned short, unsigned short, unsigned char, renderop_t);
|
||||
#ifdef USE_POSIX_THREADS
|
||||
|
@ -175,7 +175,7 @@ extern void colormod_trans(Pixmap, GC, unsigned short, unsigned short);
|
|||
extern Window get_desktop_window(void);
|
||||
extern Pixmap get_desktop_pixmap(void);
|
||||
#endif
|
||||
extern void shaped_window_apply_mask(Window, Pixmap);
|
||||
extern void shaped_window_apply_mask(Drawable, Pixmap);
|
||||
extern void set_icon_pixmap(char *, XWMHints *);
|
||||
#ifdef USE_EFFECTS
|
||||
extern int fade_in(ImlibImage *, int);
|
||||
|
|
Loading…
Reference in New Issue