1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

Changes relate to modelock.

This commit is contained in:
id
1999-05-20 23:30:53 +00:00
parent 3301950805
commit c28f3b2c5b
11 changed files with 461 additions and 31 deletions

View File

@@ -108,8 +108,15 @@ typedef enum {
#define WBUT_BROKENCLOSE 1 #define WBUT_BROKENCLOSE 1
#define WBUT_ICONIFY 2 #define WBUT_ICONIFY 2
#define WBUT_KILL 3 #define WBUT_KILL 3
#ifdef XKB_BUTTON_HINT
#define WBUT_THAI 4
#define WBUT_ENGL 5
#define PRED_BPIXMAPS 6 /* count of WBUT icons */
#else
#define PRED_BPIXMAPS 4 /* count of WBUT icons */ #define PRED_BPIXMAPS 4 /* count of WBUT icons */
#endif /* XKB_BUTTON_HINT */
/* cursors */ /* cursors */
#define WCUR_DEFAULT 0 #define WCUR_DEFAULT 0

View File

@@ -97,4 +97,40 @@ static char *PRED_ICONIFY_XPM[] = {
".........." ".........."
}; };
#ifdef XKB_BUTTON_HINT
static char *PRED_THAI_XPM[] = {
" 10 10 2 1",
". c #000000",
"# c None",
"#..###..##",
".#..#.#..#",
".#...###..",
"#...####..",
"##..####..",
"##..####..",
"##..####..",
"##..####..",
"##..####..",
"##.#####.#"
};
static char *PRED_ENGL_XPM[] = {
" 10 10 2 1",
". c #000000",
"# c None",
"........##",
".......###",
"..########",
"..########",
"......####",
".....#####",
"..########",
"..########",
"........##",
"........##"
};
#endif /* XKB_BUTTON_HINT */

View File

@@ -1142,6 +1142,9 @@ wShowInfoPanel(WScreen *scr)
WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_close_button, 0); WSETUFLAG(wwin, no_close_button, 0);
#ifdef XKB_BUTTON_HINT
wFrameWindowHideButton(wwin->frame, WFF_THAI_BUTTON);
#endif
wWindowUpdateButtonImages(wwin); wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
wwin->frame->on_click_right = destroyInfoPanel; wwin->frame->on_click_right = destroyInfoPanel;
@@ -1258,6 +1261,9 @@ wShowLegalPanel(WScreen *scr)
WSETUFLAG(wwin, no_close_button, 0); WSETUFLAG(wwin, no_close_button, 0);
wWindowUpdateButtonImages(wwin); wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
#ifdef XKB_BUTTON_HINT
wFrameWindowHideButton(wwin->frame, WFF_THAI_BUTTON);
#endif
wwin->frame->on_click_right = destroyLegalPanel; wwin->frame->on_click_right = destroyLegalPanel;
panel->wwin = wwin; panel->wwin = wwin;
@@ -1675,6 +1681,9 @@ wShowGNUstepPanel(WScreen *scr)
WSETUFLAG(wwin, no_close_button, 0); WSETUFLAG(wwin, no_close_button, 0);
wWindowUpdateButtonImages(wwin); wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
#ifdef XKB_BUTTON_HINT
wFrameWindowHideButton(wwin->frame, WFF_THAI_BUTTON);
#endif
wwin->frame->on_click_right = destroyGNUstepPanel; wwin->frame->on_click_right = destroyGNUstepPanel;
panel->wwin = wwin; panel->wwin = wwin;

View File

