Thu Oct 28 13:12:17 PDT 1999 Michael Jennings <mej@eterm.org>

I fixed the popup scrollbar bug with transparency, but I fixed lots
	more than that.  I removed a lot of duplicate event handling, lots of
	duplicate redraws, and lots of unnecessary transparency updates.  In
	doing so, I fixed the latency problem people had been reporting with
	several shaded/tinted transparent Eterms while changing desktops.  I
	also threw solid color transparency support in the mix while I was at
	it.  All in all, you should notice significant speedups in transparent
	Eterms.


SVN revision: 1031
This commit is contained in:
Michael Jennings 1999-10-28 14:02:35 +00:00
parent 5c930667ec
commit c554f5917e
12 changed files with 224 additions and 122 deletions

View File

@ -2651,3 +2651,15 @@ Wed Oct 27 18:46:04 PDT 1999 Michael Jennings <mej@eterm.org>
which I can do much about. :-) which I can do much about. :-)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Thu Oct 28 13:12:17 PDT 1999 Michael Jennings <mej@eterm.org>
I fixed the popup scrollbar bug with transparency, but I fixed lots
more than that. I removed a lot of duplicate event handling, lots of
duplicate redraws, and lots of unnecessary transparency updates. In
doing so, I fixed the latency problem people had been reporting with
several shaded/tinted transparent Eterms while changing desktops. I
also threw solid color transparency support in the mix while I was at
it. All in all, you should notice significant speedups in transparent
Eterms.
-------------------------------------------------------------------------------

View File

