Fri Nov 19 16:55:22 PST 1999 Michael Jennings <mej@eterm.org>
Okay, I think I have everything back in working order. PLEASE test this thoroughly, as an awful lot has changed. Let me know what I broke. :) SVN revision: 1339
This commit is contained in:
parent
c6e3fdbac9
commit
eec575c1e3
|
@ -2807,3 +2807,10 @@ Thu Nov 18 21:47:02 PST 1999 Michael Jennings <mej@eterm.org>
|
||||||
efficient than before.
|
efficient than before.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Fri Nov 19 16:55:22 PST 1999 Michael Jennings <mej@eterm.org>
|
||||||
|
|
||||||
|
Okay, I think I have everything back in working order. PLEASE test
|
||||||
|
this thoroughly, as an awful lot has changed. Let me know what I
|
||||||
|
broke. :)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -158,7 +158,8 @@ static char *v_bufend; /* end of physical buffer */
|
||||||
static Atom DndProtocol, DndSelection;
|
static Atom DndProtocol, DndSelection;
|
||||||
#endif /* OFFIX_DND */
|
#endif /* OFFIX_DND */
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
XIC Input_Context = NULL; /* input context */
|
XIC xim_input_context = NULL; /* input context */
|
||||||
|
static XIMStyle xim_input_style = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Substitutes for missing system functions */
|
/* Substitutes for missing system functions */
|
||||||
|
@ -1745,21 +1746,23 @@ static void
|
||||||
xim_send_spot(void)
|
xim_send_spot(void)
|
||||||
{
|
{
|
||||||
XPoint spot;
|
XPoint spot;
|
||||||
|
static XPoint oldSpot = { -1, -1 };
|
||||||
XVaNestedList preedit_attr;
|
XVaNestedList preedit_attr;
|
||||||
XIMStyle input_style;
|
|
||||||
|
|
||||||
if (Input_Context == NULL) {
|
if (xim_input_context == NULL) {
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
|
|
||||||
if (!(input_style & XIMPreeditPosition)) {
|
if (xim_input_style & XIMPreeditPosition) {
|
||||||
return;
|
xim_get_position(&spot);
|
||||||
|
if (spot.x != oldSpot.x || spot.y != oldSpot.y) {
|
||||||
|
oldSpot.x = spot.x;
|
||||||
|
oldSpot.y = spot.y;
|
||||||
|
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
|
||||||
|
XSetICValues(xim_input_context, XNPreeditAttributes, preedit_attr, NULL);
|
||||||
|
XFree(preedit_attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xim_get_position(&spot);
|
|
||||||
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
|
|
||||||
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL);
|
|
||||||
XFree(preedit_attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1783,7 +1786,7 @@ xim_get_area(XRectangle *preedit_rect, XRectangle *status_rect,
|
||||||
static void
|
static void
|
||||||
xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data)
|
xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data)
|
||||||
{
|
{
|
||||||
Input_Context = NULL;
|
xim_input_context = NULL;
|
||||||
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
||||||
xim = NULL;
|
xim = NULL;
|
||||||
client_data = call_data = (XPointer) 0;
|
client_data = call_data = (XPointer) 0;
|
||||||
|
@ -1793,7 +1796,7 @@ static void
|
||||||
xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data)
|
xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data)
|
||||||
{
|
{
|
||||||
xim_real_init();
|
xim_real_init();
|
||||||
if (Input_Context) {
|
if (xim_input_context) {
|
||||||
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
||||||
}
|
}
|
||||||
display = NULL;
|
display = NULL;
|
||||||
|
@ -1807,7 +1810,6 @@ xim_real_init(void)
|
||||||
char *p, *s, buf[64], tmp[1024];
|
char *p, *s, buf[64], tmp[1024];
|
||||||
char *end, *next_s;
|
char *end, *next_s;
|
||||||
XIM xim = NULL;
|
XIM xim = NULL;
|
||||||
XIMStyle input_style = 0;
|
|
||||||
XIMStyles *xim_styles = NULL;
|
XIMStyles *xim_styles = NULL;
|
||||||
int found;
|
int found;
|
||||||
XPoint spot;
|
XPoint spot;
|
||||||
|
@ -1816,7 +1818,9 @@ xim_real_init(void)
|
||||||
XVaNestedList preedit_attr = NULL;
|
XVaNestedList preedit_attr = NULL;
|
||||||
XVaNestedList status_attr = NULL;
|
XVaNestedList status_attr = NULL;
|
||||||
|
|
||||||
REQUIRE_RVAL(Input_Context == NULL, -1);
|
REQUIRE_RVAL(xim_input_context == NULL, -1);
|
||||||
|
|
||||||
|
xim_input_style = 0;
|
||||||
|
|
||||||
if (rs_input_method && *rs_input_method) {
|
if (rs_input_method && *rs_input_method) {
|
||||||
strncpy(tmp, rs_input_method, sizeof(tmp) - 1);
|
strncpy(tmp, rs_input_method, sizeof(tmp) - 1);
|
||||||
|
@ -1890,15 +1894,15 @@ xim_real_init(void)
|
||||||
*(end + 1) = '\0';
|
*(end + 1) = '\0';
|
||||||
|
|
||||||
if (!strcmp(s, "OverTheSpot")) {
|
if (!strcmp(s, "OverTheSpot")) {
|
||||||
input_style = (XIMPreeditPosition | XIMStatusNothing);
|
xim_input_style = (XIMPreeditPosition | XIMStatusNothing);
|
||||||
} else if (!strcmp(s, "OffTheSpot")) {
|
} else if (!strcmp(s, "OffTheSpot")) {
|
||||||
input_style = (XIMPreeditArea | XIMStatusArea);
|
xim_input_style = (XIMPreeditArea | XIMStatusArea);
|
||||||
} else if (!strcmp(s, "Root")) {
|
} else if (!strcmp(s, "Root")) {
|
||||||
input_style = (XIMPreeditNothing | XIMStatusNothing);
|
xim_input_style = (XIMPreeditNothing | XIMStatusNothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < xim_styles->count_styles; i++) {
|
for (i = 0; i < xim_styles->count_styles; i++) {
|
||||||
if (input_style == xim_styles->supported_styles[i]) {
|
if (xim_input_style == xim_styles->supported_styles[i]) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1911,18 +1915,19 @@ xim_real_init(void)
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((input_style != (XIMPreeditNothing | XIMStatusNothing)) && (input_style != (XIMPreeditArea | XIMStatusArea))
|
if ((xim_input_style != (XIMPreeditNothing | XIMStatusNothing))
|
||||||
&& (input_style != (XIMPreeditPosition | XIMStatusNothing))) {
|
&& (xim_input_style != (XIMPreeditArea | XIMStatusArea))
|
||||||
|
&& (xim_input_style != (XIMPreeditPosition | XIMStatusNothing))) {
|
||||||
print_error("This program does not support the preedit type");
|
print_error("This program does not support the preedit type");
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (input_style & XIMPreeditPosition) {
|
if (xim_input_style & XIMPreeditPosition) {
|
||||||
xim_set_size(&rect);
|
xim_set_size(&rect);
|
||||||
xim_get_position(&spot);
|
xim_get_position(&spot);
|
||||||
xim_set_color(&fg, &bg);
|
xim_set_color(&fg, &bg);
|
||||||
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
||||||
} else if (input_style & XIMPreeditArea) {
|
} else if (xim_input_style & XIMPreeditArea) {
|
||||||
xim_set_color(&fg, &bg);
|
xim_set_color(&fg, &bg);
|
||||||
/* The necessary width of preedit area is unknown until create input context. */
|
/* The necessary width of preedit area is unknown until create input context. */
|
||||||
needed_rect.width = 0;
|
needed_rect.width = 0;
|
||||||
|
@ -1930,16 +1935,16 @@ xim_real_init(void)
|
||||||
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
||||||
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
|
||||||
}
|
}
|
||||||
Input_Context = XCreateIC(xim, XNInputStyle, input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent,
|
xim_input_context = XCreateIC(xim, XNInputStyle, xim_input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent,
|
||||||
preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL);
|
preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL);
|
||||||
XFree(preedit_attr);
|
XFree(preedit_attr);
|
||||||
XFree(status_attr);
|
XFree(status_attr);
|
||||||
if (Input_Context == NULL) {
|
if (xim_input_context == NULL) {
|
||||||
print_error("Failed to create input context");
|
print_error("Failed to create input context");
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (input_style & XIMPreeditArea)
|
if (xim_input_style & XIMPreeditArea)
|
||||||
xim_set_status_position();
|
xim_set_status_position();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1947,25 +1952,22 @@ xim_real_init(void)
|
||||||
void
|
void
|
||||||
xim_set_status_position(void)
|
xim_set_status_position(void)
|
||||||
{
|
{
|
||||||
XIMStyle input_style;
|
|
||||||
XRectangle preedit_rect, status_rect, *needed_rect;
|
XRectangle preedit_rect, status_rect, *needed_rect;
|
||||||
XVaNestedList preedit_attr, status_attr;
|
XVaNestedList preedit_attr, status_attr;
|
||||||
|
|
||||||
REQUIRE(Input_Context != NULL);
|
REQUIRE(xim_input_context != NULL);
|
||||||
|
|
||||||
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
|
if (xim_input_style & XIMPreeditArea) {
|
||||||
|
|
||||||
if (input_style & XIMPreeditArea) {
|
|
||||||
/* Getting the necessary width of preedit area */
|
/* Getting the necessary width of preedit area */
|
||||||
status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL);
|
status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL);
|
||||||
XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL);
|
XGetICValues(xim_input_context, XNStatusAttributes, status_attr, NULL);
|
||||||
XFree(status_attr);
|
XFree(status_attr);
|
||||||
|
|
||||||
xim_get_area(&preedit_rect, &status_rect, needed_rect);
|
xim_get_area(&preedit_rect, &status_rect, needed_rect);
|
||||||
|
|
||||||
preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
|
preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
|
||||||
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
|
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
|
||||||
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
|
XSetICValues(xim_input_context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
|
||||||
XFree(preedit_attr);
|
XFree(preedit_attr);
|
||||||
XFree(status_attr);
|
XFree(status_attr);
|
||||||
}
|
}
|
||||||
|
@ -1973,18 +1975,15 @@ xim_set_status_position(void)
|
||||||
|
|
||||||
void xim_set_fontset(void)
|
void xim_set_fontset(void)
|
||||||
{
|
{
|
||||||
XIMStyle input_style;
|
|
||||||
XVaNestedList preedit_attr;
|
XVaNestedList preedit_attr;
|
||||||
XVaNestedList status_attr;
|
XVaNestedList status_attr;
|
||||||
|
|
||||||
REQUIRE(Input_Context != NULL);
|
REQUIRE(xim_input_context != NULL);
|
||||||
|
|
||||||
XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
|
if (xim_input_style & (XIMPreeditArea | XIMPreeditPosition)) {
|
||||||
|
|
||||||
if (input_style & (XIMPreeditArea | XIMPreeditPosition)) {
|
|
||||||
preedit_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
|
preedit_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
|
||||||
status_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
|
status_attr = XVaCreateNestedList(0, XNFontSet, TermWin.fontset, NULL);
|
||||||
XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
|
XSetICValues(xim_input_context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL);
|
||||||
XFree(preedit_attr);
|
XFree(preedit_attr);
|
||||||
XFree(status_attr);
|
XFree(status_attr);
|
||||||
}
|
}
|
||||||
|
@ -2407,7 +2406,7 @@ cmd_getc(void)
|
||||||
XNextEvent(Xdisplay, &ev);
|
XNextEvent(Xdisplay, &ev);
|
||||||
|
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
if (Input_Context != NULL) {
|
if (xim_input_context != NULL) {
|
||||||
if (!XFilterEvent(&ev, ev.xkey.window)) {
|
if (!XFilterEvent(&ev, ev.xkey.window)) {
|
||||||
event_dispatch(&ev);
|
event_dispatch(&ev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,7 @@ extern unsigned long PrivateModes;
|
||||||
extern Atom wmDeleteWindow;
|
extern Atom wmDeleteWindow;
|
||||||
extern int refresh_count, refresh_limit, refresh_type;
|
extern int refresh_count, refresh_limit, refresh_type;
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
extern XIC Input_Context; /* input context */
|
extern XIC xim_input_context; /* input context */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************ Function Prototypes ************/
|
/************ Function Prototypes ************/
|
||||||
|
|
|
@ -389,8 +389,8 @@ handle_focus_in(event_t * ev)
|
||||||
map_scrollbar(Options & Opt_scrollbar);
|
map_scrollbar(Options & Opt_scrollbar);
|
||||||
}
|
}
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
if (Input_Context != NULL)
|
if (xim_input_context != NULL)
|
||||||
XSetICFocus(Input_Context);
|
XSetICFocus(xim_input_context);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -413,8 +413,8 @@ handle_focus_out(event_t * ev)
|
||||||
map_scrollbar(0);
|
map_scrollbar(0);
|
||||||
}
|
}
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
if (Input_Context != NULL)
|
if (xim_input_context != NULL)
|
||||||
XUnsetICFocus(Input_Context);
|
XUnsetICFocus(xim_input_context);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -328,7 +328,7 @@ change_font(int init, const char *fontname)
|
||||||
TermWin.mfont = load_font(rs_mfont[idx], "k14", FONT_TYPE_X);
|
TermWin.mfont = load_font(rs_mfont[idx], "k14", FONT_TYPE_X);
|
||||||
}
|
}
|
||||||
# ifdef USE_XIM
|
# ifdef USE_XIM
|
||||||
if (Input_Context) {
|
if (xim_input_context) {
|
||||||
if (TermWin.fontset) {
|
if (TermWin.fontset) {
|
||||||
XFreeFontSet(Xdisplay, TermWin.fontset);
|
XFreeFontSet(Xdisplay, TermWin.fontset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,6 @@ static const char cvs_ident[] = "$Id$";
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#error This code is broken. Try back tomorrow.
|
|
||||||
|
|
||||||
event_dispatcher_data_t scrollbar_event_data;
|
event_dispatcher_data_t scrollbar_event_data;
|
||||||
scrollbar_t scrollbar = {
|
scrollbar_t scrollbar = {
|
||||||
None, None, None, None,
|
None, None, None, None,
|
||||||
|
@ -63,7 +61,7 @@ short scroll_arrow_delay;
|
||||||
static GC gc_scrollbar;
|
static GC gc_scrollbar;
|
||||||
static short last_top = 0, last_bot = 0;
|
static short last_top = 0, last_bot = 0;
|
||||||
#ifdef XTERM_SCROLLBAR
|
#ifdef XTERM_SCROLLBAR
|
||||||
static GC gc_stipple;
|
static GC gc_stipple, gc_border;
|
||||||
static unsigned char xterm_sb_bits[] = {0xaa, 0x0a, 0x55, 0x05}; /* 12x2 bitmap */
|
static unsigned char xterm_sb_bits[] = {0xaa, 0x0a, 0x55, 0x05}; /* 12x2 bitmap */
|
||||||
#endif
|
#endif
|
||||||
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
||||||
|
@ -239,6 +237,7 @@ sb_handle_button_press(event_t * ev)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (scrollbar_win_is_anchor(ev->xany.window)) {
|
if (scrollbar_win_is_anchor(ev->xany.window)) {
|
||||||
|
scrollbar_set_anchor_pressed(1);
|
||||||
scrollbar_draw_anchor(IMAGE_STATE_CLICKED, 0);
|
scrollbar_draw_anchor(IMAGE_STATE_CLICKED, 0);
|
||||||
}
|
}
|
||||||
switch (ev->xbutton.button) {
|
switch (ev->xbutton.button) {
|
||||||
|
@ -266,7 +265,6 @@ sb_handle_button_press(event_t * ev)
|
||||||
scrollbar_draw_trough(IMAGE_STATE_CLICKED, 0);
|
scrollbar_draw_trough(IMAGE_STATE_CLICKED, 0);
|
||||||
scr_page(DN, TermWin.nrow - 1);
|
scr_page(DN, TermWin.nrow - 1);
|
||||||
} else {
|
} else {
|
||||||
scrollbar_draw_anchor(IMAGE_STATE_CLICKED, 0);
|
|
||||||
scrollbar_set_motion(1);
|
scrollbar_set_motion(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,6 +298,7 @@ sb_handle_button_release(event_t * ev)
|
||||||
button_state.report_mode = (button_state.bypass_keystate ? 0 : ((PrivateModes & PrivMode_mouse_report) ? 1 : 0));
|
button_state.report_mode = (button_state.bypass_keystate ? 0 : ((PrivateModes & PrivMode_mouse_report) ? 1 : 0));
|
||||||
|
|
||||||
XQueryPointer(Xdisplay, scrollbar_get_win(), &root, &child, &root_x, &root_y, &win_x, &win_y, &mask);
|
XQueryPointer(Xdisplay, scrollbar_get_win(), &root, &child, &root_x, &root_y, &win_x, &win_y, &mask);
|
||||||
|
scrollbar_cancel_motion();
|
||||||
if (scrollbar_win_is_uparrow(child)) {
|
if (scrollbar_win_is_uparrow(child)) {
|
||||||
scrollbar_draw_uparrow(IMAGE_STATE_SELECTED, 0);
|
scrollbar_draw_uparrow(IMAGE_STATE_SELECTED, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -320,14 +319,6 @@ sb_handle_button_release(event_t * ev)
|
||||||
} else {
|
} else {
|
||||||
scrollbar_draw_trough(IMAGE_STATE_NORMAL, 0);
|
scrollbar_draw_trough(IMAGE_STATE_NORMAL, 0);
|
||||||
}
|
}
|
||||||
if (scrollbar_arrow_is_pressed()) {
|
|
||||||
if (scrollbar_uparrow_is_pressed()) {
|
|
||||||
scrollbar_set_uparrow_pressed(0);
|
|
||||||
} else {
|
|
||||||
scrollbar_set_downarrow_pressed(0);
|
|
||||||
}
|
|
||||||
scrollbar_set_motion(0);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,9 +380,11 @@ scrollbar_draw_uparrow(unsigned char image_state, unsigned char force_modes) {
|
||||||
if (!image_mode_is(image_up, MODE_MASK)) {
|
if (!image_mode_is(image_up, MODE_MASK)) {
|
||||||
/* Solid mode. Redraw every time since it's cheap. */
|
/* Solid mode. Redraw every time since it's cheap. */
|
||||||
XFillRectangle(Xdisplay, scrollbar.up_win, gc_scrollbar, 0, 0, scrollbar_arrow_width(), scrollbar_arrow_height());
|
XFillRectangle(Xdisplay, scrollbar.up_win, gc_scrollbar, 0, 0, scrollbar_arrow_width(), scrollbar_arrow_height());
|
||||||
if (scrollbar_uparrow_is_pressed()) {
|
if (image_state == IMAGE_STATE_CLICKED) {
|
||||||
|
scrollbar_set_uparrow_pressed(1);
|
||||||
draw_uparrow_clicked(scrollbar.up_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
draw_uparrow_clicked(scrollbar.up_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
||||||
} else {
|
} else {
|
||||||
|
scrollbar_set_uparrow_pressed(0);
|
||||||
draw_uparrow_raised(scrollbar.up_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
draw_uparrow_raised(scrollbar.up_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -444,9 +437,11 @@ scrollbar_draw_downarrow(unsigned char image_state, unsigned char force_modes) {
|
||||||
if (!image_mode_is(image_down, MODE_MASK)) {
|
if (!image_mode_is(image_down, MODE_MASK)) {
|
||||||
/* Solid mode. Redraw every time since it's cheap. */
|
/* Solid mode. Redraw every time since it's cheap. */
|
||||||
XFillRectangle(Xdisplay, scrollbar.dn_win, gc_scrollbar, 0, 0, scrollbar_arrow_width(), scrollbar_arrow_height());
|
XFillRectangle(Xdisplay, scrollbar.dn_win, gc_scrollbar, 0, 0, scrollbar_arrow_width(), scrollbar_arrow_height());
|
||||||
if (scrollbar_downarrow_is_pressed()) {
|
if (image_state == IMAGE_STATE_CLICKED) {
|
||||||
|
scrollbar_set_downarrow_pressed(1);
|
||||||
draw_downarrow_clicked(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
draw_downarrow_clicked(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
||||||
} else {
|
} else {
|
||||||
|
scrollbar_set_downarrow_pressed(0);
|
||||||
draw_downarrow_raised(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
draw_downarrow_raised(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -500,13 +495,20 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes) {
|
||||||
/* Solid mode. Redraw every time since it's cheap. */
|
/* Solid mode. Redraw every time since it's cheap. */
|
||||||
#ifdef XTERM_SCROLLBAR
|
#ifdef XTERM_SCROLLBAR
|
||||||
if (scrollbar.type == SCROLLBAR_XTERM) {
|
if (scrollbar.type == SCROLLBAR_XTERM) {
|
||||||
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_stipple, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height());
|
int x = ((Options & Opt_scrollbar_right) ? 1 : 0);
|
||||||
|
|
||||||
|
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_stipple, x + 1, 0, scrollbar_anchor_width() - x - 1, scrollbar_anchor_height());
|
||||||
|
XClearWindow(Xdisplay, scrollbar.sa_win);
|
||||||
}
|
}
|
||||||
#endif /* XTERM_SCROLLBAR */
|
#endif /* XTERM_SCROLLBAR */
|
||||||
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
||||||
if (scrollbar.type == SCROLLBAR_MOTIF || scrollbar.type == SCROLLBAR_NEXT) {
|
if (scrollbar.type == SCROLLBAR_MOTIF || scrollbar.type == SCROLLBAR_NEXT) {
|
||||||
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_scrollbar, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height());
|
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_scrollbar, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height());
|
||||||
draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow());
|
if (scrollbar_anchor_is_pressed()) {
|
||||||
|
draw_shadow(scrollbar.sa_win, gc_bottom, gc_top, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow());
|
||||||
|
} else {
|
||||||
|
draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -560,7 +562,7 @@ scrollbar_draw_trough(unsigned char image_state, unsigned char force_modes) {
|
||||||
}
|
}
|
||||||
if (!image_mode_is(image_sb, MODE_MASK)) {
|
if (!image_mode_is(image_sb, MODE_MASK)) {
|
||||||
/* Solid mode. Redraw every time since it's cheap. */
|
/* Solid mode. Redraw every time since it's cheap. */
|
||||||
if (Options & Opt_scrollbar_floating) {
|
if ((Options & Opt_scrollbar_floating) || (scrollbar.type == SCROLLBAR_XTERM)) {
|
||||||
XSetWindowBackground(Xdisplay, scrollbar.win, PixColors[bgColor]);
|
XSetWindowBackground(Xdisplay, scrollbar.win, PixColors[bgColor]);
|
||||||
XClearWindow(Xdisplay, scrollbar.win);
|
XClearWindow(Xdisplay, scrollbar.win);
|
||||||
} else {
|
} else {
|
||||||
|
@ -820,9 +822,9 @@ scrollbar_drawing_init(void) {
|
||||||
gcvalue.fill_style = FillOpaqueStippled;
|
gcvalue.fill_style = FillOpaqueStippled;
|
||||||
gcvalue.foreground = PixColors[fgColor];
|
gcvalue.foreground = PixColors[fgColor];
|
||||||
gcvalue.background = PixColors[bgColor];
|
gcvalue.background = PixColors[bgColor];
|
||||||
gc_scrollbar = XCreateGC(Xdisplay, scrollbar.win, GCForeground | GCBackground | GCFillStyle | GCStipple, &gcvalue);
|
gc_stipple = XCreateGC(Xdisplay, scrollbar.win, GCForeground | GCBackground | GCFillStyle | GCStipple, &gcvalue);
|
||||||
gcvalue.foreground = PixColors[borderColor];
|
gcvalue.foreground = PixColors[borderColor];
|
||||||
gc_stipple = XCreateGC(Xdisplay, scrollbar.win, GCForeground, &gcvalue);
|
gc_border = XCreateGC(Xdisplay, scrollbar.win, GCForeground, &gcvalue);
|
||||||
}
|
}
|
||||||
#endif /* XTERM_SCROLLBAR */
|
#endif /* XTERM_SCROLLBAR */
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#define SCROLLBAR_STATE_MOVING (1UL << 1)
|
#define SCROLLBAR_STATE_MOVING (1UL << 1)
|
||||||
#define SCROLLBAR_STATE_UP_CLICKED (1UL << 2)
|
#define SCROLLBAR_STATE_UP_CLICKED (1UL << 2)
|
||||||
#define SCROLLBAR_STATE_DOWN_CLICKED (1UL << 3)
|
#define SCROLLBAR_STATE_DOWN_CLICKED (1UL << 3)
|
||||||
|
#define SCROLLBAR_STATE_ANCHOR_CLICKED (1UL << 4)
|
||||||
|
#define SCROLLBAR_STATE_MOTION_MASK (SCROLLBAR_STATE_UP_CLICKED | SCROLLBAR_STATE_DOWN_CLICKED | SCROLLBAR_STATE_ANCHOR_CLICKED | SCROLLBAR_STATE_MOVING)
|
||||||
|
|
||||||
/* Scrollbar state macros */
|
/* Scrollbar state macros */
|
||||||
#define scrollbar_is_visible() (scrollbar.state & SCROLLBAR_STATE_VISIBLE)
|
#define scrollbar_is_visible() (scrollbar.state & SCROLLBAR_STATE_VISIBLE)
|
||||||
|
@ -46,11 +48,13 @@
|
||||||
#define scrollbar_uparrow_is_pressed() (scrollbar.state & SCROLLBAR_STATE_UP_CLICKED)
|
#define scrollbar_uparrow_is_pressed() (scrollbar.state & SCROLLBAR_STATE_UP_CLICKED)
|
||||||
#define scrollbar_downarrow_is_pressed() (scrollbar.state & SCROLLBAR_STATE_DOWN_CLICKED)
|
#define scrollbar_downarrow_is_pressed() (scrollbar.state & SCROLLBAR_STATE_DOWN_CLICKED)
|
||||||
#define scrollbar_arrow_is_pressed() (scrollbar.state & (SCROLLBAR_STATE_UP_CLICKED | SCROLLBAR_STATE_DOWN_CLICKED))
|
#define scrollbar_arrow_is_pressed() (scrollbar.state & (SCROLLBAR_STATE_UP_CLICKED | SCROLLBAR_STATE_DOWN_CLICKED))
|
||||||
#define scrollbar_cancel_motion() (scrollbar.state &= ~(SCROLLBAR_STATE_UP_CLICKED | SCROLLBAR_STATE_DOWN_CLICKED | SCROLLBAR_STATE_MOVING))
|
#define scrollbar_anchor_is_pressed() (scrollbar.state & SCROLLBAR_STATE_ANCHOR_CLICKED)
|
||||||
|
#define scrollbar_cancel_motion() (scrollbar.state &= ~(SCROLLBAR_STATE_MOTION_MASK))
|
||||||
#define scrollbar_set_visible(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_VISIBLE) : (scrollbar.state &= ~(SCROLLBAR_STATE_VISIBLE)))
|
#define scrollbar_set_visible(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_VISIBLE) : (scrollbar.state &= ~(SCROLLBAR_STATE_VISIBLE)))
|
||||||
#define scrollbar_set_motion(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_MOVING) : (scrollbar.state &= ~(SCROLLBAR_STATE_MOVING)))
|
#define scrollbar_set_motion(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_MOVING) : (scrollbar.state &= ~(SCROLLBAR_STATE_MOVING)))
|
||||||
#define scrollbar_set_uparrow_pressed(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_UP_CLICKED) : (scrollbar.state &= ~(SCROLLBAR_STATE_UP_CLICKED)))
|
#define scrollbar_set_uparrow_pressed(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_UP_CLICKED) : (scrollbar.state &= ~(SCROLLBAR_STATE_UP_CLICKED)))
|
||||||
#define scrollbar_set_downarrow_pressed(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_DOWN_CLICKED) : (scrollbar.state &= ~(SCROLLBAR_STATE_DOWN_CLICKED)))
|
#define scrollbar_set_downarrow_pressed(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_DOWN_CLICKED) : (scrollbar.state &= ~(SCROLLBAR_STATE_DOWN_CLICKED)))
|
||||||
|
#define scrollbar_set_anchor_pressed(bit) ((bit) ? (scrollbar.state |= SCROLLBAR_STATE_ANCHOR_CLICKED) : (scrollbar.state &= ~(SCROLLBAR_STATE_ANCHOR_CLICKED)))
|
||||||
|
|
||||||
/* The various scrollbar elements */
|
/* The various scrollbar elements */
|
||||||
#define scrollbar_win_is_trough(w) (scrollbar_is_visible() && (w) == scrollbar.win)
|
#define scrollbar_win_is_trough(w) (scrollbar_is_visible() && (w) == scrollbar.win)
|
||||||
|
|
|
@ -137,16 +137,16 @@ lookup_key(XEvent * ev)
|
||||||
PrivMode((!numlock_state), PrivMode_aplKP);
|
PrivMode((!numlock_state), PrivMode_aplKP);
|
||||||
}
|
}
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
if (Input_Context != NULL) {
|
if (xim_input_context != NULL) {
|
||||||
Status status_return;
|
Status status_return;
|
||||||
|
|
||||||
kbuf[0] = '\0';
|
kbuf[0] = '\0';
|
||||||
len = XmbLookupString(Input_Context, &ev->xkey, (char *) kbuf,
|
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf,
|
||||||
sizeof(short_buf), &keysym, &status_return);
|
sizeof(short_buf), &keysym, &status_return);
|
||||||
if (status_return == XBufferOverflow) {
|
if (status_return == XBufferOverflow) {
|
||||||
kbuf = (unsigned char *) MALLOC(len + 1);
|
kbuf = (unsigned char *) MALLOC(len + 1);
|
||||||
kbuf_alloced = 1;
|
kbuf_alloced = 1;
|
||||||
len = XmbLookupString(Input_Context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return);
|
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return);
|
||||||
}
|
}
|
||||||
valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth);
|
valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -185,9 +185,6 @@ Create_Windows(int argc, char *argv[])
|
||||||
Attributes.backing_store = WhenMapped;
|
Attributes.backing_store = WhenMapped;
|
||||||
Attributes.colormap = cmap;
|
Attributes.colormap = cmap;
|
||||||
|
|
||||||
TermWin.x = -1;
|
|
||||||
TermWin.y = -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* grab colors before netscape does
|
* grab colors before netscape does
|
||||||
*/
|
*/
|
||||||
|
@ -320,7 +317,7 @@ Create_Windows(int argc, char *argv[])
|
||||||
PixColors[unfocusedMenuTopShadowColor] = get_top_shadow_color(PixColors[unfocusedMenuColor], "unfocusedMenuTopShadowColor");
|
PixColors[unfocusedMenuTopShadowColor] = get_top_shadow_color(PixColors[unfocusedMenuColor], "unfocusedMenuTopShadowColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
szHint.base_width = (2 * TermWin.internalBorder + ((Options & Opt_scrollbar) ? scrollbar_trough_width() : 0));
|
szHint.base_width = (2 * TermWin.internalBorder + ((Options & Opt_scrollbar) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0));
|
||||||
szHint.base_height = (2 * TermWin.internalBorder);
|
szHint.base_height = (2 * TermWin.internalBorder);
|
||||||
|
|
||||||
flags = (rs_geometry ? XParseGeometry(rs_geometry, &x, &y, &width, &height) : 0);
|
flags = (rs_geometry ? XParseGeometry(rs_geometry, &x, &y, &width, &height) : 0);
|
||||||
|
@ -414,15 +411,15 @@ Create_Windows(int argc, char *argv[])
|
||||||
cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
|
cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
|
||||||
|
|
||||||
/* the vt window */
|
/* the vt window */
|
||||||
|
TermWin.x = (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0);
|
||||||
|
TermWin.y = 0;
|
||||||
if ((!(Options & Opt_borderless)) && (Options & Opt_backing_store)) {
|
if ((!(Options & Opt_borderless)) && (Options & Opt_backing_store)) {
|
||||||
D_X11(("Creating term window with save_under = TRUE\n"));
|
D_X11(("Creating term window with save_under = TRUE\n"));
|
||||||
TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? scrollbar_trough_width() : 0), 0,
|
TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent,
|
||||||
szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent,
|
|
||||||
CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWBackingStore | CWColormap, &Attributes);
|
CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWBackingStore | CWColormap, &Attributes);
|
||||||
} else {
|
} else {
|
||||||
D_X11(("Creating term window with no backing store\n"));
|
D_X11(("Creating term window with no backing store\n"));
|
||||||
TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? scrollbar_trough_width() : 0), 0,
|
TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent,
|
||||||
szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent,
|
|
||||||
CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &Attributes);
|
CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &Attributes);
|
||||||
}
|
}
|
||||||
if (!(background_is_pixmap()) && !(Options & Opt_borderless)) {
|
if (!(background_is_pixmap()) && !(Options & Opt_borderless)) {
|
||||||
|
|
Loading…
Reference in New Issue