@@ -1163,6 +1163,11 @@ handleXkbIndicatorStateNotify(XEvent *event)
wwin = scr->focused_window; wwin = scr->focused_window;
if (wwin->flags.focused) { if (wwin->flags.focused) {
wwin->frame->languagemode=staterec.compat_state&32?1:0; wwin->frame->languagemode=staterec.compat_state&32?1:0;
#ifdef XKB_BUTTON_HINT
if (wwin->frame->titlebar) {
wFrameWindowPaint(wwin->frame);
}
#endif
#ifdef XKB_TITLE_HINT #ifdef XKB_TITLE_HINT
if (wwin->frame->titlebar) { if (wwin->frame->titlebar) {
XClearWindow(dpy, wwin->frame->titlebar->window); XClearWindow(dpy, wwin->frame->titlebar->window);

View File

@@ -144,6 +144,16 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
if (fwin->left_button) { if (fwin->left_button) {
wCoreConfigure(fwin->left_button, 0, 0, bsize, bsize); wCoreConfigure(fwin->left_button, 0, 0, bsize, bsize);
} }
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button)
if (fwin->flags.hide_left_button || !fwin->left_button
|| fwin->flags.lbutton_dont_fit) {
wCoreConfigure(fwin->thai_button, 0, 0, bsize, bsize);
} else {
wCoreConfigure(fwin->thai_button, bsize, 0, bsize, bsize);
}
#endif
if (fwin->right_button) { if (fwin->right_button) {
wCoreConfigure(fwin->right_button, width-bsize+1, wCoreConfigure(fwin->right_button, width-bsize+1,
@@ -154,6 +164,14 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
wCoreConfigure(fwin->left_button, 3, (theight-bsize)/2, wCoreConfigure(fwin->left_button, 3, (theight-bsize)/2,
bsize, bsize); bsize, bsize);
} }
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button) {
wCoreConfigure(fwin->thai_button, 6 + bsize, (theight-bsize)/2,
bsize, bsize);
}
#endif
if (fwin->right_button) { if (fwin->right_button) {
wCoreConfigure(fwin->right_button, width-bsize-3, wCoreConfigure(fwin->right_button, width-bsize-3,
@@ -164,16 +182,25 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
} else { } else {
/* we had a titlebar, but now we don't need it anymore */ /* we had a titlebar, but now we don't need it anymore */
for (i=0; i < (fwin->flags.single_texture ? 1 : 3); i++) { for (i=0; i < (fwin->flags.single_texture ? 1 : 3); i++) {
FREE_PIXMAP(fwin->title_back[i]); FREE_PIXMAP(fwin->title_back[i]);
if (wPreferences.new_style) { if (wPreferences.new_style) {
FREE_PIXMAP(fwin->lbutton_back[i]); FREE_PIXMAP(fwin->lbutton_back[i]);
FREE_PIXMAP(fwin->rbutton_back[i]); FREE_PIXMAP(fwin->rbutton_back[i]);
} #ifdef XKB_BUTTON_HINT
FREE_PIXMAP(fwin->tbutton_back[i]);
#endif
}
} }
if (fwin->left_button) if (fwin->left_button)
wCoreDestroy(fwin->left_button); wCoreDestroy(fwin->left_button);
fwin->left_button = NULL; fwin->left_button = NULL;
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button)
wCoreDestroy(fwin->thai_button);
fwin->thai_button = NULL;
#endif
if (fwin->right_button) if (fwin->right_button)
wCoreDestroy(fwin->right_button); wCoreDestroy(fwin->right_button);
fwin->right_button = NULL; fwin->right_button = NULL;
@@ -193,31 +220,59 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
fwin->titlebar = wCoreCreate(fwin->core, 0, 0, width+1, theight); fwin->titlebar = wCoreCreate(fwin->core, 0, 0, width+1, theight);
if (flags & WFF_LEFT_BUTTON) { if (flags & WFF_LEFT_BUTTON) {
fwin->flags.left_button = 1; fwin->flags.left_button = 1;
if (wPreferences.new_style) { if (wPreferences.new_style) {
fwin->left_button = wCoreCreate(fwin->core, 0, 0, fwin->left_button = wCoreCreate(fwin->core, 0, 0,
bsize, bsize); bsize, bsize);
if (width < theight*4) { if (width < theight*4) {
fwin->flags.lbutton_dont_fit = 1; fwin->flags.lbutton_dont_fit = 1;
} else {
XMapRaised(dpy, fwin->left_button->window);
}
} else { } else {
fwin->left_button = XMapRaised(dpy, fwin->left_button->window);
wCoreCreate(fwin->titlebar, 3, (theight-bsize)/2,
bsize, bsize);
XSetWindowBackground(dpy, fwin->left_button->window,
scr->widget_texture->normal.pixel);
if (width < theight*3) {
fwin->flags.lbutton_dont_fit = 1;
} else {
XMapRaised(dpy, fwin->left_button->window);
}
} }
} else {
fwin->left_button =
wCoreCreate(fwin->titlebar, 3, (theight-bsize)/2,
bsize, bsize);
XSetWindowBackground(dpy, fwin->left_button->window,
scr->widget_texture->normal.pixel);
if (width < theight*3) {
fwin->flags.lbutton_dont_fit = 1;
} else {
XMapRaised(dpy, fwin->left_button->window);
}
}
} }
#ifdef XKB_BUTTON_HINT
if (flags & WFF_THAI_BUTTON) {
fwin->flags.thai_button = 1;
if (wPreferences.new_style) {
fwin->thai_button = wCoreCreate(fwin->core,
bsize, 0, bsize, bsize);
if (width < theight*4) {
fwin->flags.tbutton_dont_fit = 1;
} else {
XMapRaised(dpy, fwin->thai_button->window);
}
} else {
fwin->thai_button =
wCoreCreate(fwin->titlebar, bsize + 6, (theight-bsize)/2,
bsize, bsize);
XSetWindowBackground(dpy, fwin->thai_button->window,
scr->widget_texture->normal.pixel);
if (width < theight*3) {
fwin->flags.tbutton_dont_fit = 1;
} else {
XMapRaised(dpy, fwin->thai_button->window);
}
}
}
#endif
if (flags & WFF_RIGHT_BUTTON) { if (flags & WFF_RIGHT_BUTTON) {
fwin->flags.right_button = 1; fwin->flags.right_button = 1;
@@ -316,6 +371,16 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
fwin->left_button->descriptor.handle_mousedown = buttonMouseDown; fwin->left_button->descriptor.handle_mousedown = buttonMouseDown;
} }
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button) {
fwin->thai_button->descriptor.handle_expose = handleButtonExpose;
fwin->thai_button->descriptor.parent = fwin;
fwin->thai_button->descriptor.parent_type = WCLASS_FRAME;
fwin->thai_button->descriptor.handle_mousedown = buttonMouseDown;
}
#endif
if (fwin->right_button) { if (fwin->right_button) {
fwin->right_button->descriptor.parent = fwin; fwin->right_button->descriptor.parent = fwin;
fwin->right_button->descriptor.parent_type = WCLASS_FRAME; fwin->right_button->descriptor.parent_type = WCLASS_FRAME;
@@ -336,6 +401,11 @@ wFrameWindowDestroy(WFrameWindow *fwin)
if (fwin->left_button) if (fwin->left_button)
wCoreDestroy(fwin->left_button); wCoreDestroy(fwin->left_button);
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button)
wCoreDestroy(fwin->thai_button);
#endif
if (fwin->right_button) if (fwin->right_button)
wCoreDestroy(fwin->right_button); wCoreDestroy(fwin->right_button);
@@ -356,6 +426,9 @@ wFrameWindowDestroy(WFrameWindow *fwin)
FREE_PIXMAP(fwin->title_back[i]); FREE_PIXMAP(fwin->title_back[i]);
if (wPreferences.new_style) { if (wPreferences.new_style) {
FREE_PIXMAP(fwin->lbutton_back[i]); FREE_PIXMAP(fwin->lbutton_back[i]);
#ifdef XKB_BUTTON_HINT
FREE_PIXMAP(fwin->tbutton_back[i]);
#endif
FREE_PIXMAP(fwin->rbutton_back[i]); FREE_PIXMAP(fwin->rbutton_back[i]);
} }
} }
@@ -392,11 +465,50 @@ updateTitlebar(WFrameWindow *fwin)
if (fwin->flags.hide_left_button || !fwin->left_button if (fwin->flags.hide_left_button || !fwin->left_button
|| fwin->flags.lbutton_dont_fit) { || fwin->flags.lbutton_dont_fit) {
x = 0; x = 0;
#ifdef XKB_BUTTON_HINT
if(fwin->thai_button)
wCoreConfigure(fwin->thai_button, 0, 0,
fwin->thai_button->width,
fwin->thai_button->width);
#endif
} else { } else {
#ifdef XKB_BUTTON_HINT
if(fwin->thai_button)
wCoreConfigure(fwin->thai_button, fwin->left_button->width, 0,
fwin->thai_button->width,
fwin->thai_button->width);
#endif
x = fwin->left_button->width; x = fwin->left_button->width;
w -= fwin->left_button->width; w -= fwin->left_button->width;
} }
#ifdef XKB_BUTTON_HINT
if (fwin->flags.hide_thai_button || !fwin->thai_button
|| fwin->flags.tbutton_dont_fit) {
} else {
x += fwin->thai_button->width;
w -= fwin->thai_button->width;
} }
#endif
}
#ifdef XKB_BUTTON_HINT
else {
int bsize = theight - 7;
if (fwin->flags.hide_left_button || !fwin->left_button
|| fwin->flags.lbutton_dont_fit) {
if(fwin->thai_button)
wCoreConfigure(fwin->thai_button, 3, (theight-bsize)/2,
fwin->thai_button->width,
fwin->thai_button->width);
}
else {
if(fwin->thai_button)
wCoreConfigure(fwin->thai_button,
6 + fwin->left_button->width, (theight-bsize)/2,
fwin->thai_button->width,
fwin->thai_button->width);
}
}
#endif
if (wPreferences.new_style) { if (wPreferences.new_style) {
if (!fwin->flags.hide_right_button && fwin->right_button if (!fwin->flags.hide_right_button && fwin->right_button
@@ -424,13 +536,24 @@ wFrameWindowHideButton(WFrameWindow *fwin, int flags)
XUnmapWindow(dpy, fwin->left_button->window); XUnmapWindow(dpy, fwin->left_button->window);
fwin->flags.hide_left_button = 1; fwin->flags.hide_left_button = 1;
} }
#ifdef XKB_BUTTON_HINT
if ((flags & WFF_THAI_BUTTON) && fwin->thai_button) {
XUnmapWindow(dpy, fwin->thai_button->window);
fwin->flags.hide_thai_button = 1;
}
#endif
if (fwin->titlebar) { if (fwin->titlebar) {
if (wPreferences.new_style) { if (wPreferences.new_style) {
updateTitlebar(fwin); updateTitlebar(fwin);
} else { } else {
#ifdef XKB_BUTTON_HINT
updateTitlebar(fwin);
#else
XClearWindow(dpy, fwin->titlebar->window); XClearWindow(dpy, fwin->titlebar->window);
wFrameWindowPaint(fwin); wFrameWindowPaint(fwin);
#endif
} }
checkTitleSize(fwin); checkTitleSize(fwin);
} }
@@ -448,6 +571,17 @@ wFrameWindowShowButton(WFrameWindow *fwin, int flags)
fwin->flags.hide_right_button = 0; fwin->flags.hide_right_button = 0;
} }
#ifdef XKB_BUTTON_HINT
if ((flags & WFF_THAI_BUTTON) && fwin->thai_button
&& fwin->flags.hide_thai_button) {
if (!fwin->flags.tbutton_dont_fit)
XMapWindow(dpy, fwin->thai_button->window);
fwin->flags.hide_thai_button = 0;
}
#endif
if ((flags & WFF_LEFT_BUTTON) && fwin->left_button if ((flags & WFF_LEFT_BUTTON) && fwin->left_button
&& fwin->flags.hide_left_button) { && fwin->flags.hide_left_button) {
@@ -472,17 +606,29 @@ wFrameWindowShowButton(WFrameWindow *fwin, int flags)
static void static void
#ifdef XKB_BUTTON_HINT
renderTexture(WScreen *scr, WTexture *texture, int width, int height,
int bwidth, int bheight, int left, int thai, int right,
Pixmap *title, Pixmap *lbutton, Pixmap *tbutton, Pixmap *rbutton)
#else
renderTexture(WScreen *scr, WTexture *texture, int width, int height, renderTexture(WScreen *scr, WTexture *texture, int width, int height,
int bwidth, int bheight, int left, int right, int bwidth, int bheight, int left, int right,
Pixmap *title, Pixmap *lbutton, Pixmap *rbutton) Pixmap *title, Pixmap *lbutton, Pixmap *rbutton)
#endif
{ {
RImage *img; RImage *img;
RImage *limg, *rimg, *mimg; RImage *limg, *rimg, *mimg;
#ifdef XKB_BUTTON_HINT
RImage *timg;
#endif
int x, w; int x, w;
*title = None; *title = None;
*lbutton = None; *lbutton = None;
*rbutton = None; *rbutton = None;
#ifdef XKB_BUTTON_HINT
*tbutton = None;
#endif
img = wTextureRenderImage(texture, width, height, WREL_FLAT); img = wTextureRenderImage(texture, width, height, WREL_FLAT);
if (!img) { if (!img) {
@@ -498,6 +644,13 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
x = 0; x = 0;
w = img->width; w = img->width;
#ifdef XKB_BUTTON_HINT
if (thai) {
timg = RGetSubImage(img, bwidth, 0, bwidth, bheight);
} else
timg = NULL;
#endif
if (limg) { if (limg) {
RBevelImage(limg, RBEV_RAISED2); RBevelImage(limg, RBEV_RAISED2);
@@ -508,6 +661,18 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
w -= limg->width; w -= limg->width;
RDestroyImage(limg); RDestroyImage(limg);
} }
#ifdef XKB_BUTTON_HINT
if (timg) {
RBevelImage(timg, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, timg, tbutton)) {
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
x += timg->width;
w -= timg->width;
RDestroyImage(timg);
}
#endif
if (right) { if (right) {
rimg = RGetSubImage(img, width - bwidth, 0, bwidth, bheight); rimg = RGetSubImage(img, width - bwidth, 0, bwidth, bheight);
@@ -618,6 +783,12 @@ updateTexture(WFrameWindow *fwin)
if (fwin->left_button && fwin->lbutton_back[i]) if (fwin->left_button && fwin->lbutton_back[i])
XSetWindowBackgroundPixmap(dpy, fwin->left_button->window, XSetWindowBackgroundPixmap(dpy, fwin->left_button->window,
fwin->lbutton_back[i]); fwin->lbutton_back[i]);
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button && fwin->tbutton_back[i])
XSetWindowBackgroundPixmap(dpy, fwin->thai_button->window,
fwin->tbutton_back[i]);
#endif
if (fwin->right_button && fwin->rbutton_back[i]) if (fwin->right_button && fwin->rbutton_back[i])
XSetWindowBackgroundPixmap(dpy, fwin->right_button->window, XSetWindowBackgroundPixmap(dpy, fwin->right_button->window,
@@ -630,6 +801,11 @@ updateTexture(WFrameWindow *fwin)
if (fwin->left_button) if (fwin->left_button)
XSetWindowBackground(dpy, fwin->left_button->window, XSetWindowBackground(dpy, fwin->left_button->window,
pixel); pixel);
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button)
XSetWindowBackground(dpy, fwin->thai_button->window,
pixel);
#endif
if (fwin->right_button) if (fwin->right_button)
XSetWindowBackground(dpy, fwin->right_button->window, XSetWindowBackground(dpy, fwin->right_button->window,
pixel); pixel);
@@ -641,6 +817,12 @@ updateTexture(WFrameWindow *fwin)
XClearWindow(dpy, fwin->left_button->window); XClearWindow(dpy, fwin->left_button->window);
handleButtonExpose(&fwin->left_button->descriptor, NULL); handleButtonExpose(&fwin->left_button->descriptor, NULL);
} }
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button) {
XClearWindow(dpy, fwin->thai_button->window);
handleButtonExpose(&fwin->thai_button->descriptor, NULL);
}
#endif
if (fwin->right_button) { if (fwin->right_button) {
XClearWindow(dpy, fwin->right_button->window); XClearWindow(dpy, fwin->right_button->window);
handleButtonExpose(&fwin->right_button->descriptor, NULL); handleButtonExpose(&fwin->right_button->descriptor, NULL);
@@ -654,35 +836,58 @@ static void
remakeTexture(WFrameWindow *fwin, int state) remakeTexture(WFrameWindow *fwin, int state)
{ {
Pixmap pmap, lpmap, rpmap; Pixmap pmap, lpmap, rpmap;
#ifdef XKB_BUTTON_HINT
Pixmap tpmap;
#endif
if (fwin->title_texture[state] && fwin->titlebar) { if (fwin->title_texture[state] && fwin->titlebar) {
FREE_PIXMAP(fwin->title_back[state]); FREE_PIXMAP(fwin->title_back[state]);
if (wPreferences.new_style) { if (wPreferences.new_style) {
FREE_PIXMAP(fwin->lbutton_back[state]); FREE_PIXMAP(fwin->lbutton_back[state]);
FREE_PIXMAP(fwin->rbutton_back[state]); FREE_PIXMAP(fwin->rbutton_back[state]);
#ifdef XKB_BUTTON_HINT
FREE_PIXMAP(fwin->tbutton_back[state]);
#endif
} }
if (fwin->title_texture[state]->any.type!=WTEX_SOLID) { if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
int left, right; int left, right;
#ifdef XKB_BUTTON_HINT
int thai;
#endif
int width; int width;
/* eventually surrounded by if new_style */ /* eventually surrounded by if new_style */
left = fwin->left_button && !fwin->flags.hide_left_button left = fwin->left_button && !fwin->flags.hide_left_button
&& !fwin->flags.lbutton_dont_fit; && !fwin->flags.lbutton_dont_fit;
#ifdef XKB_BUTTON_HINT
thai = fwin->thai_button && !fwin->flags.hide_thai_button
&& !fwin->flags.tbutton_dont_fit;
#endif
right = fwin->right_button && !fwin->flags.hide_right_button right = fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit; && !fwin->flags.rbutton_dont_fit;
width = fwin->core->width+1; width = fwin->core->width+1;
#ifdef XKB_BUTTON_HINT
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
width, fwin->titlebar->height,
fwin->titlebar->height, fwin->titlebar->height,
left, thai, right, &pmap, &lpmap, &tpmap, &rpmap);
#else
renderTexture(fwin->screen_ptr, fwin->title_texture[state], renderTexture(fwin->screen_ptr, fwin->title_texture[state],
width, fwin->titlebar->height, width, fwin->titlebar->height,
fwin->titlebar->height, fwin->titlebar->height, fwin->titlebar->height, fwin->titlebar->height,
left, right, &pmap, &lpmap, &rpmap); left, right, &pmap, &lpmap, &rpmap);
#endif
fwin->title_back[state] = pmap; fwin->title_back[state] = pmap;
if (wPreferences.new_style) { if (wPreferences.new_style) {
fwin->lbutton_back[state] = lpmap; fwin->lbutton_back[state] = lpmap;
fwin->rbutton_back[state] = rpmap; fwin->rbutton_back[state] = rpmap;
#ifdef XKB_BUTTON_HINT
fwin->tbutton_back[state] = tpmap;
#endif
} }
} }
} }
@@ -806,6 +1011,14 @@ wFrameWindowPaint(WFrameWindow *fwin)
lofs += fwin->left_button->width + 3; lofs += fwin->left_button->width + 3;
else else
allButtons = 0; allButtons = 0;
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button && !fwin->flags.hide_thai_button
&& !fwin->flags.tbutton_dont_fit)
lofs += fwin->thai_button->width;
else
allButtons = 0;
#endif
if (fwin->right_button && !fwin->flags.hide_right_button if (fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit) && !fwin->flags.rbutton_dont_fit)
@@ -814,6 +1027,13 @@ wFrameWindowPaint(WFrameWindow *fwin)
allButtons = 0; allButtons = 0;
} }
#ifdef XKB_BUTTON_HINT
if (fwin->languagemode) {
fwin->tbutton_image = fwin->screen_ptr->b_pixmaps[WBUT_THAI];
}
else fwin->tbutton_image = fwin->screen_ptr->b_pixmaps[WBUT_ENGL];
#endif
#ifdef XKB_TITLE_HINT #ifdef XKB_TITLE_HINT
if(fwin->flags.is_client_window_frame) { if(fwin->flags.is_client_window_frame) {
char * freebuff; char * freebuff;
@@ -880,6 +1100,10 @@ wFrameWindowPaint(WFrameWindow *fwin)
if (fwin->left_button) if (fwin->left_button)
handleButtonExpose(&fwin->left_button->descriptor, NULL); handleButtonExpose(&fwin->left_button->descriptor, NULL);
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button)
handleButtonExpose(&fwin->thai_button->descriptor, NULL);
#endif
if (fwin->right_button) if (fwin->right_button)
handleButtonExpose(&fwin->right_button->descriptor, NULL); handleButtonExpose(&fwin->right_button->descriptor, NULL);
} }
@@ -930,6 +1154,24 @@ reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
fwin->flags.lbutton_dont_fit = 0; fwin->flags.lbutton_dont_fit = 0;
} }
} }
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button) {
if (width < fwin->top_width*k && !fwin->flags.tbutton_dont_fit) {
if (!fwin->flags.hide_thai_button) {
XUnmapWindow(dpy, fwin->thai_button->window);
}
fwin->flags.tbutton_dont_fit = 1;
} else if (width >= fwin->top_width*k && fwin->flags.tbutton_dont_fit) {
if (!fwin->flags.hide_thai_button) {
XMapWindow(dpy, fwin->thai_button->window);
}
fwin->flags.tbutton_dont_fit = 0;
}
}
#endif
if (fwin->right_button) { if (fwin->right_button) {
if (width < fwin->top_width*2 && !fwin->flags.rbutton_dont_fit) { if (width < fwin->top_width*2 && !fwin->flags.rbutton_dont_fit) {
@@ -1069,6 +1311,12 @@ checkTitleSize(WFrameWindow *fwin)
if (fwin->left_button && !fwin->flags.hide_left_button if (fwin->left_button && !fwin->flags.hide_left_button
&& !fwin->flags.lbutton_dont_fit) && !fwin->flags.lbutton_dont_fit)
width -= fwin->left_button->width + 3; width -= fwin->left_button->width + 3;
#ifdef XKB_BUTTON_HINT
if (fwin->thai_button && !fwin->flags.hide_thai_button
&& !fwin->flags.tbutton_dont_fit)
width -= fwin->thai_button->width + 3;
#endif
if (fwin->right_button && !fwin->flags.hide_right_button if (fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit) && !fwin->flags.rbutton_dont_fit)
@@ -1182,6 +1430,17 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
WFrameWindow *fwin = (WFrameWindow*)desc->parent; WFrameWindow *fwin = (WFrameWindow*)desc->parent;
WCoreWindow *button = (WCoreWindow*)desc->self; WCoreWindow *button = (WCoreWindow*)desc->self;
#ifdef XKB_BUTTON_HINT
if (button == fwin->thai_button) {
if (wPreferences.modelock){
paintButton(button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
fwin->tbutton_image, False);
}
} else
#endif
if (button == fwin->left_button) { if (button == fwin->left_button) {
paintButton(button, fwin->title_texture[fwin->flags.state], paintButton(button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state], fwin->title_pixel[fwin->flags.state],
@@ -1252,6 +1511,12 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
} else { } else {
image = fwin->rbutton_image; image = fwin->rbutton_image;
} }
#ifdef XKB_BUTTON_HINT
if (button == fwin->thai_button) {
if (!wPreferences.modelock) return;
image = fwin->tbutton_image;
}
#endif
pixel = fwin->title_pixel[fwin->flags.state]; pixel = fwin->title_pixel[fwin->flags.state];
texture = fwin->title_texture[fwin->flags.state]; texture = fwin->title_texture[fwin->flags.state];
@@ -1293,6 +1558,13 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
if (fwin->on_click_right) if (fwin->on_click_right)
(*fwin->on_click_right)(button, fwin->child, &ev); (*fwin->on_click_right)(button, fwin->child, &ev);
} }
#ifdef XKB_BUTTON_HINT
else if (button == fwin->thai_button) {
if (fwin->on_click_thai)
(*fwin->on_click_thai)(button, fwin->child, &ev);
}
#endif
} }
} }