@ -44,6 +44,7 @@ static const char cvs_ident[] = "$Id$";
#include "command.h" #include "command.h"
#include "e.h" #include "e.h"
#include "events.h" #include "events.h"
#include "font.h"
#include "menus.h" #include "menus.h"
#include "options.h" #include "options.h"
#include "pixmap.h" #include "pixmap.h"
@ -226,6 +227,8 @@ handle_property_notify(event_t * ev)
{ {
Atom prop; Atom prop;
Window win;
Pixmap pmap;
D_EVENTS(("handle_property_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); D_EVENTS(("handle_property_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
@ -234,14 +237,22 @@ handle_property_notify(event_t * ev)
prop = XInternAtom(Xdisplay, "_WIN_WORKSPACE", True); prop = XInternAtom(Xdisplay, "_WIN_WORKSPACE", True);
D_EVENTS(("handle_property_notify(): On %s. prop == 0x%08x, ev->xproperty.atom == 0x%08x\n", ((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) prop, (int) ev->xproperty.atom)); D_EVENTS(("handle_property_notify(): On %s. prop == 0x%08x, ev->xproperty.atom == 0x%08x\n", ((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) prop, (int) ev->xproperty.atom));
if (ev->xproperty.atom == prop) { if (ev->xproperty.atom == prop) {
if (desktop_pixmap != None) { win = get_desktop_window();
free_desktop_pixmap(); if (win == (Window) 1) {
/* The desktop window is unchanged. Ignore this event. */
return 1;
} }
desktop_window = get_desktop_window(); /* The desktop window has changed somehow. */
if (desktop_window == None) { if (desktop_window == None) {
free_desktop_pixmap();
FOREACH_IMAGE(if (image_mode_is(idx, MODE_TRANS)) {image_set_mode(idx, MODE_IMAGE); image_allow_mode(idx, ALLOW_IMAGE);}); FOREACH_IMAGE(if (image_mode_is(idx, MODE_TRANS)) {image_set_mode(idx, MODE_IMAGE); image_allow_mode(idx, ALLOW_IMAGE);});
return 1; return 1;
} }
pmap = get_desktop_pixmap();
if (pmap == (Pixmap) 1) {
/* Pixmap is unchanged */
return 1;
}
redraw_all_images(); redraw_all_images();
return 1; return 1;
} }
@ -250,8 +261,10 @@ handle_property_notify(event_t * ev)
prop = XInternAtom(Xdisplay, "_XROOTPMAP_ID", True); prop = XInternAtom(Xdisplay, "_XROOTPMAP_ID", True);
D_EVENTS(("handle_property_notify(): On desktop_window [0x%08x]. prop == 0x%08x, ev->xproperty.atom == 0x%08x\n", (int) desktop_window, (int) prop, (int) ev->xproperty.atom)); D_EVENTS(("handle_property_notify(): On desktop_window [0x%08x]. prop == 0x%08x, ev->xproperty.atom == 0x%08x\n", (int) desktop_window, (int) prop, (int) ev->xproperty.atom));
if (ev->xproperty.atom == prop) { if (ev->xproperty.atom == prop) {
if (desktop_pixmap != None) { pmap = get_desktop_pixmap();
free_desktop_pixmap(); if (pmap == (Pixmap) 1) {
/* Pixmap is unchanged */
return 1;
} }
redraw_all_images(); redraw_all_images();
return 1; return 1;
@ -314,7 +327,7 @@ handle_client_message(event_t * ev)
return 1; return 1;
} }
#endif /* OFFIX_DND */ #endif /* OFFIX_DND */
return 0; return 1;
} }
unsigned char unsigned char
@ -372,7 +385,7 @@ handle_focus_in(event_t * ev)
XSetICFocus(Input_Context); XSetICFocus(Input_Context);
#endif #endif
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -396,7 +409,7 @@ handle_focus_out(event_t * ev)
XUnsetICFocus(Input_Context); XUnsetICFocus(Input_Context);
#endif #endif
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -409,11 +422,34 @@ handle_configure_notify(event_t * ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, ConfigureNotify, &unused_xevent)); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, ConfigureNotify, &unused_xevent));
handle_external_resize(); if (ev->xany.window == TermWin.parent) {
int x = ev->xconfigurerequest.x, y = ev->xconfigurerequest.y;
unsigned int width = ev->xconfigurerequest.width, height = ev->xconfigurerequest.height;
D_EVENTS((" -> TermWin.parent is %ldx%ld at (%d, %d). TermWin.x == %hd, TermWin.y == %hd\n",
width, height, x, y, TermWin.x, TermWin.y));
/* If the font change count is non-zero, this event is telling us we resized ourselves. */
if (font_change_count > 0) {
font_change_count--;
}
if ((width != (unsigned int) szHint.width) || (height != (unsigned int) szHint.height)) {
/* We were resized externally. Handle the resize. */
D_EVENTS((" -> External resize detected.\n"));
handle_resize(width, height);
#ifdef USE_XIM #ifdef USE_XIM
xim_set_status_position(); xim_set_status_position();
#endif #endif
return 0; /* A resize requires the additional handling of a move */
handle_move(x, y);
} else if ((x != TermWin.x) || (y != TermWin.y)) {
/* There was an external move, but no resize. Handle the move. */
D_EVENTS((" -> External move detected.\n"));
handle_move(x, y);
} else {
D_EVENTS((" -> Bogus ConfigureNotify detected, ignoring.\n"));
}
}
return 1;
} }
unsigned char unsigned char
@ -474,12 +510,14 @@ handle_expose(event_t * ev)
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, Expose, &unused_xevent)); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, Expose, &unused_xevent));
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent)); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent));
} }
#if 0
if (desktop_window != None) { if (desktop_window != None) {
XSelectInput(Xdisplay, desktop_window, PropertyChangeMask); XSelectInput(Xdisplay, desktop_window, PropertyChangeMask);
} }
#endif
P_SETTIMEVAL(expose_stop); P_SETTIMEVAL(expose_stop);
P_EVENT_TIME("Expose", expose_start, expose_stop); P_EVENT_TIME("Expose", expose_start, expose_stop);
return 0; return 1;
} }
unsigned char unsigned char
@ -643,7 +681,7 @@ handle_motion_notify(event_t * ev)
P_EVENT_TIME("MotionNotify", motion_start, motion_stop); P_EVENT_TIME("MotionNotify", motion_start, motion_stop);
return 1; return 1;
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -654,7 +692,9 @@ process_x_event(event_t * ev)
#endif #endif
COUNT_EVENT(event_cnt); COUNT_EVENT(event_cnt);
#if 0
D_EVENTS(("process_x_event(ev [%8p] %s on window 0x%08x)\n", ev, event_type_to_name(ev->xany.type), ev->xany.window)); D_EVENTS(("process_x_event(ev [%8p] %s on window 0x%08x)\n", ev, event_type_to_name(ev->xany.type), ev->xany.window));
#endif
if (primary_data.handlers[ev->type] != NULL) { if (primary_data.handlers[ev->type] != NULL) {
return ((primary_data.handlers[ev->type]) (ev)); return ((primary_data.handlers[ev->type]) (ev));
} }

View File

@ -224,6 +224,7 @@ menu_handle_expose(event_t * ev)
{ {
XEvent unused_xevent; XEvent unused_xevent;
menu_t *menu;
D_EVENTS(("menu_handle_expose(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); D_EVENTS(("menu_handle_expose(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
@ -231,7 +232,10 @@ menu_handle_expose(event_t * ev)
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, Expose, &unused_xevent)); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, Expose, &unused_xevent));
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent)); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent));
return 0; if ((menu = find_menu_by_window(menu_list, ev->xany.window)) != NULL) {
menu_draw(menu);
}
return 1;
} }
unsigned char unsigned char

View File

