mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
fixed cvs messup
This commit is contained in:
306
src/framewin.c
306
src/framewin.c
@@ -23,6 +23,9 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
|
#include <X11/XKBlib.h>
|
||||||
|
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -62,7 +65,7 @@ WFrameWindow*
|
|||||||
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
||||||
int width, int height, int flags,
|
int width, int height, int flags,
|
||||||
WTexture **title_texture, WTexture **resize_texture,
|
WTexture **title_texture, WTexture **resize_texture,
|
||||||
unsigned long *color, GC *gc, WMFont **font)
|
unsigned long *color, GC *gc, WFont **font)
|
||||||
{
|
{
|
||||||
WFrameWindow *fwin;
|
WFrameWindow *fwin;
|
||||||
|
|
||||||
@@ -78,6 +81,10 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
|||||||
fwin->title_pixel = color;
|
fwin->title_pixel = color;
|
||||||
fwin->title_gc = gc;
|
fwin->title_gc = gc;
|
||||||
fwin->font = font;
|
fwin->font = font;
|
||||||
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
|
fwin->languagemode = XkbGroup1Index;
|
||||||
|
fwin->last_languagemode = XkbGroup2Index;
|
||||||
|
#endif
|
||||||
|
|
||||||
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height,
|
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height,
|
||||||
FRAME_BORDER_WIDTH);
|
FRAME_BORDER_WIDTH);
|
||||||
@@ -122,7 +129,7 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
height = fwin->core->height - fwin->top_width - fwin->bottom_width;
|
height = fwin->core->height - fwin->top_width - fwin->bottom_width;
|
||||||
|
|
||||||
if (flags & WFF_TITLEBAR)
|
if (flags & WFF_TITLEBAR)
|
||||||
theight = WMFontHeight(*fwin->font) + TITLEBAR_EXTRA_HEIGHT;
|
theight = (*fwin->font)->height + TITLEBAR_EXTRA_HEIGHT;
|
||||||
else
|
else
|
||||||
theight = 0;
|
theight = 0;
|
||||||
|
|
||||||
@@ -144,6 +151,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->language_button)
|
||||||
|
if (fwin->flags.hide_left_button || !fwin->left_button
|
||||||
|
|| fwin->flags.lbutton_dont_fit) {
|
||||||
|
wCoreConfigure(fwin->language_button, 0, 0, bsize, bsize);
|
||||||
|
} else {
|
||||||
|
wCoreConfigure(fwin->language_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,
|
||||||
@@ -155,6 +172,14 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
bsize, bsize);
|
bsize, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (fwin->language_button) {
|
||||||
|
wCoreConfigure(fwin->language_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,
|
||||||
(theight-bsize)/2, bsize, bsize);
|
(theight-bsize)/2, bsize, bsize);
|
||||||
@@ -168,12 +193,21 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
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->languagebutton_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->language_button)
|
||||||
|
wCoreDestroy(fwin->language_button);
|
||||||
|
fwin->language_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;
|
||||||
@@ -218,6 +252,34 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (flags & WFF_LANGUAGE_BUTTON) {
|
||||||
|
fwin->flags.language_button = 1;
|
||||||
|
if (wPreferences.new_style) {
|
||||||
|
fwin->language_button = wCoreCreate(fwin->core,
|
||||||
|
bsize, 0, bsize, bsize);
|
||||||
|
|
||||||
|
if (width < theight*4) {
|
||||||
|
fwin->flags.languagebutton_dont_fit = 1;
|
||||||
|
} else {
|
||||||
|
XMapRaised(dpy, fwin->language_button->window);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fwin->language_button =
|
||||||
|
wCoreCreate(fwin->titlebar, bsize + 6, (theight-bsize)/2,
|
||||||
|
bsize, bsize);
|
||||||
|
|
||||||
|
XSetWindowBackground(dpy, fwin->language_button->window,
|
||||||
|
scr->widget_texture->normal.pixel);
|
||||||
|
|
||||||
|
if (width < theight*3) {
|
||||||
|
fwin->flags.languagebutton_dont_fit = 1;
|
||||||
|
} else {
|
||||||
|
XMapRaised(dpy, fwin->language_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 +378,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->language_button) {
|
||||||
|
fwin->language_button->descriptor.handle_expose = handleButtonExpose;
|
||||||
|
fwin->language_button->descriptor.parent = fwin;
|
||||||
|
fwin->language_button->descriptor.parent_type = WCLASS_FRAME;
|
||||||
|
fwin->language_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 +408,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->language_button)
|
||||||
|
wCoreDestroy(fwin->language_button);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
wCoreDestroy(fwin->right_button);
|
wCoreDestroy(fwin->right_button);
|
||||||
|
|
||||||
@@ -356,6 +433,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->languagebutton_back[i]);
|
||||||
|
#endif
|
||||||
FREE_PIXMAP(fwin->rbutton_back[i]);
|
FREE_PIXMAP(fwin->rbutton_back[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,11 +472,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->language_button)
|
||||||
|
wCoreConfigure(fwin->language_button, 0, 0,
|
||||||
|
fwin->language_button->width,
|
||||||
|
fwin->language_button->width);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if(fwin->language_button)
|
||||||
|
wCoreConfigure(fwin->language_button, fwin->left_button->width, 0,
|
||||||
|
fwin->language_button->width,
|
||||||
|
fwin->language_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_language_button || !fwin->language_button
|
||||||
|
|| fwin->flags.languagebutton_dont_fit) {
|
||||||
|
} else {
|
||||||
|
x += fwin->language_button->width;
|
||||||
|
w -= fwin->language_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->language_button)
|
||||||
|
wCoreConfigure(fwin->language_button, 3, (theight-bsize)/2,
|
||||||
|
fwin->language_button->width,
|
||||||
|
fwin->language_button->width);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(fwin->language_button)
|
||||||
|
wCoreConfigure(fwin->language_button,
|
||||||
|
6 + fwin->left_button->width, (theight-bsize)/2,
|
||||||
|
fwin->language_button->width,
|
||||||
|
fwin->language_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
|
||||||
@@ -425,12 +544,23 @@ wFrameWindowHideButton(WFrameWindow *fwin, int flags)
|
|||||||
fwin->flags.hide_left_button = 1;
|
fwin->flags.hide_left_button = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if ((flags & WFF_LANGUAGE_BUTTON) && fwin->language_button) {
|
||||||
|
XUnmapWindow(dpy, fwin->language_button->window);
|
||||||
|
fwin->flags.hide_language_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);
|
||||||
}
|
}
|
||||||
@@ -449,6 +579,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_LANGUAGE_BUTTON) && fwin->language_button
|
||||||
|
&& fwin->flags.hide_language_button) {
|
||||||
|
|
||||||
|
if (!fwin->flags.languagebutton_dont_fit)
|
||||||
|
XMapWindow(dpy, fwin->language_button->window);
|
||||||
|
|
||||||
|
fwin->flags.hide_language_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 +613,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 language, int right,
|
||||||
|
Pixmap *title, Pixmap *lbutton, Pixmap *languagebutton, 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
|
||||||
|
*languagebutton = None;
|
||||||
|
#endif
|
||||||
|
|
||||||
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
|
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
|
||||||
if (!img) {
|
if (!img) {
|
||||||
@@ -499,6 +652,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 (language) {
|
||||||
|
timg = RGetSubImage(img, bwidth, 0, bwidth, bheight);
|
||||||
|
} else
|
||||||
|
timg = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (limg) {
|
if (limg) {
|
||||||
RBevelImage(limg, RBEV_RAISED2);
|
RBevelImage(limg, RBEV_RAISED2);
|
||||||
if (!RConvertImage(scr->rcontext, limg, lbutton)) {
|
if (!RConvertImage(scr->rcontext, limg, lbutton)) {
|
||||||
@@ -509,6 +669,18 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
|||||||
RDestroyImage(limg);
|
RDestroyImage(limg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (timg) {
|
||||||
|
RBevelImage(timg, RBEV_RAISED2);
|
||||||
|
if (!RConvertImage(scr->rcontext, timg, languagebutton)) {
|
||||||
|
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);
|
||||||
} else
|
} else
|
||||||
@@ -619,6 +791,12 @@ updateTexture(WFrameWindow *fwin)
|
|||||||
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->language_button && fwin->languagebutton_back[i])
|
||||||
|
XSetWindowBackgroundPixmap(dpy, fwin->language_button->window,
|
||||||
|
fwin->languagebutton_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,
|
||||||
fwin->rbutton_back[i]);
|
fwin->rbutton_back[i]);
|
||||||
@@ -630,6 +808,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->language_button)
|
||||||
|
XSetWindowBackground(dpy, fwin->language_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 +824,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->language_button) {
|
||||||
|
XClearWindow(dpy, fwin->language_button->window);
|
||||||
|
handleButtonExpose(&fwin->language_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 +843,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->languagebutton_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 language;
|
||||||
|
#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
|
||||||
|
language = fwin->language_button && !fwin->flags.hide_language_button
|
||||||
|
&& !fwin->flags.languagebutton_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, language, 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->languagebutton_back[state] = tpmap;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -798,7 +1010,6 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
int titlelen;
|
int titlelen;
|
||||||
char *title;
|
char *title;
|
||||||
int allButtons = 1;
|
int allButtons = 1;
|
||||||
WScreen *scr = fwin->screen_ptr;
|
|
||||||
|
|
||||||
|
|
||||||
if (!wPreferences.new_style) {
|
if (!wPreferences.new_style) {
|
||||||
@@ -808,6 +1019,14 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
else
|
else
|
||||||
allButtons = 0;
|
allButtons = 0;
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (fwin->language_button && !fwin->flags.hide_language_button
|
||||||
|
&& !fwin->flags.languagebutton_dont_fit)
|
||||||
|
lofs += fwin->language_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)
|
||||||
rofs += fwin->right_button->width + 3;
|
rofs += fwin->right_button->width + 3;
|
||||||
@@ -815,24 +1034,13 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
allButtons = 0;
|
allButtons = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_TITLE_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
if(fwin->flags.is_client_window_frame) {
|
fwin->languagebutton_image =
|
||||||
char * freebuff;
|
fwin->screen_ptr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
||||||
freebuff = (char *)wmalloc((strlen(fwin->title)+6)*sizeof(char));
|
#endif
|
||||||
if (fwin->flags.justification == WTJ_RIGHT)
|
|
||||||
sprintf(freebuff,"%s %s",fwin->title,fwin->languagemode?XKB_ON:XKB_OFF);
|
|
||||||
else
|
|
||||||
sprintf(freebuff,"%s %s",fwin->languagemode?XKB_ON:XKB_OFF,fwin->title);
|
|
||||||
title = ShrinkString(*fwin->font, freebuff,
|
|
||||||
fwin->titlebar->width - lofs - rofs);
|
|
||||||
free(freebuff);
|
|
||||||
}
|
|
||||||
else title = ShrinkString(*fwin->font, fwin->title,
|
|
||||||
fwin->titlebar->width - lofs - rofs);
|
|
||||||
#else
|
|
||||||
title = ShrinkString(*fwin->font, fwin->title,
|
title = ShrinkString(*fwin->font, fwin->title,
|
||||||
fwin->titlebar->width - lofs - rofs);
|
fwin->titlebar->width - lofs - rofs);
|
||||||
#endif /* XKB_TITLE_HINT */
|
|
||||||
titlelen = strlen(title);
|
titlelen = strlen(title);
|
||||||
w = WMWidthOfString(*fwin->font, title, titlelen);
|
w = WMWidthOfString(*fwin->font, title, titlelen);
|
||||||
|
|
||||||
@@ -881,6 +1089,10 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (fwin->language_button)
|
||||||
|
handleButtonExpose(&fwin->language_button->descriptor, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,6 +1142,24 @@ reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (fwin->language_button) {
|
||||||
|
if (width < fwin->top_width*k && !fwin->flags.languagebutton_dont_fit) {
|
||||||
|
|
||||||
|
if (!fwin->flags.hide_language_button) {
|
||||||
|
XUnmapWindow(dpy, fwin->language_button->window);
|
||||||
|
}
|
||||||
|
fwin->flags.languagebutton_dont_fit = 1;
|
||||||
|
} else if (width >= fwin->top_width*k && fwin->flags.languagebutton_dont_fit) {
|
||||||
|
|
||||||
|
if (!fwin->flags.hide_language_button) {
|
||||||
|
XMapWindow(dpy, fwin->language_button->window);
|
||||||
|
}
|
||||||
|
fwin->flags.languagebutton_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) {
|
||||||
|
|
||||||
@@ -1028,6 +1258,16 @@ wFrameWindowUpdatePushButton(WFrameWindow *fwin, Bool pushed)
|
|||||||
#endif /* OLWM_HINTS */
|
#endif /* OLWM_HINTS */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
void
|
||||||
|
wFrameWindowUpdateLanguageButton(WFrameWindow *fwin)
|
||||||
|
{
|
||||||
|
paintButton(fwin->language_button, fwin->title_texture[fwin->flags.state],
|
||||||
|
fwin->title_pixel[fwin->flags.state],
|
||||||
|
fwin->languagebutton_image, True);
|
||||||
|
}
|
||||||
|
#endif /* XKB_BUTTON_HINT */
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
@@ -1069,6 +1309,12 @@ checkTitleSize(WFrameWindow *fwin)
|
|||||||
&& !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->language_button && !fwin->flags.hide_language_button
|
||||||
|
&& !fwin->flags.languagebutton_dont_fit)
|
||||||
|
width -= fwin->language_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)
|
||||||
width -= fwin->right_button->width + 3;
|
width -= fwin->right_button->width + 3;
|
||||||
@@ -1180,6 +1426,15 @@ 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->language_button) {
|
||||||
|
if (wPreferences.modelock){
|
||||||
|
paintButton(button, fwin->title_texture[fwin->flags.state],
|
||||||
|
fwin->title_pixel[fwin->flags.state],
|
||||||
|
fwin->languagebutton_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],
|
||||||
@@ -1250,6 +1505,12 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
} else {
|
} else {
|
||||||
image = fwin->rbutton_image;
|
image = fwin->rbutton_image;
|
||||||
}
|
}
|
||||||
|
#ifdef XKB_BUTTON_HINT
|
||||||
|
if (button == fwin->language_button) {
|
||||||
|
if (!wPreferences.modelock) return;
|
||||||
|
image = fwin->languagebutton_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];
|
||||||
@@ -1291,6 +1552,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->language_button) {
|
||||||
|
if (fwin->on_click_language)
|
||||||
|
(*fwin->on_click_language)(button, fwin->child, &ev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user