View File

@@ -36,6 +36,10 @@
#define WFF_RESIZEBAR (1<<3) #define WFF_RESIZEBAR (1<<3)
#define WFF_BORDER (1<<4) #define WFF_BORDER (1<<4)
#define WFF_SINGLE_STATE (1<<5) #define WFF_SINGLE_STATE (1<<5)
#ifdef XKB_BUTTON_HINT
#define WFF_THAI_BUTTON (1<<6)
#endif
#define WFF_IS_SHADED (1<<16) #define WFF_IS_SHADED (1<<16)
@@ -46,6 +50,9 @@ typedef struct WFrameWindow {
WCoreWindow *titlebar; /* the titlebar */ WCoreWindow *titlebar; /* the titlebar */
WCoreWindow *left_button; /* miniaturize button */ WCoreWindow *left_button; /* miniaturize button */
#ifdef XKB_BUTTON_HINT
WCoreWindow *thai_button;
#endif
WCoreWindow *right_button; /* close button */ WCoreWindow *right_button; /* close button */
short workspace; /* workspace that the window occupies */ short workspace; /* workspace that the window occupies */
@@ -61,9 +68,15 @@ typedef struct WFrameWindow {
Pixmap resizebar_back[3]; /* any, None, None */ Pixmap resizebar_back[3]; /* any, None, None */
Pixmap lbutton_back[3]; Pixmap lbutton_back[3];
Pixmap rbutton_back[3]; Pixmap rbutton_back[3];
#ifdef XKB_BUTTON_HINT
Pixmap tbutton_back[3];
#endif
WPixmap *lbutton_image; WPixmap *lbutton_image;
WPixmap *rbutton_image; WPixmap *rbutton_image;
#ifdef XKB_BUTTON_HINT
WPixmap *tbutton_image;
#endif
union WTexture **title_texture; union WTexture **title_texture;
union WTexture **resizebar_texture; union WTexture **resizebar_texture;
@@ -82,6 +95,9 @@ typedef struct WFrameWindow {
/* callbacks */ /* callbacks */
void (*on_click_left)(WCoreWindow *sender, void *data, XEvent *event); void (*on_click_left)(WCoreWindow *sender, void *data, XEvent *event);
#ifdef XKB_BUTTON_HINT
void (*on_click_thai)(WCoreWindow *sender, void *data, XEvent *event);
#endif
void (*on_click_right)(WCoreWindow *sender, void *data, XEvent *event); void (*on_click_right)(WCoreWindow *sender, void *data, XEvent *event);
void (*on_dblclick_right)(WCoreWindow *sender, void *data, XEvent *event); void (*on_dblclick_right)(WCoreWindow *sender, void *data, XEvent *event);
@@ -98,6 +114,9 @@ typedef struct WFrameWindow {
unsigned int resizebar:1; unsigned int resizebar:1;
unsigned int left_button:1; unsigned int left_button:1;
unsigned int right_button:1; unsigned int right_button:1;
#ifdef XKB_BUTTON_HINT
unsigned int thai_button:1;
#endif
unsigned int need_texture_remake:1; unsigned int need_texture_remake:1;
@@ -105,11 +124,17 @@ typedef struct WFrameWindow {
unsigned int hide_left_button:1; unsigned int hide_left_button:1;
unsigned int hide_right_button:1; unsigned int hide_right_button:1;
#ifdef XKB_BUTTON_HINT
unsigned int hide_thai_button:1;
#endif
unsigned int need_texture_change:1; unsigned int need_texture_change:1;
unsigned int lbutton_dont_fit:1; unsigned int lbutton_dont_fit:1;
unsigned int rbutton_dont_fit:1; unsigned int rbutton_dont_fit:1;
#ifdef XKB_BUTTON_HINT
unsigned int tbutton_dont_fit:1;
#endif
unsigned int repaint_only_titlebar:1; unsigned int repaint_only_titlebar:1;
unsigned int repaint_only_resizebar:1; unsigned int repaint_only_resizebar:1;

View File

@@ -175,6 +175,17 @@ allocButtonPixmaps(WScreen *scr)
if (pix) if (pix)
pix->shared = 1; pix->shared = 1;
scr->b_pixmaps[WBUT_ICONIFY] = pix; scr->b_pixmaps[WBUT_ICONIFY] = pix;
#ifdef XKB_BUTTON_HINT
pix = wPixmapCreateFromXPMData(scr, PRED_THAI_XPM);
if (pix)
pix->shared = 1;
scr->b_pixmaps[WBUT_THAI] = pix;
pix = wPixmapCreateFromXPMData(scr, PRED_ENGL_XPM);
if (pix)
pix->shared = 1;
scr->b_pixmaps[WBUT_ENGL] = pix;
#endif
pix = wPixmapCreateFromXPMData(scr, PRED_KILL_XPM); pix = wPixmapCreateFromXPMData(scr, PRED_KILL_XPM);
if (pix) if (pix)

View File

@@ -47,6 +47,9 @@ typedef struct WFont {
#define WTB_UNFOCUSED 2 #define WTB_UNFOCUSED 2
#define WTB_PFOCUSED 4 #define WTB_PFOCUSED 4
#define WTB_MENU 6 #define WTB_MENU 6
#ifdef XKB_BUTTON_HINT
#define WTB_THAI 7
#endif
#ifdef GNOME_STUFF #ifdef GNOME_STUFF
/* an area of the screen reserved by some window */ /* an area of the screen reserved by some window */
@@ -260,7 +263,11 @@ typedef struct _WScreen {
struct WDialogData *dialog_data; struct WDialogData *dialog_data;
#ifdef NEWSTUFF #ifdef NEWSTUFF
#ifdef XKB_BUTTON_HINT
struct RImage *button_images[3][PRED_BPIXMAPS];
#else
struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */ struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */
#endif
#endif #endif
/* state and other informations */ /* state and other informations */

View File

@@ -591,7 +591,13 @@
#ifdef XKB_MODELOCK #ifdef XKB_MODELOCK
#define KEEP_XKB_LOCK_STATUS #define KEEP_XKB_LOCK_STATUS
#define XKB_TITLE_HINT /* This is a hidden feature.
* choose one between 2 of these hints. Icon can be changed
* in def_pixmaps.h and default icon is now for Thai language only.
* More icons are welcome.
*/
#undef XKB_BUTTON_HINT
#undef XKB_TITLE_HINT
#define XKB_ON "[TH]" #define XKB_ON "[TH]"
#define XKB_OFF "[EN]" #define XKB_OFF "[EN]"
#endif #endif

View File

@@ -123,6 +123,9 @@ static void windowCloseDblClick(WCoreWindow *sender, void *data, XEvent *event);
/* iconify button */ /* iconify button */
static void windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event); static void windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event);
#ifdef XKB_BUTTON_HINT
static void windowThaiClick(WCoreWindow *sender, void *data, XEvent *event);
#endif
static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event); static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event);
static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event); static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event);
@@ -888,6 +891,10 @@ wManageWindow(WScreen *scr, Window window)
*-------------------------------------------------- *--------------------------------------------------
*/ */
foo = WFF_LEFT_BUTTON | WFF_RIGHT_BUTTON; foo = WFF_LEFT_BUTTON | WFF_RIGHT_BUTTON;
#ifdef XKB_BUTTON_HINT
if (wPreferences.modelock)
foo |= WFF_THAI_BUTTON;
#endif
if (!WFLAGP(wwin, no_titlebar)) if (!WFLAGP(wwin, no_titlebar))
foo |= WFF_TITLEBAR; foo |= WFF_TITLEBAR;
if (!WFLAGP(wwin, no_resizebar)) if (!WFLAGP(wwin, no_resizebar))
@@ -934,6 +941,11 @@ wManageWindow(WScreen *scr, Window window)
wwin->frame->workspace = workspace; wwin->frame->workspace = workspace;
wwin->frame->on_click_left = windowIconifyClick; wwin->frame->on_click_left = windowIconifyClick;
#ifdef XKB_BUTTON_HINT
if (wPreferences.modelock)
wwin->frame->on_click_thai = windowThaiClick;
else wwin->frame->on_click_thai = NULL;
#endif
wwin->frame->on_click_right = windowCloseClick; wwin->frame->on_click_right = windowCloseClick;
wwin->frame->on_dblclick_right = windowCloseDblClick; wwin->frame->on_dblclick_right = windowCloseDblClick;
@@ -1242,6 +1254,9 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
foo = WFF_RIGHT_BUTTON; foo = WFF_RIGHT_BUTTON;
foo |= WFF_TITLEBAR; foo |= WFF_TITLEBAR;
#ifdef XKB_BUTTON_HINT
foo |= WFF_THAI_BUTTON;
#endif
wwin->frame = wFrameWindowCreate(scr, WMFloatingLevel, wwin->frame = wFrameWindowCreate(scr, WMFloatingLevel,
wwin->frame_x, wwin->frame_y, wwin->frame_x, wwin->frame_y,
@@ -1268,6 +1283,12 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
wwin->frame->child = wwin; wwin->frame->child = wwin;
wwin->frame->workspace = wwin->screen_ptr->current_workspace; wwin->frame->workspace = wwin->screen_ptr->current_workspace;
#ifdef THAI
if (wPreferences.modelock)
wwin->frame->on_click_thai = windowThaiClick;
else wwin->frame->on_click_thai = NULL;
#endif
wwin->frame->on_click_right = windowCloseClick; wwin->frame->on_click_right = windowCloseClick;
@@ -1549,9 +1570,7 @@ wWindowFocus(WWindow *wwin, WWindow *owin)
#ifdef KEEP_XKB_LOCK_STATUS #ifdef KEEP_XKB_LOCK_STATUS
if (wPreferences.modelock) { if (wPreferences.modelock) {
if (!wwin->flags.focused) { XkbLockGroup(dpy, XkbUseCoreKbd, wwin->frame->languagemode);
XkbLockGroup(dpy, XkbUseCoreKbd, wwin->frame->languagemode);
}
} }
#endif /* KEEP_XKB_LOCK_STATUS */ #endif /* KEEP_XKB_LOCK_STATUS */
@@ -1992,6 +2011,15 @@ wWindowUpdateButtonImages(WWindow *wwin)
} }
} }
#ifdef XKB_BUTTON_HINT
if (!WFLAGP(wwin, no_thai_button)) {
if (fwin->tbutton_image && !fwin->tbutton_image->shared) {
wPixmapDestroy(fwin->tbutton_image);
}
fwin->tbutton_image = scr->b_pixmaps[WBUT_ENGL];
}
#endif
/* close button */ /* close button */
if (!WFLAGP(wwin, no_close_button)) { if (!WFLAGP(wwin, no_close_button)) {
@@ -2807,6 +2835,27 @@ windowCloseDblClick(WCoreWindow *sender, void *data, XEvent *event)
} }
#ifdef XKB_BUTTON_HINT
static void
windowThaiClick(WCoreWindow *sender, void *data, XEvent *event)
{
WWindow *wwin = data;
WFrameWindow *fwin = wwin->frame;
WScreen *scr = fwin->screen_ptr;
XkbStateRec staterec;
if (event->xbutton.button != Button1 && event->xbutton.button != Button3)
return;
wwin->frame->languagemode = !wwin->frame->languagemode;
wFrameWindowPaint(fwin);
wSetFocusTo(scr, wwin);
if (event->xbutton.button == Button3)
return;
wRaiseFrame(fwin->core);
}
#endif
static void static void
windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event) windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event)
{ {

View File

@@ -91,6 +91,9 @@ typedef struct {
unsigned int no_resizable:1; unsigned int no_resizable:1;
unsigned int no_closable:1; unsigned int no_closable:1;
unsigned int no_miniaturizable:1; unsigned int no_miniaturizable:1;
#ifdef XKB_BUTTON_HINT
unsigned int no_thai_button:1;
#endif
/* decorations */ /* decorations */
unsigned int no_resizebar:1; /* draw the bottom handle? */ unsigned int no_resizebar:1; /* draw the bottom handle? */