@ -120,6 +120,15 @@ get_image_type(unsigned short type)
return (""); return ("");
} }
unsigned char
image_mode_any(unsigned char mode)
{
unsigned char ismode = 0;
FOREACH_IMAGE(if (image_mode_is(idx, mode)) ismode=1;);
return ismode;
}
unsigned short unsigned short
parse_pixmap_ops(char *str) parse_pixmap_ops(char *str)
{ {
@ -557,7 +566,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
return; return;
} }
if (desktop_pixmap == None) { if (desktop_pixmap == None) {
desktop_pixmap = get_desktop_pixmap(); get_desktop_pixmap();
last_x = last_y = -1; last_x = last_y = -1;
if (desktop_pixmap != None && need_colormod()) { if (desktop_pixmap != None && need_colormod()) {
pixmap = desktop_pixmap; pixmap = desktop_pixmap;
@ -972,17 +981,6 @@ load_image(const char *file, short type)
return 0; return 0;
} }
void
free_desktop_pixmap(void)
{
if (desktop_pixmap_is_mine) {
XFreePixmap(Xdisplay, desktop_pixmap);
desktop_pixmap_is_mine = 0;
}
desktop_pixmap = None;
}
# ifdef PIXMAP_OFFSET # ifdef PIXMAP_OFFSET
# define MOD_IS_SET(mod) ((mod) && ((mod)->brightness != 0xff || (mod)->contrast != 0xff || (mod)->gamma != 0xff)) # define MOD_IS_SET(mod) ((mod) && ((mod)->brightness != 0xff || (mod)->contrast != 0xff || (mod)->gamma != 0xff))
@ -1179,7 +1177,11 @@ get_desktop_window(void)
if (w != Xroot) { if (w != Xroot) {
XSelectInput(Xdisplay, w, PropertyChangeMask); XSelectInput(Xdisplay, w, PropertyChangeMask);
} }
return (desktop_window = w); if (desktop_window == w) {
return ((Window) 1);
} else {
return (desktop_window = w);
}
} }
} }
@ -1195,37 +1197,77 @@ get_desktop_pixmap(void)
Pixmap p; Pixmap p;
Atom prop, type, prop2; Atom prop, type, prop2;
int format; int format;
static Pixmap color_pixmap = None;
unsigned long length, after; unsigned long length, after;
unsigned char *data; unsigned char *data;
if (desktop_window == None) if (desktop_window == None) {
return None; free_desktop_pixmap();
return (desktop_pixmap = None);
}
prop = XInternAtom(Xdisplay, "_XROOTPMAP_ID", True); prop = XInternAtom(Xdisplay, "_XROOTPMAP_ID", True);
prop2 = XInternAtom(Xdisplay, "_XROOTCOLOR_PIXEL", True); prop2 = XInternAtom(Xdisplay, "_XROOTCOLOR_PIXEL", True);
if (prop == None && prop2 == None) { if (prop == None && prop2 == None) {
return None; free_desktop_pixmap();
return (desktop_pixmap = None);
} }
if (prop != None) { if (prop != None) {
XGetWindowProperty(Xdisplay, desktop_window, prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data); XGetWindowProperty(Xdisplay, desktop_window, prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
if (type == XA_PIXMAP) { if (type == XA_PIXMAP) {
p = *((Pixmap *) data); p = *((Pixmap *) data);
D_PIXMAP((" Found pixmap 0x%08x\n", p)); if (p != None) {
return p; D_PIXMAP((" Found pixmap 0x%08x\n", p));
if (desktop_pixmap == p) {
return ((Pixmap) 1);
} else {
free_desktop_pixmap();
return (desktop_pixmap = p);
}
}
} }
} }
if (prop2 != None) { if (prop2 != None) {
XGetWindowProperty(Xdisplay, desktop_window, prop2, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data); XGetWindowProperty(Xdisplay, desktop_window, prop2, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
if (type == XA_CARDINAL) { if (type == XA_CARDINAL) {
D_PIXMAP((" Solid color not yet supported.\n"));
return None; XGCValues gcvalue;
GC gc;
Pixel pix;
free_desktop_pixmap();
pix = *((Pixel *) data);
D_PIXMAP((" Found solid color 0x%08x\n", pix));
gcvalue.foreground = pix;
gcvalue.background = pix;
gc = XCreateGC(Xdisplay, TermWin.vt, GCForeground | GCBackground, &gcvalue);
if (color_pixmap != None) {
XFreePixmap(Xdisplay, color_pixmap);
}
color_pixmap = XCreatePixmap(Xdisplay, TermWin.vt, 16, 16, Xdepth);
XFillRectangle(Xdisplay, color_pixmap, gc, 0, 0, 16, 16);
return (desktop_pixmap = color_pixmap);
} }
} }
D_PIXMAP(("No suitable attribute found.\n")); D_PIXMAP(("No suitable attribute found.\n"));
return None; free_desktop_pixmap();
return (desktop_pixmap = None);
} }
void
free_desktop_pixmap(void)
{
if (desktop_pixmap_is_mine && desktop_pixmap != None) {
XFreePixmap(Xdisplay, desktop_pixmap);
desktop_pixmap_is_mine = 0;
}
desktop_pixmap = None;
}
# endif /* PIXMAP_OFFSET */ # endif /* PIXMAP_OFFSET */
void void

