mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
- Updated WINGs/NEWS with info about hw the API changed how how things
are affected. Fixes for old code too. - Double buffering in WMList. All widgets or apps using WMList and having user drawing porcedures in place will inherit this double buffering automatically too. - New functions in WINGs: WMGetColorAlpha(), WMIsAAFont() - Misc code cleanups in WINGs and src/dialog.c
This commit is contained in:
@@ -7,6 +7,7 @@ Changes since wmaker 0.80.1:
|
|||||||
- WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
|
- WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
|
||||||
arguments. WMDrawImageString() receives 2 colors (text & background).
|
arguments. WMDrawImageString() receives 2 colors (text & background).
|
||||||
This is to allow easy extension for Xft/Xrender and hide X low level details
|
This is to allow easy extension for Xft/Xrender and hide X low level details
|
||||||
|
Read NEWS for details since this will break backward compatibility.
|
||||||
- Added alpha channel to WMColor. 2 new functions also:
|
- Added alpha channel to WMColor. 2 new functions also:
|
||||||
WMCreateRGBAColor() and WMSetColorAlpha()
|
WMCreateRGBAColor() and WMSetColorAlpha()
|
||||||
- Miscelaneous code cleanups in wtext.c
|
- Miscelaneous code cleanups in wtext.c
|
||||||
@@ -18,7 +19,11 @@ Changes since wmaker 0.80.1:
|
|||||||
- Fixed some improper calls to snprintf in wfont.c
|
- Fixed some improper calls to snprintf in wfont.c
|
||||||
- Added double buffering when drawing a WMFrame title with an AA font to avoid
|
- Added double buffering when drawing a WMFrame title with an AA font to avoid
|
||||||
flickering.
|
flickering.
|
||||||
- Added double buffering when drawing WMList items to avoid flickering
|
- Added double buffering when drawing WMList items to avoid flickering.
|
||||||
|
Double buffering for list also works for user drawn lists. Read NEWS for
|
||||||
|
details and incompatibilities introduced by this change.
|
||||||
|
- Added new Bool WMIsAAFont(WMFont *font) to check if a font is AA or not.
|
||||||
|
- Added WMGetColorAlpha(WMColor *color)
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.80.0:
|
Changes since wmaker 0.80.0:
|
||||||
|
|||||||
121
WINGs/NEWS
121
WINGs/NEWS
@@ -1,3 +1,124 @@
|
|||||||
|
*** Mon Oct 14 19:42:42 EEST 2002 - Dan
|
||||||
|
|
||||||
|
Double buffering
|
||||||
|
----------------
|
||||||
|
|
||||||
|
To avoid flickering caused by redrawing the widgets on Expose events, a
|
||||||
|
double buffering tehnique was implemented for most of the widgets.
|
||||||
|
This flickering effect has gotten more vizible with the introduction
|
||||||
|
of antialiased text. If with normal text one can redraw the text over the
|
||||||
|
old one over and over again without any degradation of the text (new pixels
|
||||||
|
simply overwrite old pixels), with antialiased text the situation is
|
||||||
|
different.
|
||||||
|
The pixels that constitute the antialias around the text are partially
|
||||||
|
transparent pixels, which let part of the background be visible through them.
|
||||||
|
If antialiased text is drawn over and over again, whithout first erasing the
|
||||||
|
old one, the partially transparent pixels of the antialias will no longer
|
||||||
|
see the background through them, but some of them will see the old pixels of
|
||||||
|
the antialias around the old text that was there before. This for example
|
||||||
|
will make a black antialiased text over a white background get thicker as
|
||||||
|
the pixels of the antialias around it, combine with semitransparent black
|
||||||
|
pixels of the old antialias instead of combining with the white background.
|
||||||
|
The result is that the antialias will get darker (in this case) and the text
|
||||||
|
will be altered.
|
||||||
|
|
||||||
|
Because of this the area where text is drawn needs to be cleared before
|
||||||
|
antialiased text can be drawn again. But between the moment whent he area is
|
||||||
|
cleared and the moment when the text is drawn again there is a small time
|
||||||
|
gap that results in flickering. This doesn't happen with normal text where
|
||||||
|
one doesn't need to clear the area before drawing the text, but instead can
|
||||||
|
simply draw over and over again.
|
||||||
|
|
||||||
|
To avoid this situation, a double buffering tehnique was used. Instead of
|
||||||
|
drawing directly in the wisget's window (which is mapped and will flicker as
|
||||||
|
described above), we draw in a pixmap (unmapped) and after all is done we
|
||||||
|
XCopyArea() from that pixmap to the real window.
|
||||||
|
Since all this takes place off-screen, no flickering will be observed in
|
||||||
|
this case.
|
||||||
|
|
||||||
|
This is a change that that will be automatically available for your
|
||||||
|
applications and will require no change from you.
|
||||||
|
However there is an exception from this in case of WMList if you delegate
|
||||||
|
the drawing of items to userspace (read below for the compelte details).
|
||||||
|
|
||||||
|
|
||||||
|
*** Mon Oct 14 22:07:42 EEST 2002 - Dan
|
||||||
|
|
||||||
|
WMList change
|
||||||
|
-------------
|
||||||
|
|
||||||
|
In case of WMList there is the posibility to delegate the drawing of the
|
||||||
|
list items to the application that is linked with WINGs, and this code will
|
||||||
|
not be inside the WINGs library, but in userland. Since we use the double
|
||||||
|
buffering tehnique in this case too (to allow all widgets based on WMList
|
||||||
|
and the ones that draw their list items by themselves to benefit from the
|
||||||
|
double buffering advantage automatically), we no longer pass the window to
|
||||||
|
the user code doing item drawing, but instead pass this pixmap in which we
|
||||||
|
draw before copying to the real window.
|
||||||
|
|
||||||
|
Since one cannot use XClearWindow() or XClearArea() on pixmaps, but only on
|
||||||
|
windows, if your list item drawing code used to contain these to clear the
|
||||||
|
item area before drawing it needs to change, else the application will die
|
||||||
|
when it tires to XClearArea() on a pixmap.
|
||||||
|
|
||||||
|
This means that in your application if you ever used WMSetListUserDrawProc()
|
||||||
|
so set a userspace routine which draws WMList items in a particular fashion,
|
||||||
|
you need to make sure your function will not call XClearArea() or
|
||||||
|
XClearWindow() on the drawable that was passed to draw in.
|
||||||
|
|
||||||
|
Instead you should use XFillRectangle().
|
||||||
|
|
||||||
|
This change also means that you no longer need to do double buffering in
|
||||||
|
your code, if you ever used to do. It is not done by WINGs and you benefit
|
||||||
|
from it automatically.
|
||||||
|
|
||||||
|
|
||||||
|
*** Mon Oct 14 19:28:35 EEST 2002 - Dan
|
||||||
|
|
||||||
|
API change
|
||||||
|
----------
|
||||||
|
|
||||||
|
WMDrawString() and WMDrawImageString() no longer take a GC as argument.
|
||||||
|
Instead WMDrawString() takes a WMColor* as the color for the string to be
|
||||||
|
drawn, while WMDrawImageString() takes 2 WMColor* arguments in place of the
|
||||||
|
old GC: first for text color and second for background color.
|
||||||
|
|
||||||
|
This change is required to support extending WMFont to allow it to handle
|
||||||
|
antialiased fonts through the XFree86 Xft extension.
|
||||||
|
|
||||||
|
This also has the advantage of hiding low level X11 details and use WINGs
|
||||||
|
internat objects instead.
|
||||||
|
|
||||||
|
To fix your old code to work with the new WINGs API you need to replace the
|
||||||
|
GC passed to WMDraw***String() in your code with a WMColor*.
|
||||||
|
Most of the old code used to be like this:
|
||||||
|
|
||||||
|
WMDrawString(screen, window, WMColorGC(color), font, x, y, txt, len);
|
||||||
|
|
||||||
|
for the new API it should be replaced by:
|
||||||
|
|
||||||
|
WMDrawString(screen, window, color, font, x, y, txt, len);
|
||||||
|
|
||||||
|
However if you used a particular GC created by yourself to suit your special
|
||||||
|
needs, you need to pass a color which is the same as the foreground color of
|
||||||
|
that gc.
|
||||||
|
|
||||||
|
For WMDrawImageString(), from:
|
||||||
|
|
||||||
|
WMDrawImageString(screen, window, gc, font, x, y, txt, len);
|
||||||
|
|
||||||
|
becomes
|
||||||
|
|
||||||
|
WMDrawImageString(screen, window, textColor, backColor, font, x, y, txt, len);
|
||||||
|
|
||||||
|
where textColor and backColor are declared like:
|
||||||
|
|
||||||
|
WMColor *textColor, *backColor;
|
||||||
|
|
||||||
|
and have the color of the foreground respective the background of the old gc.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*** Wed Oct 9 07:10:04 EEST 2002 - Dan
|
*** Wed Oct 9 07:10:04 EEST 2002 - Dan
|
||||||
|
|
||||||
Xft support in WINGs
|
Xft support in WINGs
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ testList(WMScreen *scr)
|
|||||||
list = WMCreateList(win);
|
list = WMCreateList(win);
|
||||||
/*WMSetListAllowEmptySelection(list, True);*/
|
/*WMSetListAllowEmptySelection(list, True);*/
|
||||||
WMMoveWidget(list, 10, 40);
|
WMMoveWidget(list, 10, 40);
|
||||||
for (i=0; i<14050; i++) {
|
for (i=0; i<105; i++) {
|
||||||
sprintf(text, "Item %i", i);
|
sprintf(text, "Item %i", i);
|
||||||
WMAddListItem(list, text);
|
WMAddListItem(list, text);
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ testList(WMScreen *scr)
|
|||||||
WMSetListAllowMultipleSelection(mlist, True);
|
WMSetListAllowMultipleSelection(mlist, True);
|
||||||
/*WMSetListAllowEmptySelection(mlist, True);*/
|
/*WMSetListAllowEmptySelection(mlist, True);*/
|
||||||
WMMoveWidget(mlist, 210, 40);
|
WMMoveWidget(mlist, 210, 40);
|
||||||
for (i=0; i<14135; i++) {
|
for (i=0; i<135; i++) {
|
||||||
sprintf(text, "Item %i", i);
|
sprintf(text, "Item %i", i);
|
||||||
WMAddListItem(mlist, text);
|
WMAddListItem(mlist, text);
|
||||||
}
|
}
|
||||||
@@ -1264,7 +1264,7 @@ main(int argc, char **argv)
|
|||||||
* Do NOT use it unless when debugging. It will cause a major
|
* Do NOT use it unless when debugging. It will cause a major
|
||||||
* slowdown in your application
|
* slowdown in your application
|
||||||
*/
|
*/
|
||||||
#if 1
|
#if 0
|
||||||
XSynchronize(dpy, True);
|
XSynchronize(dpy, True);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
@@ -1292,8 +1292,10 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
testDragAndDrop(scr);
|
testDragAndDrop(scr);
|
||||||
testText(scr);
|
testText(scr);
|
||||||
|
|
||||||
testFontPanel(scr);
|
testFontPanel(scr);
|
||||||
testList(scr);
|
testList(scr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
testColorPanel(scr);
|
testColorPanel(scr);
|
||||||
testScrollView(scr);
|
testScrollView(scr);
|
||||||
|
|||||||
@@ -709,6 +709,8 @@ void WMReleaseFont(WMFont *font);
|
|||||||
|
|
||||||
unsigned int WMFontHeight(WMFont *font);
|
unsigned int WMFontHeight(WMFont *font);
|
||||||
|
|
||||||
|
Bool WMIsAAFont(WMFont *font);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
WMFont* WMUserFontOfSize(WMScreen *scrPtr, int size);
|
WMFont* WMUserFontOfSize(WMScreen *scrPtr, int size);
|
||||||
|
|
||||||
@@ -820,6 +822,8 @@ unsigned short WMGreenComponentOfColor(WMColor *color);
|
|||||||
|
|
||||||
unsigned short WMBlueComponentOfColor(WMColor *color);
|
unsigned short WMBlueComponentOfColor(WMColor *color);
|
||||||
|
|
||||||
|
unsigned short WMGetColorAlpha(WMColor *color);
|
||||||
|
|
||||||
char* WMGetColorRGBDescription(WMColor *color);
|
char* WMGetColorRGBDescription(WMColor *color);
|
||||||
|
|
||||||
/* ....................................................................... */
|
/* ....................................................................... */
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color)
|
|||||||
gray.red = 0xae;
|
gray.red = 0xae;
|
||||||
gray.green = 0xaa;
|
gray.green = 0xaa;
|
||||||
gray.blue = 0xae;
|
gray.blue = 0xae;
|
||||||
gray.alpha = 0;
|
gray.alpha = 0xff;
|
||||||
|
|
||||||
if (!color)
|
if (!color)
|
||||||
color = &gray;
|
color = &gray;
|
||||||
|
|||||||
@@ -540,15 +540,14 @@ willResizeBrowser(W_ViewDelegate *self, WMView *view,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paintItem(WMList *lPtr, int index, Drawable drawable, char *text, int state,
|
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect)
|
||||||
WMRect *rect)
|
|
||||||
{
|
{
|
||||||
WMView *view = W_VIEW(lPtr);
|
WMView *view = W_VIEW(lPtr);
|
||||||
W_Screen *scr = view->screen;
|
W_Screen *scr = view->screen;
|
||||||
Display *display = scr->display;
|
Display *display = scr->display;
|
||||||
WMFont *font = ((state & WLDSIsBranch) ? scr->boldFont : scr->normalFont);
|
WMFont *font = ((state & WLDSIsBranch) ? scr->boldFont : scr->normalFont);
|
||||||
|
WMColor *backColor = ((state & WLDSSelected) ? scr->white : view->backColor);
|
||||||
int width, height, x, y, textLen;
|
int width, height, x, y, textLen;
|
||||||
Drawable d = drawable;
|
|
||||||
|
|
||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
height = rect->size.height;
|
height = rect->size.height;
|
||||||
@@ -556,20 +555,7 @@ paintItem(WMList *lPtr, int index, Drawable drawable, char *text, int state,
|
|||||||
y = rect->pos.y;
|
y = rect->pos.y;
|
||||||
textLen = strlen(text);
|
textLen = strlen(text);
|
||||||
|
|
||||||
#ifdef DOUBLE_BUFFER_no
|
XFillRectangle(display, d, WMColorGC(backColor), x, y, width, height);
|
||||||
x = y = 0;
|
|
||||||
d = XCreatePixmap(display, drawable, width, height, scr->depth);
|
|
||||||
if (state & WLDSSelected)
|
|
||||||
XFillRectangle(display, d, WMColorGC(scr->white), 0, 0, width, height);
|
|
||||||
else
|
|
||||||
XFillRectangle(display, d, WMColorGC(view->backColor), 0, 0, width, height);
|
|
||||||
#else
|
|
||||||
if (state & WLDSSelected)
|
|
||||||
XFillRectangle(display, d, WMColorGC(scr->white), x, y, width, height);
|
|
||||||
else
|
|
||||||
//XFillRectangle(display, d, WMColorGC(view->backColor), x, y, width, height);
|
|
||||||
XClearArea(display, d, x, y, width, height, False);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
/* Avoid overlaping... */
|
/* Avoid overlaping... */
|
||||||
@@ -586,23 +572,15 @@ paintItem(WMList *lPtr, int index, Drawable drawable, char *text, int state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state & WLDSIsBranch) {
|
if (state & WLDSIsBranch) {
|
||||||
|
WMColor *lineColor = ((state & WLDSSelected) ? scr->gray : scr->white);
|
||||||
|
|
||||||
XDrawLine(display, d, WMColorGC(scr->darkGray), x+width-11, y+3,
|
XDrawLine(display, d, WMColorGC(scr->darkGray), x+width-11, y+3,
|
||||||
x+width-6, y+height/2);
|
x+width-6, y+height/2);
|
||||||
if (state & WLDSSelected)
|
XDrawLine(display, d, WMColorGC(lineColor), x+width-11, y+height-5,
|
||||||
XDrawLine(display, d,WMColorGC(scr->gray), x+width-11, y+height-5,
|
x+width-6, y+height/2);
|
||||||
x+width-6, y+height/2);
|
|
||||||
else
|
|
||||||
XDrawLine(display, d,WMColorGC(scr->white), x+width-11, y+height-5,
|
|
||||||
x+width-6, y+height/2);
|
|
||||||
XDrawLine(display, d, WMColorGC(scr->black), x+width-12, y+3,
|
XDrawLine(display, d, WMColorGC(scr->black), x+width-12, y+3,
|
||||||
x+width-12, y+height-5);
|
x+width-12, y+height-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DOUBLE_BUFFER_no
|
|
||||||
XCopyArea(display, d, drawable, scr->copyGC, 0, 0, width, height,
|
|
||||||
rect->pos.x, rect->pos.y);
|
|
||||||
XFreePixmap(display, d);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -342,6 +342,13 @@ WMBlueComponentOfColor(WMColor *color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned short
|
||||||
|
WMGetColorAlpha(WMColor *color)
|
||||||
|
{
|
||||||
|
return color->alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
WMGetColorRGBDescription(WMColor *color)
|
WMGetColorRGBDescription(WMColor *color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3422,12 +3422,13 @@ static void
|
|||||||
colorListPaintItem(WMList *lPtr, int index, Drawable d, char *text,
|
colorListPaintItem(WMList *lPtr, int index, Drawable d, char *text,
|
||||||
int state, WMRect *rect)
|
int state, WMRect *rect)
|
||||||
{
|
{
|
||||||
int width, height, x, y;
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
RColor color = *((RColor *)WMGetListItem(lPtr, index)->clientData);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMView *view = W_VIEW(lPtr);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
RColor color = *((RColor *)WMGetListItem(lPtr, index)->clientData);
|
||||||
W_ColorPanel *panel = WMGetHangedData(lPtr);
|
W_ColorPanel *panel = WMGetHangedData(lPtr);
|
||||||
WMColor *fillColor;
|
int width, height, x, y;
|
||||||
|
WMColor *fillColor;
|
||||||
|
|
||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
height = rect->size.height;
|
height = rect->size.height;
|
||||||
@@ -3435,15 +3436,14 @@ colorListPaintItem(WMList *lPtr, int index, Drawable d, char *text,
|
|||||||
y = rect->pos.y;
|
y = rect->pos.y;
|
||||||
|
|
||||||
if (state & WLDSSelected)
|
if (state & WLDSSelected)
|
||||||
WMPaintColorSwatch(scr->white, d, x +15, y, width -15, height);
|
XFillRectangle(dpy, d, WMColorGC(scr->white), x, y, width, height);
|
||||||
else
|
else
|
||||||
XClearArea(dpy, d, x +15, y, width -15, height, False);
|
XFillRectangle(dpy, d, WMColorGC(view->backColor), x, y, width, height);
|
||||||
|
|
||||||
fillColor = WMCreateRGBColor(scr, color.red*256, color.green*256,
|
fillColor = WMCreateRGBColor(scr, color.red<<8, color.green<<8,
|
||||||
color.blue*256, False);
|
color.blue<<8, True);
|
||||||
|
|
||||||
WMSetColorInGC(fillColor, WMColorGC(fillColor));
|
XFillRectangle(dpy, d, WMColorGC(fillColor), x, y, 15, height);
|
||||||
WMPaintColorSwatch(fillColor, d, x, y, 15, 15);
|
|
||||||
WMReleaseColor(fillColor);
|
WMReleaseColor(fillColor);
|
||||||
|
|
||||||
WMDrawString(scr, d, scr->black, panel->font12, x+18, y, text, strlen(text));
|
WMDrawString(scr, d, scr->black, panel->font12, x+18, y, text, strlen(text));
|
||||||
|
|||||||
@@ -343,6 +343,12 @@ WMReleaseFont(WMFont *font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bool
|
||||||
|
WMIsAAFont(WMFont *font)
|
||||||
|
{
|
||||||
|
return font->antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
WMFontHeight(WMFont *font)
|
WMFontHeight(WMFont *font)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ typedef struct W_Frame {
|
|||||||
|
|
||||||
char *caption;
|
char *caption;
|
||||||
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
WMReliefType relief:4;
|
WMReliefType relief:4;
|
||||||
WMTitlePosition titlePosition:4;
|
WMTitlePosition titlePosition:4;
|
||||||
@@ -44,8 +43,8 @@ WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief)
|
|||||||
{
|
{
|
||||||
fPtr->flags.relief = relief;
|
fPtr->flags.relief = relief;
|
||||||
|
|
||||||
if (fPtr->view->flags.realized) {
|
if (fPtr->view->flags.realized) {
|
||||||
repaintFrame(fPtr);
|
repaintFrame(fPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,14 +53,15 @@ void
|
|||||||
WMSetFrameTitle(WMFrame *fPtr, char *title)
|
WMSetFrameTitle(WMFrame *fPtr, char *title)
|
||||||
{
|
{
|
||||||
if (fPtr->caption)
|
if (fPtr->caption)
|
||||||
wfree(fPtr->caption);
|
wfree(fPtr->caption);
|
||||||
if (title)
|
|
||||||
fPtr->caption = wstrdup(title);
|
|
||||||
else
|
|
||||||
fPtr->caption = NULL;
|
|
||||||
|
|
||||||
if (fPtr->view->flags.realized) {
|
if (title)
|
||||||
repaintFrame(fPtr);
|
fPtr->caption = wstrdup(title);
|
||||||
|
else
|
||||||
|
fPtr->caption = NULL;
|
||||||
|
|
||||||
|
if (fPtr->view->flags.realized) {
|
||||||
|
repaintFrame(fPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +197,8 @@ paintFrame(Frame *fPtr)
|
|||||||
|
|
||||||
if (drawTitle) {
|
if (drawTitle) {
|
||||||
/* can't draw AA text over and over again because it gets messed */
|
/* can't draw AA text over and over again because it gets messed */
|
||||||
|
// TODO create the dbl buffer pixmap when create/set frame title
|
||||||
if (font->antialiased) {
|
if (font->antialiased) {
|
||||||
#ifdef DOUBLE_BUFFER
|
|
||||||
Drawable d;
|
Drawable d;
|
||||||
|
|
||||||
d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
|
d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
|
||||||
@@ -207,11 +207,6 @@ paintFrame(Frame *fPtr)
|
|||||||
WMDrawString(scrPtr, d, scrPtr->black, font, 0, 0, fPtr->caption, tlen);
|
WMDrawString(scrPtr, d, scrPtr->black, font, 0, 0, fPtr->caption, tlen);
|
||||||
XCopyArea(display, d, view->window, scrPtr->copyGC, 0, 0, tw, th, tx, ty);
|
XCopyArea(display, d, view->window, scrPtr->copyGC, 0, 0, tw, th, tx, ty);
|
||||||
XFreePixmap(display, d);
|
XFreePixmap(display, d);
|
||||||
#else
|
|
||||||
XClearArea(display, view->window, tx, ty, tw, th, False);
|
|
||||||
WMDrawString(scrPtr, view->window, scrPtr->black, font, tx, ty,
|
|
||||||
fPtr->caption, tlen);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
WMDrawString(scrPtr, view->window, scrPtr->black, font, tx, ty,
|
WMDrawString(scrPtr, view->window, scrPtr->black, font, tx, ty,
|
||||||
fPtr->caption, tlen);
|
fPtr->caption, tlen);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ typedef struct W_List {
|
|||||||
|
|
||||||
WMScroller *vScroller;
|
WMScroller *vScroller;
|
||||||
|
|
||||||
|
Pixmap doubleBuffer;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned int allowMultipleSelection:1;
|
unsigned int allowMultipleSelection:1;
|
||||||
unsigned int allowEmptySelection:1;
|
unsigned int allowEmptySelection:1;
|
||||||
@@ -83,6 +85,30 @@ W_ViewDelegate _ListViewDelegate = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
updateDoubleBufferPixmap(WMList *lPtr)
|
||||||
|
{
|
||||||
|
WMView *view = lPtr->view;
|
||||||
|
WMScreen *scr = view->screen;
|
||||||
|
|
||||||
|
if (!view->flags.realized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (lPtr->doubleBuffer)
|
||||||
|
XFreePixmap(scr->display, lPtr->doubleBuffer);
|
||||||
|
lPtr->doubleBuffer =
|
||||||
|
XCreatePixmap(scr->display, view->window, view->size.width,
|
||||||
|
lPtr->itemHeight, scr->depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
realizeObserver(void *self, WMNotification *not)
|
||||||
|
{
|
||||||
|
updateDoubleBufferPixmap(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
releaseItem(void *data)
|
releaseItem(void *data)
|
||||||
{
|
{
|
||||||
@@ -138,6 +164,9 @@ WMCreateList(WMWidget *parent)
|
|||||||
|
|
||||||
W_ResizeView(lPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
W_ResizeView(lPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||||
|
|
||||||
|
WMAddNotificationObserver(realizeObserver, lPtr,
|
||||||
|
WMViewRealizedNotification, lPtr->view);
|
||||||
|
|
||||||
return lPtr;
|
return lPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,11 +303,15 @@ WMSetListUserDrawProc(WMList *lPtr, WMListDrawProc *proc)
|
|||||||
void
|
void
|
||||||
WMSetListUserDrawItemHeight(WMList *lPtr, unsigned short height)
|
WMSetListUserDrawItemHeight(WMList *lPtr, unsigned short height)
|
||||||
{
|
{
|
||||||
|
W_Screen *scr = lPtr->view->screen;
|
||||||
|
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
|
|
||||||
lPtr->flags.userItemHeight = 1;
|
lPtr->flags.userItemHeight = 1;
|
||||||
lPtr->itemHeight = height;
|
lPtr->itemHeight = height;
|
||||||
|
|
||||||
|
updateDoubleBufferPixmap(lPtr);
|
||||||
|
|
||||||
updateGeometry(lPtr);
|
updateGeometry(lPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,6 +527,7 @@ paintItem(List *lPtr, int index)
|
|||||||
Display *display = scr->display;
|
Display *display = scr->display;
|
||||||
int width, height, x, y, tlen;
|
int width, height, x, y, tlen;
|
||||||
WMListItem *itemPtr;
|
WMListItem *itemPtr;
|
||||||
|
Drawable d = lPtr->doubleBuffer;
|
||||||
|
|
||||||
itemPtr = WMGetFromArray(lPtr->items, index);
|
itemPtr = WMGetFromArray(lPtr->items, index);
|
||||||
|
|
||||||
@@ -505,14 +539,13 @@ paintItem(List *lPtr, int index)
|
|||||||
|
|
||||||
if (lPtr->flags.userDrawn) {
|
if (lPtr->flags.userDrawn) {
|
||||||
WMRect rect;
|
WMRect rect;
|
||||||
Drawable d = view->window;
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
|
||||||
rect.size.width = width;
|
rect.size.width = width;
|
||||||
rect.size.height = height;
|
rect.size.height = height;
|
||||||
rect.pos.x = x;
|
rect.pos.x = 0;
|
||||||
rect.pos.y = y;
|
rect.pos.y = 0;
|
||||||
|
|
||||||
flags = itemPtr->uflags;
|
flags = itemPtr->uflags;
|
||||||
if (itemPtr->disabled)
|
if (itemPtr->disabled)
|
||||||
@@ -522,41 +555,18 @@ paintItem(List *lPtr, int index)
|
|||||||
if (itemPtr->isBranch)
|
if (itemPtr->isBranch)
|
||||||
flags |= WLDSIsBranch;
|
flags |= WLDSIsBranch;
|
||||||
|
|
||||||
#ifdef DOUBLE_BUFFER_no
|
|
||||||
d = XCreatePixmap(display, view->window, view->size.width,
|
|
||||||
view->size.height, scr->depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (lPtr->draw)
|
if (lPtr->draw)
|
||||||
(*lPtr->draw)(lPtr, index, d, itemPtr->text, flags, &rect);
|
(*lPtr->draw)(lPtr, index, d, itemPtr->text, flags, &rect);
|
||||||
|
|
||||||
#ifdef DOUBLE_BUFFER_no
|
XCopyArea(display, d, view->window, scr->copyGC, 0, 0, width, height, x, y);
|
||||||
XCopyArea(display, d, view->window, scr->copyGC, x, y, width, height, x, y);
|
|
||||||
XFreePixmap(display, d);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef DOUBLE_BUFFER
|
|
||||||
WMColor *back = (itemPtr->selected ? scr->white : view->backColor);
|
WMColor *back = (itemPtr->selected ? scr->white : view->backColor);
|
||||||
Drawable d;
|
|
||||||
|
|
||||||
d = XCreatePixmap(display, view->window, width, height, scr->depth);
|
|
||||||
XFillRectangle(display, d, WMColorGC(back), 0, 0, width, height);
|
XFillRectangle(display, d, WMColorGC(back), 0, 0, width, height);
|
||||||
|
|
||||||
W_PaintText(view, d, scr->normalFont, 4, 0, width, WALeft, scr->black,
|
W_PaintText(view, d, scr->normalFont, 4, 0, width, WALeft, scr->black,
|
||||||
False, itemPtr->text, tlen);
|
False, itemPtr->text, tlen);
|
||||||
XCopyArea(display, d, view->window, scr->copyGC, 0, 0, width, height, x, y);
|
XCopyArea(display, d, view->window, scr->copyGC, 0, 0, width, height, x, y);
|
||||||
XFreePixmap(display, d);
|
|
||||||
#else
|
|
||||||
if (itemPtr->selected) {
|
|
||||||
XFillRectangle(display, view->window, WMColorGC(scr->white),
|
|
||||||
x, y, width, height);
|
|
||||||
} else {
|
|
||||||
XClearArea(display, view->window, x, y, width, height, False);
|
|
||||||
}
|
|
||||||
|
|
||||||
W_PaintText(view, view->window, scr->normalFont, x+4, y, width,
|
|
||||||
WALeft, scr->black, False, itemPtr->text, tlen);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((index-lPtr->topItem+lPtr->fullFitLines)*lPtr->itemHeight >
|
if ((index-lPtr->topItem+lPtr->fullFitLines)*lPtr->itemHeight >
|
||||||
@@ -1224,9 +1234,12 @@ static void
|
|||||||
didResizeList(W_ViewDelegate *self, WMView *view)
|
didResizeList(W_ViewDelegate *self, WMView *view)
|
||||||
{
|
{
|
||||||
WMList *lPtr = (WMList*)view->self;
|
WMList *lPtr = (WMList*)view->self;
|
||||||
|
W_Screen *scr = view->screen;
|
||||||
|
|
||||||
WMResizeWidget(lPtr->vScroller, 1, view->size.height-2);
|
WMResizeWidget(lPtr->vScroller, 1, view->size.height-2);
|
||||||
|
|
||||||
|
updateDoubleBufferPixmap(lPtr);
|
||||||
|
|
||||||
updateGeometry(lPtr);
|
updateGeometry(lPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1248,6 +1261,9 @@ destroyList(List *lPtr)
|
|||||||
if (lPtr->items)
|
if (lPtr->items)
|
||||||
WMFreeArray(lPtr->items);
|
WMFreeArray(lPtr->items);
|
||||||
|
|
||||||
|
if (lPtr->doubleBuffer)
|
||||||
|
XFreePixmap(lPtr->view->screen->display, lPtr->doubleBuffer);
|
||||||
|
|
||||||
wfree(lPtr);
|
wfree(lPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,18 +40,10 @@ W_ViewDelegate _ProgressIndicatorDelegate = {
|
|||||||
|
|
||||||
static void destroyProgressIndicator(ProgressIndicator *pPtr);
|
static void destroyProgressIndicator(ProgressIndicator *pPtr);
|
||||||
static void paintProgressIndicator(ProgressIndicator *pPtr);
|
static void paintProgressIndicator(ProgressIndicator *pPtr);
|
||||||
static void realizeProgressIndicator(ProgressIndicator *pPtr);
|
|
||||||
static void handleEvents(XEvent *event, void *data);
|
static void handleEvents(XEvent *event, void *data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
realizeObserver(void *self, WMNotification *not)
|
|
||||||
{
|
|
||||||
realizeProgressIndicator(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMProgressIndicator*
|
WMProgressIndicator*
|
||||||
WMCreateProgressIndicator(WMWidget *parent)
|
WMCreateProgressIndicator(WMWidget *parent)
|
||||||
{
|
{
|
||||||
@@ -84,9 +76,6 @@ WMCreateProgressIndicator(WMWidget *parent)
|
|||||||
pPtr->minValue = 0;
|
pPtr->minValue = 0;
|
||||||
pPtr->maxValue = 100;
|
pPtr->maxValue = 100;
|
||||||
|
|
||||||
WMAddNotificationObserver(realizeObserver, pPtr,
|
|
||||||
WMViewRealizedNotification, pPtr->view);
|
|
||||||
|
|
||||||
return pPtr;
|
return pPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,13 +158,6 @@ WMGetProgressIndicatorValue(WMProgressIndicator *progressindicator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
realizeProgressIndicator(ProgressIndicator *pPtr)
|
|
||||||
{
|
|
||||||
W_RealizeView(pPtr->view);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
didResizeProgressIndicator(W_ViewDelegate *self, WMView *view)
|
didResizeProgressIndicator(W_ViewDelegate *self, WMView *view)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ drawLeftMarker(Ruler * rPtr)
|
|||||||
|
|
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static void drawRightMarker(Ruler * rPtr)
|
static void
|
||||||
|
drawRightMarker(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
XPoint points[4];
|
XPoint points[4];
|
||||||
int xpos = (rPtr->flags.whichMarker==2 ? rPtr->motion : rPtr->margins.right);
|
int xpos = (rPtr->flags.whichMarker==2 ? rPtr->motion : rPtr->margins.right);
|
||||||
@@ -121,7 +122,8 @@ static void drawRightMarker(Ruler * rPtr)
|
|||||||
|
|
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static void drawFirstMarker(Ruler * rPtr)
|
static void
|
||||||
|
drawFirstMarker(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
int xpos = ((rPtr->flags.whichMarker == 3 || rPtr->flags.whichMarker == 6) ?
|
int xpos = ((rPtr->flags.whichMarker == 3 || rPtr->flags.whichMarker == 6) ?
|
||||||
rPtr->motion : rPtr->margins.first);
|
rPtr->motion : rPtr->margins.first);
|
||||||
@@ -137,7 +139,8 @@ static void drawFirstMarker(Ruler * rPtr)
|
|||||||
\ /
|
\ /
|
||||||
\./
|
\./
|
||||||
*/
|
*/
|
||||||
static void drawBodyMarker(Ruler * rPtr)
|
static void
|
||||||
|
drawBodyMarker(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
XPoint points[4];
|
XPoint points[4];
|
||||||
int xpos = ((rPtr->flags.whichMarker == 4 || rPtr->flags.whichMarker == 6) ?
|
int xpos = ((rPtr->flags.whichMarker == 4 || rPtr->flags.whichMarker == 6) ?
|
||||||
@@ -154,13 +157,14 @@ static void drawBodyMarker(Ruler * rPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void createDrawBuffer(Ruler * rPtr)
|
static void
|
||||||
|
createDrawBuffer(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
if(!rPtr->view->flags.realized)
|
if(!rPtr->view->flags.realized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rPtr->drawBuffer)
|
if (rPtr->drawBuffer)
|
||||||
XFreePixmap(rPtr->view->screen->display, rPtr->drawBuffer);
|
XFreePixmap(rPtr->view->screen->display, rPtr->drawBuffer);
|
||||||
|
|
||||||
rPtr->drawBuffer = XCreatePixmap(rPtr->view->screen->display,
|
rPtr->drawBuffer = XCreatePixmap(rPtr->view->screen->display,
|
||||||
rPtr->view->window, rPtr->view->size.width, 40,
|
rPtr->view->window, rPtr->view->size.width, 40,
|
||||||
@@ -170,7 +174,8 @@ static void createDrawBuffer(Ruler * rPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void drawRulerOnPixmap(Ruler * rPtr)
|
static void
|
||||||
|
drawRulerOnPixmap(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
int i, j, w, m;
|
int i, j, w, m;
|
||||||
char c[3];
|
char c[3];
|
||||||
@@ -220,7 +225,8 @@ static void drawRulerOnPixmap(Ruler * rPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void paintRuler(Ruler * rPtr)
|
static void
|
||||||
|
paintRuler(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
if (!rPtr->drawBuffer || !rPtr->view->flags.realized)
|
if (!rPtr->drawBuffer || !rPtr->view->flags.realized)
|
||||||
return;
|
return;
|
||||||
@@ -234,7 +240,7 @@ static void paintRuler(Ruler * rPtr)
|
|||||||
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
verifyMarkerMove(Ruler * rPtr, int x)
|
verifyMarkerMove(Ruler * rPtr, int x)
|
||||||
{
|
{
|
||||||
if (rPtr->flags.whichMarker < 1 || rPtr->flags.whichMarker > 6)
|
if (rPtr->flags.whichMarker < 1 || rPtr->flags.whichMarker > 6)
|
||||||
return False;
|
return False;
|
||||||
@@ -279,7 +285,8 @@ static Bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int whichMarker(Ruler * rPtr, int x, int y)
|
static int
|
||||||
|
whichMarker(Ruler * rPtr, int x, int y)
|
||||||
{
|
{
|
||||||
if (x < rPtr->offset || y > 22)
|
if (x < rPtr->offset || y > 22)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -320,7 +327,8 @@ static int whichMarker(Ruler * rPtr, int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rulerDidResize(W_ViewDelegate * self, WMView * view)
|
static void
|
||||||
|
rulerDidResize(W_ViewDelegate * self, WMView * view)
|
||||||
{
|
{
|
||||||
Ruler *rPtr = (Ruler *) view->self;
|
Ruler *rPtr = (Ruler *) view->self;
|
||||||
|
|
||||||
@@ -331,7 +339,8 @@ static void rulerDidResize(W_ViewDelegate * self, WMView * view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void handleEvents(XEvent * event, void *data)
|
static void
|
||||||
|
handleEvents(XEvent * event, void *data)
|
||||||
{
|
{
|
||||||
Ruler *rPtr = (Ruler *) data;
|
Ruler *rPtr = (Ruler *) data;
|
||||||
|
|
||||||
@@ -470,7 +479,8 @@ WMCreateRuler(WMWidget * parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WMSetRulerMargins(WMRuler * rPtr, WMRulerMargins margins)
|
void
|
||||||
|
WMSetRulerMargins(WMRuler * rPtr, WMRulerMargins margins)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return;
|
return;
|
||||||
@@ -529,7 +539,8 @@ WMIsMarginEqualToMargin(WMRulerMargins *aMargin, WMRulerMargins *anotherMargin)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void WMSetRulerOffset(WMRuler * rPtr, int pixels)
|
void
|
||||||
|
WMSetRulerOffset(WMRuler * rPtr, int pixels)
|
||||||
{
|
{
|
||||||
if (!rPtr || pixels < 0 || pixels + MIN_DOC_WIDTH >= rPtr->view->size.width)
|
if (!rPtr || pixels < 0 || pixels + MIN_DOC_WIDTH >= rPtr->view->size.width)
|
||||||
return;
|
return;
|
||||||
@@ -538,7 +549,8 @@ void WMSetRulerOffset(WMRuler * rPtr, int pixels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WMGetRulerOffset(WMRuler * rPtr)
|
int
|
||||||
|
WMGetRulerOffset(WMRuler * rPtr)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return 0; /* what value should return if no ruler? -1 or 0? */
|
return 0; /* what value should return if no ruler? -1 or 0? */
|
||||||
@@ -546,7 +558,8 @@ int WMGetRulerOffset(WMRuler * rPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WMSetRulerReleaseAction(WMRuler * rPtr, WMAction * action, void *clientData)
|
void
|
||||||
|
WMSetRulerReleaseAction(WMRuler * rPtr, WMAction * action, void *clientData)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return;
|
return;
|
||||||
@@ -556,7 +569,8 @@ void WMSetRulerReleaseAction(WMRuler * rPtr, WMAction * action, void *clientData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WMSetRulerMoveAction(WMRuler * rPtr, WMAction * action, void *clientData)
|
void
|
||||||
|
WMSetRulerMoveAction(WMRuler * rPtr, WMAction * action, void *clientData)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return;
|
return;
|
||||||
@@ -567,7 +581,8 @@ void WMSetRulerMoveAction(WMRuler * rPtr, WMAction * action, void *clientData)
|
|||||||
|
|
||||||
|
|
||||||
/* _which_ one was released */
|
/* _which_ one was released */
|
||||||
int WMGetReleasedRulerMargin(WMRuler * rPtr)
|
int
|
||||||
|
WMGetReleasedRulerMargin(WMRuler * rPtr)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -576,7 +591,8 @@ int WMGetReleasedRulerMargin(WMRuler * rPtr)
|
|||||||
|
|
||||||
|
|
||||||
/* _which_ one is being grabbed */
|
/* _which_ one is being grabbed */
|
||||||
int WMGetGrabbedRulerMargin(WMRuler * rPtr)
|
int
|
||||||
|
WMGetGrabbedRulerMargin(WMRuler * rPtr)
|
||||||
{
|
{
|
||||||
if (!rPtr)
|
if (!rPtr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ W_ViewDelegate _SliderViewDelegate = {
|
|||||||
|
|
||||||
static void destroySlider(Slider *sPtr);
|
static void destroySlider(Slider *sPtr);
|
||||||
static void paintSlider(Slider *sPtr);
|
static void paintSlider(Slider *sPtr);
|
||||||
static void realizeSlider(Slider *sPtr);
|
|
||||||
|
|
||||||
static void handleEvents(XEvent *event, void *data);
|
static void handleEvents(XEvent *event, void *data);
|
||||||
static void handleActionEvents(XEvent *event, void *data);
|
static void handleActionEvents(XEvent *event, void *data);
|
||||||
@@ -62,7 +61,7 @@ static void makeKnobPixmap(Slider *sPtr);
|
|||||||
static void
|
static void
|
||||||
realizeObserver(void *self, WMNotification *not)
|
realizeObserver(void *self, WMNotification *not)
|
||||||
{
|
{
|
||||||
realizeSlider(self);
|
makeKnobPixmap(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -294,15 +293,6 @@ makeKnobPixmap(Slider *sPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
realizeSlider(Slider *sPtr)
|
|
||||||
{
|
|
||||||
W_RealizeView(sPtr->view);
|
|
||||||
|
|
||||||
makeKnobPixmap(sPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
didResizeSlider(W_ViewDelegate *self, WMView *view)
|
didResizeSlider(W_ViewDelegate *self, WMView *view)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ void
|
|||||||
W_MoveView(W_View *view, int x, int y)
|
W_MoveView(W_View *view, int x, int y)
|
||||||
{
|
{
|
||||||
assert(view->flags.root==0);
|
assert(view->flags.root==0);
|
||||||
|
//TODO move this after the test pos==oldpos
|
||||||
if (view->delegate && view->delegate->willMove) {
|
if (view->delegate && view->delegate->willMove) {
|
||||||
(*view->delegate->willMove)(view->delegate, view, &x, &y);
|
(*view->delegate->willMove)(view->delegate, view, &x, &y);
|
||||||
}
|
}
|
||||||
@@ -505,7 +505,7 @@ void
|
|||||||
W_ResizeView(W_View *view, unsigned int width, unsigned int height)
|
W_ResizeView(W_View *view, unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
int shrinked;
|
int shrinked;
|
||||||
|
// TODO move this after the test size==oldsize
|
||||||
if (view->delegate && view->delegate->willResize) {
|
if (view->delegate && view->delegate->willResize) {
|
||||||
(*view->delegate->willResize)(view->delegate, view, &width, &height);
|
(*view->delegate->willResize)(view->delegate, view, &width, &height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1296,7 +1296,7 @@ paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
int width, height, x, y;
|
int width, height, x, y;
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
WMColor *white = WMWhiteColor(scr);
|
WMColor *back = (state & WLDSSelected) ? WMWhiteColor(scr) : WMGrayColor(scr);
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
WMColor *black = WMBlackColor(scr);
|
WMColor *black = WMBlackColor(scr);
|
||||||
TextureListItem *titem;
|
TextureListItem *titem;
|
||||||
@@ -1304,7 +1304,7 @@ paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
item = WMGetListItem(lPtr, index);
|
item = WMGetListItem(lPtr, index);
|
||||||
titem = (TextureListItem*)item->clientData;
|
titem = (TextureListItem*)item->clientData;
|
||||||
if (!titem) {
|
if (!titem) {
|
||||||
WMReleaseColor(white);
|
WMReleaseColor(back);
|
||||||
WMReleaseColor(black);
|
WMReleaseColor(black);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1314,11 +1314,7 @@ paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
x = rect->pos.x;
|
x = rect->pos.x;
|
||||||
y = rect->pos.y;
|
y = rect->pos.y;
|
||||||
|
|
||||||
if (state & WLDSSelected)
|
XFillRectangle(dpy, d, WMColorGC(back), x, y, width, height);
|
||||||
XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height);
|
|
||||||
else
|
|
||||||
XClearArea(dpy, d, x, y, width, height, False);
|
|
||||||
|
|
||||||
|
|
||||||
if (titem->preview)
|
if (titem->preview)
|
||||||
XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0,
|
XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0,
|
||||||
@@ -1338,7 +1334,7 @@ paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
strlen(titem->texture));
|
strlen(titem->texture));
|
||||||
|
|
||||||
|
|
||||||
WMReleaseColor(white);
|
WMReleaseColor(back);
|
||||||
WMReleaseColor(black);
|
WMReleaseColor(black);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef struct _Panel {
|
|||||||
|
|
||||||
WMColor *white;
|
WMColor *white;
|
||||||
WMColor *black;
|
WMColor *black;
|
||||||
|
WMColor *gray;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
@@ -433,17 +434,14 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
|
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
|
WMColor *backColor = (state & WLDSSelected) ? panel->white : panel->gray;
|
||||||
|
|
||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
height = rect->size.height;
|
height = rect->size.height;
|
||||||
x = rect->pos.x;
|
x = rect->pos.x;
|
||||||
y = rect->pos.y;
|
y = rect->pos.y;
|
||||||
|
|
||||||
if (state & WLDSSelected)
|
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
|
||||||
XFillRectangle(dpy, d, WMColorGC(panel->white), x, y, width, height);
|
|
||||||
else
|
|
||||||
//XClearArea(dpy, d, x, y, width, height, False);
|
|
||||||
XFillRectangle(dpy, d, WMColorGC(WMGrayColor(scr)), x, y, width, height);
|
|
||||||
|
|
||||||
if (panel->shortcuts[index]) {
|
if (panel->shortcuts[index]) {
|
||||||
WMPixmap *pix = WMGetSystemPixmap(scr, WSICheckMark);
|
WMPixmap *pix = WMGetSystemPixmap(scr, WSICheckMark);
|
||||||
@@ -467,7 +465,10 @@ createPanel(Panel *p)
|
|||||||
|
|
||||||
panel->capturing = 0;
|
panel->capturing = 0;
|
||||||
|
|
||||||
|
panel->white = WMWhiteColor(scr);
|
||||||
|
panel->black = WMBlackColor(scr);
|
||||||
|
panel->gray = WMGrayColor(scr);
|
||||||
|
panel->font = WMSystemFontOfSize(scr, 12);
|
||||||
|
|
||||||
panel->box = WMCreateBox(panel->parent);
|
panel->box = WMCreateBox(panel->parent);
|
||||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||||
@@ -485,9 +486,7 @@ createPanel(Panel *p)
|
|||||||
color = WMDarkGrayColor(scr);
|
color = WMDarkGrayColor(scr);
|
||||||
WMSetWidgetBackgroundColor(panel->actL, color);
|
WMSetWidgetBackgroundColor(panel->actL, color);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
color = WMWhiteColor(scr);
|
WMSetLabelTextColor(panel->actL, panel->white);
|
||||||
WMSetLabelTextColor(panel->actL, color);
|
|
||||||
WMReleaseColor(color);
|
|
||||||
|
|
||||||
panel->actLs = WMCreateList(panel->box);
|
panel->actLs = WMCreateList(panel->box);
|
||||||
WMResizeWidget(panel->actLs, 280, 190);
|
WMResizeWidget(panel->actLs, 280, 190);
|
||||||
@@ -632,17 +631,13 @@ InitKeyboardShortcuts(WMScreen *scr, WMWidget *parent)
|
|||||||
panel->sectionName = _("Keyboard Shortcut Preferences");
|
panel->sectionName = _("Keyboard Shortcut Preferences");
|
||||||
|
|
||||||
panel->description = _("Change the keyboard shortcuts for actions such\n"
|
panel->description = _("Change the keyboard shortcuts for actions such\n"
|
||||||
"as changing workspaces and opening menus.");
|
"as changing workspaces and opening menus.");
|
||||||
|
|
||||||
panel->parent = parent;
|
panel->parent = parent;
|
||||||
|
|
||||||
panel->callbacks.createWidgets = createPanel;
|
panel->callbacks.createWidgets = createPanel;
|
||||||
panel->callbacks.updateDomain = storeData;
|
panel->callbacks.updateDomain = storeData;
|
||||||
|
|
||||||
panel->white = WMWhiteColor(scr);
|
|
||||||
panel->black = WMBlackColor(scr);
|
|
||||||
panel->font = WMSystemFontOfSize(scr, 12);
|
|
||||||
|
|
||||||
AddSection(panel, ICON_FILE);
|
AddSection(panel, ICON_FILE);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ typedef struct _Panel {
|
|||||||
WMColor *red;
|
WMColor *red;
|
||||||
WMColor *black;
|
WMColor *black;
|
||||||
WMColor *white;
|
WMColor *white;
|
||||||
|
WMColor *gray;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
} _Panel;
|
} _Panel;
|
||||||
|
|
||||||
@@ -180,24 +181,20 @@ browseForFile(WMWidget *w, void *data)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect)
|
||||||
WMRect *rect)
|
|
||||||
{
|
{
|
||||||
int width, height, x, y;
|
int width, height, x, y;
|
||||||
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
|
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
|
WMColor *backColor = (state & WLDSSelected) ? panel->white : panel->gray;
|
||||||
|
|
||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
height = rect->size.height;
|
height = rect->size.height;
|
||||||
x = rect->pos.x;
|
x = rect->pos.x;
|
||||||
y = rect->pos.y;
|
y = rect->pos.y;
|
||||||
|
|
||||||
if (state & WLDSSelected)
|
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
|
||||||
XFillRectangle(dpy, d, WMColorGC(panel->white), x, y, width,
|
|
||||||
height);
|
|
||||||
else
|
|
||||||
XClearArea(dpy, d, x, y, width, height, False);
|
|
||||||
|
|
||||||
if (state & 1) {
|
if (state & 1) {
|
||||||
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
|
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
|
||||||
@@ -244,6 +241,7 @@ createPanel(Panel *p)
|
|||||||
|
|
||||||
panel->white = WMWhiteColor(scr);
|
panel->white = WMWhiteColor(scr);
|
||||||
panel->black = WMBlackColor(scr);
|
panel->black = WMBlackColor(scr);
|
||||||
|
panel->gray = WMGrayColor(scr);
|
||||||
panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
|
panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
|
||||||
panel->font = WMSystemFontOfSize(scr, 12);
|
panel->font = WMSystemFontOfSize(scr, 12);
|
||||||
|
|
||||||
|
|||||||
@@ -465,11 +465,12 @@ paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
{
|
{
|
||||||
TexturePanel *panel = (TexturePanel*)WMGetHangedData(lPtr);
|
TexturePanel *panel = (TexturePanel*)WMGetHangedData(lPtr);
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
|
WMColor *white = WMWhiteColor(scr);
|
||||||
|
WMColor *black = WMBlackColor(scr);
|
||||||
|
WMColor *gray = WMGrayColor(scr);
|
||||||
|
WMListItem *item;
|
||||||
int width, height, x, y;
|
int width, height, x, y;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
WMColor *white = WMWhiteColor(scr);
|
|
||||||
WMListItem *item;
|
|
||||||
WMColor *black = WMBlackColor(scr);
|
|
||||||
|
|
||||||
dpy = WMScreenDisplay(scr);
|
dpy = WMScreenDisplay(scr);
|
||||||
|
|
||||||
@@ -481,7 +482,7 @@ paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
if (state & WLDSSelected)
|
if (state & WLDSSelected)
|
||||||
XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height);
|
XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height);
|
||||||
else
|
else
|
||||||
XClearArea(dpy, d, x, y, width, height, False);
|
XFillRectangle(dpy, d, WMColorGC(gray), x, y, width, height);
|
||||||
|
|
||||||
item = WMGetListItem(lPtr, index);
|
item = WMGetListItem(lPtr, index);
|
||||||
|
|
||||||
@@ -494,6 +495,7 @@ paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
|
|
||||||
WMReleaseColor(white);
|
WMReleaseColor(white);
|
||||||
WMReleaseColor(black);
|
WMReleaseColor(black);
|
||||||
|
WMReleaseColor(gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
80
src/dialog.c
80
src/dialog.c
@@ -438,76 +438,67 @@ listIconPaths(WMList *lPtr)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
|
drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
|
||||||
int state, WMRect *rect)
|
WMRect *rect)
|
||||||
{
|
{
|
||||||
IconPanel *panel = WMGetHangedData(lPtr);
|
IconPanel *panel = WMGetHangedData(lPtr);
|
||||||
GC gc = panel->scr->draw_gc;
|
GC gc = panel->scr->draw_gc;
|
||||||
GC copygc = panel->scr->copy_gc;
|
GC copygc = panel->scr->copy_gc;
|
||||||
char *file, *dirfile;
|
char *file, *dirfile;
|
||||||
WMPixmap *pixmap;
|
WMPixmap *pixmap;
|
||||||
WMColor *blackcolor;
|
WMColor *black, *white, *gray, *back;
|
||||||
WMColor *whitecolor;
|
|
||||||
WMSize size;
|
WMSize size;
|
||||||
WMScreen *wmscr = WMWidgetScreen(panel->win);
|
WMScreen *wmscr = WMWidgetScreen(panel->win);
|
||||||
RColor color;
|
RColor color;
|
||||||
int width;
|
int x, y, width, height, len;
|
||||||
|
|
||||||
if(!panel->preview) return;
|
if(!panel->preview) return;
|
||||||
|
|
||||||
|
x = rect->pos.x;
|
||||||
|
y = rect->pos.y;
|
||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
|
height = rect->size.height;
|
||||||
|
|
||||||
blackcolor = WMBlackColor(wmscr);
|
black = WMBlackColor(wmscr);
|
||||||
whitecolor = WMWhiteColor(wmscr);
|
white = WMWhiteColor(wmscr);
|
||||||
|
gray = WMGrayColor(wmscr);
|
||||||
|
back = (state & WLDSSelected) ? white : gray;
|
||||||
|
|
||||||
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
|
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
|
||||||
{
|
len = strlen(dirfile)+strlen(text)+4;
|
||||||
int len = strlen(dirfile)+strlen(text)+4;
|
file = wmalloc(len);
|
||||||
file = wmalloc(len);
|
snprintf(file, len, "%s/%s", dirfile, text);
|
||||||
snprintf(file, len, "%s/%s", dirfile, text);
|
|
||||||
}
|
|
||||||
wfree(dirfile);
|
wfree(dirfile);
|
||||||
|
|
||||||
if ((state & WLDSSelected) != 0) {
|
color.red = WMRedComponentOfColor(back) >> 8;
|
||||||
color.red = color.green = color.blue = 0xff;
|
color.green = WMGreenComponentOfColor(back) >> 8;
|
||||||
color.alpha = 0;
|
color.blue = WMBlueComponentOfColor(back) >> 8;
|
||||||
} else {
|
color.alpha = WMGetColorAlpha(back) >> 8;
|
||||||
color.red = color.blue = 0xae;
|
|
||||||
color.green = 0xaa; color.alpha = 0;
|
|
||||||
}
|
|
||||||
pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color);
|
pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color);
|
||||||
wfree(file);
|
wfree(file);
|
||||||
|
|
||||||
if (!pixmap) {
|
if (!pixmap) {
|
||||||
WMRemoveListItem(lPtr, index);
|
/*WMRemoveListItem(lPtr, index);*/
|
||||||
|
WMReleaseColor(black);
|
||||||
|
WMReleaseColor(white);
|
||||||
|
WMReleaseColor(gray);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XClearArea(dpy, d, rect->pos.x, rect->pos.y, width, rect->size.height,
|
XFillRectangle(dpy, d, WMColorGC(back), x, y, width, height);
|
||||||
False);
|
|
||||||
XSetClipMask(dpy, gc, None);
|
XSetClipMask(dpy, gc, None);
|
||||||
/*
|
/*XDrawRectangle(dpy, d, WMColorGC(white), x+5, y+5, width-10, 54);*/
|
||||||
XDrawRectangle(dpy, d, WMColorGC(whitecolor), rect->pos.x + 5,
|
XDrawLine(dpy, d, WMColorGC(white), x, y+height-1, x+width, y+height-1);
|
||||||
rect->pos.y +5, width - 10, 54);
|
|
||||||
*/
|
|
||||||
XDrawLine(dpy, d, WMColorGC(whitecolor), rect->pos.x,
|
|
||||||
rect->pos.y+rect->size.height-1, rect->pos.x+width,
|
|
||||||
rect->pos.y+rect->size.height-1);
|
|
||||||
|
|
||||||
|
|
||||||
if (state&WLDSSelected) {
|
|
||||||
XFillRectangle(dpy, d, WMColorGC(whitecolor), rect->pos.x,
|
|
||||||
rect->pos.y, width, rect->size.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
size = WMGetPixmapSize(pixmap);
|
size = WMGetPixmapSize(pixmap);
|
||||||
|
|
||||||
XSetClipMask(dpy, copygc, WMGetPixmapMaskXID(pixmap));
|
XSetClipMask(dpy, copygc, WMGetPixmapMaskXID(pixmap));
|
||||||
XSetClipOrigin(dpy, copygc, rect->pos.x + (width-size.width)/2,
|
XSetClipOrigin(dpy, copygc, x + (width-size.width)/2, y+2);
|
||||||
rect->pos.y+2);
|
|
||||||
XCopyArea(dpy, WMGetPixmapXID(pixmap), d, copygc, 0, 0,
|
XCopyArea(dpy, WMGetPixmapXID(pixmap), d, copygc, 0, 0,
|
||||||
size.width>100?100:size.width, size.height>64?64:size.height,
|
size.width>100?100:size.width, size.height>64?64:size.height,
|
||||||
rect->pos.x + (width-size.width)/2, rect->pos.y+2);
|
x + (width-size.width)/2, y+2);
|
||||||
|
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
@@ -516,15 +507,15 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
|
|||||||
int twidth = WMWidthOfString(panel->normalfont, text, tlen);
|
int twidth = WMWidthOfString(panel->normalfont, text, tlen);
|
||||||
int ofx, ofy;
|
int ofx, ofy;
|
||||||
|
|
||||||
ofx = rect->pos.x + (width - twidth)/2;
|
ofx = x + (width - twidth)/2;
|
||||||
ofy = rect->pos.y + 64 - fheight;
|
ofy = y + 64 - fheight;
|
||||||
|
|
||||||
for(i=-1;i<2;i++)
|
for(i=-1;i<2;i++)
|
||||||
for(j=-1;j<2;j++)
|
for(j=-1;j<2;j++)
|
||||||
WMDrawString(wmscr, d, whitecolor, panel->normalfont,
|
WMDrawString(wmscr, d, white, panel->normalfont,
|
||||||
ofx+i, ofy+j, text, tlen);
|
ofx+i, ofy+j, text, tlen);
|
||||||
|
|
||||||
WMDrawString(wmscr, d, blackcolor, panel->normalfont, ofx, ofy,
|
WMDrawString(wmscr, d, black, panel->normalfont, ofx, ofy,
|
||||||
text, tlen);
|
text, tlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,8 +523,9 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
|
|||||||
/* I hope it is better to do not use cache / on my box it is fast nuff */
|
/* I hope it is better to do not use cache / on my box it is fast nuff */
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
WMReleaseColor(blackcolor);
|
WMReleaseColor(black);
|
||||||
WMReleaseColor(whitecolor);
|
WMReleaseColor(white);
|
||||||
|
WMReleaseColor(gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,12 +97,12 @@ static int intersectArea(int x1, int y1, int w1, int h1,
|
|||||||
rect1.x1 = x1;
|
rect1.x1 = x1;
|
||||||
rect1.y1 = y1;
|
rect1.y1 = y1;
|
||||||
rect1.x2 = x1+w1;
|
rect1.x2 = x1+w1;
|
||||||
rect1.x2 = y1+w1;
|
rect1.y2 = y1+h1;
|
||||||
|
|
||||||
rect2.x1 = x2;
|
rect2.x1 = x2;
|
||||||
rect2.y1 = y2;
|
rect2.y1 = y2;
|
||||||
rect2.x2 = x2+w2;
|
rect2.x2 = x2+w2;
|
||||||
rect2.x2 = y2+w2;
|
rect2.y2 = y2+h2;
|
||||||
|
|
||||||
if (intersect_rectangles(&rect1, &rect2, &result))
|
if (intersect_rectangles(&rect1, &rect2, &result))
|
||||||
return (result.x2-result.x1)*(result.y2-result.y1);
|
return (result.x2-result.x1)*(result.y2-result.y1);
|
||||||
@@ -195,7 +195,8 @@ int wGetHeadForPointerLocation(WScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get the dimensions of the head */
|
/* get the dimensions of the head */
|
||||||
WMRect wGetRectForHead(WScreen *scr, int head)
|
WMRect
|
||||||
|
wGetRectForHead(WScreen *scr, int head)
|
||||||
{
|
{
|
||||||
WMRect rect;
|
WMRect rect;
|
||||||
|
|
||||||
@@ -204,38 +205,35 @@ WMRect wGetRectForHead(WScreen *scr, int head)
|
|||||||
rect.pos.y = scr->xine_screens[head].y_org;
|
rect.pos.y = scr->xine_screens[head].y_org;
|
||||||
rect.size.width = scr->xine_screens[head].width;
|
rect.size.width = scr->xine_screens[head].width;
|
||||||
rect.size.height = scr->xine_screens[head].height;
|
rect.size.height = scr->xine_screens[head].height;
|
||||||
|
|
||||||
return rect;
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
rect.pos.x = 0;
|
rect.pos.x = 0;
|
||||||
rect.pos.y = 0;
|
rect.pos.y = 0;
|
||||||
rect.size.width = scr->scr_width;
|
rect.size.width = scr->scr_width;
|
||||||
rect.size.height = scr->scr_height;
|
rect.size.height = scr->scr_height;
|
||||||
|
|
||||||
return rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMRect wGetUsableRectForHead(WScreen *scr, int head)
|
WMRect
|
||||||
|
wGetUsableRectForHead(WScreen *scr, int head)
|
||||||
{
|
{
|
||||||
|
WMRect rect;
|
||||||
|
|
||||||
if (head < scr->xine_count) {
|
if (head < scr->xine_count) {
|
||||||
rect.pos.x = scr->xine_screens[head].x_org;
|
rect.pos.x = scr->xine_screens[head].x_org;
|
||||||
rect.pos.y = scr->xine_screens[head].y_org;
|
rect.pos.y = scr->xine_screens[head].y_org;
|
||||||
rect.size.width = scr->xine_screens[head].width;
|
rect.size.width = scr->xine_screens[head].width;
|
||||||
rect.size.height = scr->xine_screens[head].height;
|
rect.size.height = scr->xine_screens[head].height;
|
||||||
|
|
||||||
return rect;
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
rect.pos.x = 0;
|
rect.pos.x = 0;
|
||||||
rect.pos.y = 0;
|
rect.pos.y = 0;
|
||||||
rect.size.width = scr->scr_width;
|
rect.size.width = scr->scr_width;
|
||||||
rect.size.height = scr->scr_height;
|
rect.size.height = scr->scr_height;
|
||||||
|
|
||||||
return rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user