View File

@ -94,13 +94,13 @@ enum {
/* Helper macros */ /* Helper macros */
#define FOREACH_IMAGE(x) do {unsigned char idx; for (idx = 0; idx < image_max; idx++) { x } } while (0) #define FOREACH_IMAGE(x) do {unsigned char idx; for (idx = 0; idx < image_max; idx++) { x } } while (0)
#define redraw_all_images() do {render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); \
scr_touch(); scrollbar_show(0); enl_ipc_sync();} while (0)
#define image_set_mode(which, bit) do {images[which].mode &= ~(MODE_MASK); images[which].mode |= (bit);} while (0) #define image_set_mode(which, bit) do {images[which].mode &= ~(MODE_MASK); images[which].mode |= (bit);} while (0)
#define image_allow_mode(which, bit) (images[which].mode |= (bit)) #define image_allow_mode(which, bit) (images[which].mode |= (bit))
#define image_disallow_mode(which, bit) (images[which].mode &= ~(bit)) #define image_disallow_mode(which, bit) (images[which].mode &= ~(bit))
#define image_mode_is(which, bit) (images[which].mode & (bit)) #define image_mode_is(which, bit) (images[which].mode & (bit))
#define image_mode_fallback(which) do {if (image_mode_is((which), ALLOW_IMAGE)) {image_set_mode((which), MODE_IMAGE);} else {image_set_mode((which), MODE_SOLID);}} while (0) #define image_mode_fallback(which) do {if (image_mode_is((which), ALLOW_IMAGE)) {image_set_mode((which), MODE_IMAGE);} else {image_set_mode((which), MODE_SOLID);}} while (0)
#define redraw_all_images() do {render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); \
scr_touch(); scrollbar_show(0); if (image_mode_any(MODE_AUTO)) enl_ipc_sync();} while (0)
/* Elements of an simage to be reset */ /* Elements of an simage to be reset */
#define RESET_NONE (0UL) #define RESET_NONE (0UL)
@ -158,6 +158,7 @@ extern Window desktop_window;
_XFUNCPROTOBEGIN _XFUNCPROTOBEGIN
extern const char *get_image_type(unsigned short); extern const char *get_image_type(unsigned short);
extern unsigned char image_mode_any(unsigned char);
extern unsigned short parse_pixmap_ops(char *); extern unsigned short parse_pixmap_ops(char *);
extern unsigned short set_pixmap_scale(const char *, pixmap_t *); extern unsigned short set_pixmap_scale(const char *, pixmap_t *);
extern unsigned char check_image_ipc(unsigned char); extern unsigned char check_image_ipc(unsigned char);

View File

@ -108,26 +108,25 @@ Draw_up_button(int x, int y, int state)
pt[1].x = x + sz2 - 1; pt[1].x = x + sz2 - 1;
pt[1].y = y; pt[1].y = y;
XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# if (SHADOW > 1) if (scrollbar_get_shadow() > 1) {
/* doubled */ pt[0].x++;
pt[0].x++; pt[0].y--;
pt[0].y--; pt[1].y++;
pt[1].y++; XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); }
# endif
/* draw shadow */ /* draw shadow */
pt[0].x = x + sz2; pt[0].x = x + sz2;
pt[0].y = y; pt[0].y = y;
pt[1].x = x + sz - 1; pt[1].x = x + sz - 1;
pt[1].y = y + sz - 1; pt[1].y = y + sz - 1;
XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# if (SHADOW > 1) if (scrollbar_get_shadow() > 1) {
/* doubled */ /* doubled */
pt[0].y++; pt[0].y++;
pt[1].x--; pt[1].x--;
pt[1].y--; pt[1].y--;
XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# endif }
} }
/* draw triangular down button with a shadow of SHADOW (1 or 2) pixels */ /* draw triangular down button with a shadow of SHADOW (1 or 2) pixels */
@ -172,26 +171,26 @@ Draw_dn_button(int x, int y, int state)
pt[1].x = x + sz2 - 1; pt[1].x = x + sz2 - 1;
pt[1].y = y + sz - 1; pt[1].y = y + sz - 1;
XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# if (SHADOW > 1) if (scrollbar_get_shadow() > 1) {
/* doubled */ /* doubled */
pt[0].x++; pt[0].x++;
pt[0].y++; pt[0].y++;
pt[1].y--; pt[1].y--;
XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# endif }
/* draw shadow */ /* draw shadow */
pt[0].x = x + sz2; pt[0].x = x + sz2;
pt[0].y = y + sz - 1; pt[0].y = y + sz - 1;
pt[1].x = x + sz - 1; pt[1].x = x + sz - 1;
pt[1].y = y; pt[1].y = y;
XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# if (SHADOW > 1) if (scrollbar_get_shadow() > 1) {
/* doubled */ /* doubled */
pt[0].y--; pt[0].y--;
pt[1].x--; pt[1].x--;
pt[1].y++; pt[1].y++;
XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); XDrawLine(Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
# endif }
} }
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */ #endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */
@ -233,6 +232,11 @@ scrollbar_init(void)
} }
#endif #endif
if (scrollBar.type == SCROLLBAR_XTERM) {
scrollbar_set_shadow(0);
} else {
scrollbar_set_shadow((Options & Opt_scrollBar_floating) ? 0 : SHADOW);
}
event_register_dispatcher(scrollbar_dispatch_event, scrollbar_event_init_dispatcher); event_register_dispatcher(scrollbar_dispatch_event, scrollbar_event_init_dispatcher);
} }
@ -243,7 +247,9 @@ scrollbar_event_init_dispatcher(void)
MEMSET(&scrollbar_event_data, 0, sizeof(event_dispatcher_data_t)); MEMSET(&scrollbar_event_data, 0, sizeof(event_dispatcher_data_t));
#if 0
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, ConfigureNotify, sb_handle_configure_notify); EVENT_DATA_ADD_HANDLER(scrollbar_event_data, ConfigureNotify, sb_handle_configure_notify);
#endif
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, EnterNotify, sb_handle_enter_notify); EVENT_DATA_ADD_HANDLER(scrollbar_event_data, EnterNotify, sb_handle_enter_notify);
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, LeaveNotify, sb_handle_leave_notify); EVENT_DATA_ADD_HANDLER(scrollbar_event_data, LeaveNotify, sb_handle_leave_notify);
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, FocusIn, sb_handle_focus_in); EVENT_DATA_ADD_HANDLER(scrollbar_event_data, FocusIn, sb_handle_focus_in);
@ -268,6 +274,7 @@ scrollbar_event_init_dispatcher(void)
} }
#if 0
unsigned char unsigned char
sb_handle_configure_notify(event_t * ev) sb_handle_configure_notify(event_t * ev)
{ {
@ -277,8 +284,9 @@ sb_handle_configure_notify(event_t * ev)
REQUIRE_RVAL(XEVENT_IS_PARENT(ev, &scrollbar_event_data), 0); REQUIRE_RVAL(XEVENT_IS_PARENT(ev, &scrollbar_event_data), 0);
redraw_image(image_sb); redraw_image(image_sb);
return 0; return 1;
} }
#endif
unsigned char unsigned char
sb_handle_enter_notify(event_t * ev) sb_handle_enter_notify(event_t * ev)
@ -304,7 +312,7 @@ sb_handle_enter_notify(event_t * ev)
images[image_sb].current = images[image_sb].selected; images[image_sb].current = images[image_sb].selected;
render_simage(images[image_sb].current, scrollbar_get_win(), scrollbar_trough_width(), scrollbar_trough_height(), image_sb, 0); render_simage(images[image_sb].current, scrollbar_get_win(), scrollbar_trough_width(), scrollbar_trough_height(), image_sb, 0);
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -331,7 +339,7 @@ sb_handle_leave_notify(event_t * ev)
images[image_sb].current = images[image_sb].norm; images[image_sb].current = images[image_sb].norm;
render_simage(images[image_sb].current, scrollbar_get_win(), scrollbar_trough_width(), scrollbar_trough_height(), image_sb, 0); render_simage(images[image_sb].current, scrollbar_get_win(), scrollbar_trough_width(), scrollbar_trough_height(), image_sb, 0);
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -342,7 +350,7 @@ sb_handle_focus_in(event_t * ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);
return 0; return 1;
} }
unsigned char unsigned char
@ -353,7 +361,7 @@ sb_handle_focus_out(event_t * ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);
return 0; return 1;
} }
unsigned char unsigned char
@ -371,7 +379,7 @@ sb_handle_expose(event_t * ev)
if (scrollbar_win_is_scrollbar(ev->xany.window)) { if (scrollbar_win_is_scrollbar(ev->xany.window)) {
scrollbar_show(0); scrollbar_show(0);
} }
return 0; return 1;
} }
unsigned char unsigned char
@ -663,11 +671,6 @@ scrollbar_reset(void)
} }
#endif #endif
last_top = last_bot = 0; last_top = last_bot = 0;
if (scrollBar.type == SCROLLBAR_XTERM) {
scrollbar_set_shadow(0);
} else {
scrollbar_set_shadow((Options & Opt_scrollBar_floating) ? 0 : SHADOW);
}
scrollBar.init = 0; scrollBar.init = 0;
} }
@ -697,6 +700,7 @@ scrollbar_resize(int width, int height)
#endif #endif
width -= scrollbar_trough_width(); width -= scrollbar_trough_width();
XMoveResizeWindow(Xdisplay, scrollBar.win, ((Options & Opt_scrollBar_right) ? (width) : (0)), 0, scrollbar_trough_width(), height); XMoveResizeWindow(Xdisplay, scrollBar.win, ((Options & Opt_scrollBar_right) ? (width) : (0)), 0, scrollbar_trough_width(), height);
D_X11((" -> New scrollbar width/height == %lux%lu\n", scrollbar_trough_width(), height));
scrollBar.init = 0; scrollBar.init = 0;
scrollbar_show(0); scrollbar_show(0);
} }
@ -880,7 +884,7 @@ scrollbar_show(short mouseoffset)
} }
} }
if (image_mode_is(image_up, MODE_AUTO) || image_mode_is(image_down, MODE_AUTO) || image_mode_is(image_sb, MODE_AUTO) || image_mode_is(image_sa, MODE_AUTO)) { if (image_mode_is(image_up, MODE_AUTO) || image_mode_is(image_down, MODE_AUTO) || image_mode_is(image_sb, MODE_AUTO) || image_mode_is(image_sa, MODE_AUTO)) {
enl_ipc_sync(); // enl_ipc_sync();
} }
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */ #endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */

View File

@ -43,7 +43,7 @@
#define scrollbar_isMotion() (scrollBar.state == 'm') #define scrollbar_isMotion() (scrollBar.state == 'm')
#define scrollbar_isUp() (scrollBar.state == 'U') #define scrollbar_isUp() (scrollBar.state == 'U')
#define scrollbar_isDn() (scrollBar.state == 'D') #define scrollbar_isDn() (scrollBar.state == 'D')
#define scrollbar_isUpDn() isupper (scrollBar.state) #define scrollbar_isUpDn() (isupper(scrollBar.state))
#define scrollbar_setNone() do { D_SCROLLBAR(("scrollbar_setNone(): Cancelling motion.\n")); scrollBar.state = 1; } while (0) #define scrollbar_setNone() do { D_SCROLLBAR(("scrollbar_setNone(): Cancelling motion.\n")); scrollBar.state = 1; } while (0)
#define scrollbar_setMotion() do { D_SCROLLBAR(("scrollbar_setMotion()\n")); scrollBar.state = 'm'; } while (0) #define scrollbar_setMotion() do { D_SCROLLBAR(("scrollbar_setMotion()\n")); scrollBar.state = 'm'; } while (0)
#define scrollbar_setUp() do { D_SCROLLBAR(("scrollbar_setUp()\n")); scrollBar.state = 'U'; } while (0) #define scrollbar_setUp() do { D_SCROLLBAR(("scrollbar_setUp()\n")); scrollBar.state = 'U'; } while (0)
@ -55,10 +55,10 @@
# define scrollbar_win_is_uparrow(w) ((w) == scrollBar.up_win) # define scrollbar_win_is_uparrow(w) ((w) == scrollBar.up_win)
# define scrollbar_win_is_downarrow(w) ((w) == scrollBar.dn_win) # define scrollbar_win_is_downarrow(w) ((w) == scrollBar.dn_win)
# define scrollbar_win_is_anchor(w) ((w) == scrollBar.sa_win) # define scrollbar_win_is_anchor(w) ((w) == scrollBar.sa_win)
# define scrollbar_is_pixmapped() ((images[image_sb].current->iml->im) && (images[image_sb].mode & MODE_MASK)) # define scrollbar_is_pixmapped() (images[image_sb].mode & MODE_MASK)
# define scrollbar_uparrow_is_pixmapped() ((images[image_up].current->iml->im) && (images[image_up].mode & MODE_MASK)) # define scrollbar_uparrow_is_pixmapped() (images[image_up].mode & MODE_MASK)
# define scrollbar_downarrow_is_pixmapped() ((images[image_down].current->iml->im) && (images[image_down].mode & MODE_MASK)) # define scrollbar_downarrow_is_pixmapped() (images[image_down].mode & MODE_MASK)
# define scrollbar_anchor_is_pixmapped() ((images[image_sa].current->iml->im) && (images[image_sa].mode & MODE_MASK)) # define scrollbar_anchor_is_pixmapped() (images[image_sa].mode & MODE_MASK)
# define scrollbar_upButton(w, y) ( scrollbar_uparrow_is_pixmapped() ? scrollbar_win_is_uparrow(w) \ # define scrollbar_upButton(w, y) ( scrollbar_uparrow_is_pixmapped() ? scrollbar_win_is_uparrow(w) \
: ((scrollBar.type == SCROLLBAR_NEXT && (y) > scrollBar.end && (y) <= scrollbar_dn_loc()) \ : ((scrollBar.type == SCROLLBAR_NEXT && (y) > scrollBar.end && (y) <= scrollbar_dn_loc()) \
|| (scrollBar.type != SCROLLBAR_NEXT && (y) < scrollBar.beg))) || (scrollBar.type != SCROLLBAR_NEXT && (y) < scrollBar.beg)))
@ -102,7 +102,7 @@
: ((scrollBar.type == SCROLLBAR_NEXT) ? (scrollBar.end + scrollBar.width + 2) : (scrollBar.end + 1))) : ((scrollBar.type == SCROLLBAR_NEXT) ? (scrollBar.end + scrollBar.width + 2) : (scrollBar.end + 1)))
/* Scrollbar operations */ /* Scrollbar operations */
#define map_scrollbar(show) do {if (scrollbar_mapping(show)) {scr_touch(); parent_resize();} PrivMode(show, PrivMode_scrollBar); } while (0) #define map_scrollbar(show) do {PrivMode(show, PrivMode_scrollBar); if (scrollbar_mapping(show)) {scr_touch(); parent_resize();} } while (0)
#define scrollbar_get_shadow() (scrollBar.shadow) #define scrollbar_get_shadow() (scrollBar.shadow)
#define scrollbar_set_shadow(s) do { scrollBar.shadow = (s); } while (0) #define scrollbar_set_shadow(s) do { scrollBar.shadow = (s); } while (0)
#define scrollbar_get_win() (scrollBar.win) #define scrollbar_get_win() (scrollBar.win)

View File

@ -276,9 +276,7 @@ eterm_bootstrap(int argc, char *argv[])
D_CMD(("init_command()\n")); D_CMD(("init_command()\n"));
init_command(rs_execArgs); init_command(rs_execArgs);
if (Options & Opt_borderless) { parent_resize();
handle_external_resize();
}
main_loop(); main_loop();

View File

@ -94,24 +94,25 @@
/************ Structures ************/ /************ Structures ************/
typedef struct { typedef struct {
int internalBorder; /* Internal border size */ int internalBorder; /* Internal border size */
short width, height; /* window size [pixels] */ short x, y; /* TermWin.parent coordinates */
short fwidth, fheight; /* font width and height [pixels] */ short width, height; /* window size [pixels] */
short fprop; /* font is proportional */ short fwidth, fheight; /* font width and height [pixels] */
short ncol, nrow; /* window size [characters] */ short fprop; /* font is proportional */
short focus; /* window has focus */ short ncol, nrow; /* window size [characters] */
short saveLines; /* number of lines that fit in scrollback */ short focus; /* window has focus */
short nscrolled; /* number of line actually scrolled */ short saveLines; /* number of lines that fit in scrollback */
short view_start; /* scrollback view starts here */ short nscrolled; /* number of line actually scrolled */
Window parent, vt; /* parent (main) and vt100 window */ short view_start; /* scrollback view starts here */
GC gc; /* GC for drawing text */ Window parent, vt; /* parent (main) and vt100 window */
XFontStruct * font; /* main font structure */ GC gc; /* GC for drawing text */
XFontSet fontset; XFontStruct * font; /* main font structure */
XFontSet fontset;
# ifndef NO_BOLDFONT # ifndef NO_BOLDFONT
XFontStruct * boldFont; /* bold font */ XFontStruct * boldFont; /* bold font */
# endif # endif
# ifdef MULTI_CHARSET # ifdef MULTI_CHARSET
XFontStruct * mfont; /* multibyte font structure */ XFontStruct * mfont; /* multibyte font structure */
# endif # endif
} TermWin_t; } TermWin_t;

View File

@ -1728,7 +1728,6 @@ xterm_seq(int op, const char *str)
D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr)); D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr));
if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) { if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) {
free_desktop_pixmap(); free_desktop_pixmap();
desktop_pixmap = None; /* Force the re-read */
} }
if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) { if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
XFreePixmap(Xdisplay, viewport_pixmap); XFreePixmap(Xdisplay, viewport_pixmap);
@ -1797,14 +1796,12 @@ xterm_seq(int op, const char *str)
redraw_all_images(); redraw_all_images();
break; break;
case 3: case 3:
if (desktop_pixmap != None) {
free_desktop_pixmap();
}
get_desktop_window(); get_desktop_window();
if (desktop_window == None) { if (desktop_window == None) {
FOREACH_IMAGE(if (image_mode_is(idx, MODE_TRANS)) {image_set_mode(idx, MODE_IMAGE); image_allow_mode(idx, ALLOW_IMAGE);}); FOREACH_IMAGE(if (image_mode_is(idx, MODE_TRANS)) {image_set_mode(idx, MODE_IMAGE); image_allow_mode(idx, ALLOW_IMAGE);});
break; break;
} }
get_desktop_pixmap();
redraw_all_images(); redraw_all_images();
break; break;
#endif #endif

View File

@ -493,14 +493,18 @@ set_width(unsigned short width)
void void
update_size_hints(void) update_size_hints(void)
{ {
D_X11(("update_size_hints() called.\n"));
szHint.base_width = (2 * TermWin.internalBorder); szHint.base_width = (2 * TermWin.internalBorder);
szHint.base_height = (2 * TermWin.internalBorder); szHint.base_height = (2 * TermWin.internalBorder);
szHint.base_width += ((scrollbar_visible()) ? (scrollbar_trough_width()) : (0)); szHint.base_width += ((scrollbar_visible()) ? (scrollbar_trough_width()) : (0));
D_X11(("Size Hints: base width/height == %lux%lu\n", szHint.base_width, szHint.base_height));
szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_width = szHint.base_width + szHint.width_inc;
szHint.min_height = szHint.base_height + szHint.height_inc; szHint.min_height = szHint.base_height + szHint.height_inc;
szHint.width = szHint.base_width + TermWin.width; szHint.width = szHint.base_width + TermWin.width;
szHint.height = szHint.base_height + TermWin.height; szHint.height = szHint.base_height + TermWin.height;
D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n",
szHint.min_width, szHint.min_height, szHint.width, szHint.height));
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint); XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint);
@ -510,10 +514,11 @@ update_size_hints(void)
void void
term_resize(int width, int height) term_resize(int width, int height)
{ {
D_SCREEN(("term_resize(%d, %d)\n", width, height)); D_X11(("term_resize(%d, %d)\n", width, height));
TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.width = TermWin.ncol * TermWin.fwidth;
TermWin.height = TermWin.nrow * TermWin.fheight; TermWin.height = TermWin.nrow * TermWin.fheight;
XMoveResizeWindow(Xdisplay, TermWin.vt, ((Options & Opt_scrollBar_right) ? (0) : (scrollbar_trough_width())), 0, width, height + 1); D_X11((" -> New TermWin width/height == %lux%lu\n", TermWin.width, TermWin.height));
XMoveResizeWindow(Xdisplay, TermWin.vt, ((Options & Opt_scrollBar_right) ? (0) : ((scrollbar_visible()) ? (scrollbar_trough_width()) : (0))), 0, width, height + 1);
render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 1); render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 1);
if (image_mode_is(image_bg, MODE_AUTO)) { if (image_mode_is(image_bg, MODE_AUTO)) {
enl_ipc_sync(); enl_ipc_sync();
@ -524,8 +529,10 @@ term_resize(int width, int height)
void void
parent_resize(void) parent_resize(void)
{ {
D_X11(("parent_resize() called.\n"));
update_size_hints(); update_size_hints();
XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height); XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height);
D_X11((" -> New parent width/height == %lux%lu\n", szHint.width, szHint.height));
term_resize(szHint.width, szHint.height); term_resize(szHint.width, szHint.height);
scrollbar_resize(szHint.width, szHint.height); scrollbar_resize(szHint.width, szHint.height);
} }
@ -537,6 +544,7 @@ handle_resize(unsigned int width, unsigned int height)
int new_ncol = (width - szHint.base_width) / TermWin.fwidth; int new_ncol = (width - szHint.base_width) / TermWin.fwidth;
int new_nrow = (height - szHint.base_height) / TermWin.fheight; int new_nrow = (height - szHint.base_height) / TermWin.fheight;
D_EVENTS(("handle_resize(%u, %u)\n", width, height));
if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) { if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) {
int curr_screen = -1; int curr_screen = -1;
@ -556,29 +564,24 @@ handle_resize(unsigned int width, unsigned int height)
scr_change_screen(curr_screen); scr_change_screen(curr_screen);
} }
first_time = 0; first_time = 0;
} else if (image_mode_is(image_bg, MODE_TRANS) || image_mode_is(image_bg, MODE_VIEWPORT)) { }
#if 0
else if (image_mode_is(image_bg, MODE_TRANS) || image_mode_is(image_bg, MODE_VIEWPORT)) {
term_resize(width, height); term_resize(width, height);
scrollbar_resize(width, height); scrollbar_resize(width, height);
scr_touch(); scr_touch();
} }
#endif
} }
/* Handle configure notify events telling us we've been resized */
void void
handle_external_resize(void) handle_move(int x, int y)
{ {
Window root; if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) {
int x, y; redraw_all_images();
unsigned int border, depth, width, height;
/* If the font change count is non-zero, this event
is telling us we resized ourselves. Ignore it. */
if (font_change_count > 0) {
font_change_count--;
return;
} }
XGetGeometry(Xdisplay, TermWin.parent, &root, &x, &y, &width, &height, &border, &depth); TermWin.x = x;
handle_resize(width, height); TermWin.y = y;
} }
#ifdef XTERM_COLOR_CHANGE #ifdef XTERM_COLOR_CHANGE

View File

@ -51,7 +51,7 @@ extern void update_size_hints(void);
extern void term_resize(int, int); extern void term_resize(int, int);
extern void parent_resize(void); extern void parent_resize(void);
extern void handle_resize(unsigned int, unsigned int); extern void handle_resize(unsigned int, unsigned int);
extern void handle_external_resize(void); extern void handle_move(int, int);
#ifdef XTERM_COLOR_CHANGE #ifdef XTERM_COLOR_CHANGE
extern void set_window_color(int, const char *); extern void set_window_color(int, const char *);
#else #else