mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-03 23:05:46 +01:00
bug fixes, performance enhancement for image rendering
This commit is contained in:
@@ -862,7 +862,7 @@ handleLogoPush(XEvent *event, void *data)
|
||||
|
||||
|
||||
clicks++;
|
||||
if (!panel->timer && !broken && clicks > 2) {
|
||||
if (!panel->timer && !broken && clicks > 0) {
|
||||
char *file;
|
||||
char *path;
|
||||
|
||||
|
||||
101
src/framewin.c
101
src/framewin.c
@@ -57,6 +57,10 @@ static void paintButton(WCoreWindow *button, WTexture *texture,
|
||||
|
||||
static void updateTitlebar(WFrameWindow *fwin);
|
||||
|
||||
static void remakeTexture(WFrameWindow *fwin, int state, int newWidth);
|
||||
|
||||
static void updateTexture(WFrameWindow *fwin);
|
||||
|
||||
|
||||
WFrameWindow*
|
||||
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
||||
@@ -138,13 +142,15 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
||||
if (flags & WFF_TITLEBAR) {
|
||||
fwin->top_width = theight;
|
||||
|
||||
fwin->flags.need_texture_remake = 1;
|
||||
|
||||
fwin->flags.need_texture1_remake = 1;
|
||||
fwin->flags.need_texture2_remake = 1;
|
||||
fwin->flags.need_texture3_remake = 1;
|
||||
|
||||
if (wPreferences.new_style) {
|
||||
if (fwin->left_button) {
|
||||
wCoreConfigure(fwin->left_button, 0, 0, bsize, bsize);
|
||||
}
|
||||
|
||||
|
||||
if (fwin->right_button) {
|
||||
wCoreConfigure(fwin->right_button, width-bsize+1,
|
||||
0, bsize, bsize);
|
||||
@@ -154,7 +160,7 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
||||
wCoreConfigure(fwin->left_button, 3, (theight-bsize)/2,
|
||||
bsize, bsize);
|
||||
}
|
||||
|
||||
|
||||
if (fwin->right_button) {
|
||||
wCoreConfigure(fwin->right_button, width-bsize-3,
|
||||
(theight-bsize)/2, bsize, bsize);
|
||||
@@ -173,25 +179,25 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
||||
if (fwin->left_button)
|
||||
wCoreDestroy(fwin->left_button);
|
||||
fwin->left_button = NULL;
|
||||
|
||||
|
||||
if (fwin->right_button)
|
||||
wCoreDestroy(fwin->right_button);
|
||||
fwin->right_button = NULL;
|
||||
|
||||
|
||||
wCoreDestroy(fwin->titlebar);
|
||||
fwin->titlebar = NULL;
|
||||
|
||||
|
||||
fwin->top_width = 0;
|
||||
}
|
||||
} else {
|
||||
/* if we didn't have a titlebar and are being requested for
|
||||
* one, create it */
|
||||
if (flags & WFF_TITLEBAR) {
|
||||
if (flags & WFF_TITLEBAR) {
|
||||
fwin->top_width = theight;
|
||||
|
||||
|
||||
fwin->flags.titlebar = 1;
|
||||
fwin->titlebar = wCoreCreate(fwin->core, 0, 0, width+1, theight);
|
||||
|
||||
|
||||
if (flags & WFF_LEFT_BUTTON) {
|
||||
fwin->flags.left_button = 1;
|
||||
if (wPreferences.new_style) {
|
||||
@@ -245,7 +251,9 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
||||
|
||||
XMapRaised(dpy, fwin->titlebar->window);
|
||||
|
||||
fwin->flags.need_texture_remake = 1;
|
||||
fwin->flags.need_texture1_remake = 1;
|
||||
fwin->flags.need_texture2_remake = 1;
|
||||
fwin->flags.need_texture3_remake = 1;
|
||||
}
|
||||
}
|
||||
checkTitleSize(fwin);
|
||||
@@ -272,7 +280,9 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
||||
XMapWindow(dpy, fwin->resizebar->window);
|
||||
XLowerWindow(dpy, fwin->resizebar->window);
|
||||
|
||||
fwin->flags.need_texture_remake = 1;
|
||||
fwin->flags.need_texture1_remake = 1;
|
||||
fwin->flags.need_texture2_remake = 1;
|
||||
fwin->flags.need_texture3_remake = 1;
|
||||
} else {
|
||||
if (height+fwin->top_width+fwin->bottom_width != fwin->core->height) {
|
||||
wCoreConfigure(fwin->resizebar, 0, height + fwin->top_width,
|
||||
@@ -405,8 +415,11 @@ updateTitlebar(WFrameWindow *fwin)
|
||||
}
|
||||
}
|
||||
|
||||
if (wPreferences.new_style || fwin->titlebar->width!=w)
|
||||
fwin->flags.need_texture_remake = 1;
|
||||
if (wPreferences.new_style || fwin->titlebar->width!=w) {
|
||||
fwin->flags.need_texture1_remake = 1;
|
||||
fwin->flags.need_texture2_remake = 1;
|
||||
fwin->flags.need_texture3_remake = 1;
|
||||
}
|
||||
|
||||
wCoreConfigure(fwin->titlebar, x, 0, w, theight);
|
||||
}
|
||||
@@ -646,12 +659,13 @@ updateTexture(WFrameWindow *fwin)
|
||||
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
||||
}
|
||||
}
|
||||
XFlush(dpy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
remakeTexture(WFrameWindow *fwin, int state)
|
||||
remakeTexture(WFrameWindow *fwin, int state, int newWidth)
|
||||
{
|
||||
Pixmap pmap, lpmap, rpmap;
|
||||
|
||||
@@ -672,7 +686,7 @@ remakeTexture(WFrameWindow *fwin, int state)
|
||||
right = fwin->right_button && !fwin->flags.hide_right_button
|
||||
&& !fwin->flags.rbutton_dont_fit;
|
||||
|
||||
width = fwin->core->width+1;
|
||||
width = newWidth+1;
|
||||
|
||||
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
|
||||
width, fwin->titlebar->height,
|
||||
@@ -687,7 +701,7 @@ remakeTexture(WFrameWindow *fwin, int state)
|
||||
}
|
||||
}
|
||||
if (fwin->resizebar_texture && fwin->resizebar_texture[0]
|
||||
&& fwin->resizebar && state == 0) {
|
||||
&& fwin->resizebar && state == fwin->flags.state) {
|
||||
|
||||
FREE_PIXMAP(fwin->resizebar_back[0]);
|
||||
|
||||
@@ -695,8 +709,7 @@ remakeTexture(WFrameWindow *fwin, int state)
|
||||
|
||||
renderResizebarTexture(fwin->screen_ptr,
|
||||
fwin->resizebar_texture[0],
|
||||
fwin->resizebar->width,
|
||||
fwin->resizebar->height,
|
||||
newWidth, fwin->resizebar->height,
|
||||
fwin->resizebar_corner_width,
|
||||
&pmap);
|
||||
|
||||
@@ -722,31 +735,42 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
if (fwin->flags.is_client_window_frame)
|
||||
fwin->flags.justification = wPreferences.title_justification;
|
||||
|
||||
if (fwin->flags.need_texture_remake) {
|
||||
int i;
|
||||
|
||||
fwin->flags.need_texture_remake = 0;
|
||||
fwin->flags.need_texture_change = 0;
|
||||
if (fwin->flags.need_texture1_remake || fwin->flags.need_texture2_remake
|
||||
|| fwin->flags.need_texture3_remake) {
|
||||
|
||||
if (fwin->flags.single_texture) {
|
||||
remakeTexture(fwin, 0);
|
||||
updateTexture(fwin);
|
||||
} else {
|
||||
/* first render the texture for the current state... */
|
||||
remakeTexture(fwin, fwin->flags.state);
|
||||
/* ... and paint it */
|
||||
updateTexture(fwin);
|
||||
|
||||
for (i=0; i < 3; i++) {
|
||||
if (i!=fwin->flags.state)
|
||||
remakeTexture(fwin, i);
|
||||
}
|
||||
fwin->flags.need_texture_change = 1;
|
||||
|
||||
fwin->flags.need_texture1_remake = 0;
|
||||
fwin->flags.need_texture2_remake = 0;
|
||||
fwin->flags.need_texture3_remake = 0;
|
||||
|
||||
remakeTexture(fwin, 0, fwin->core->width);
|
||||
|
||||
} else if (fwin->flags.state==0 && fwin->flags.need_texture1_remake) {
|
||||
|
||||
fwin->flags.need_texture_change = 1;
|
||||
fwin->flags.need_texture1_remake = 0;
|
||||
remakeTexture(fwin, fwin->flags.state, fwin->core->width);
|
||||
|
||||
} else if (fwin->flags.state==1 && fwin->flags.need_texture2_remake) {
|
||||
|
||||
fwin->flags.need_texture_change = 1;
|
||||
fwin->flags.need_texture2_remake = 0;
|
||||
remakeTexture(fwin, fwin->flags.state, fwin->core->width);
|
||||
|
||||
} else if (fwin->flags.state==2 && fwin->flags.need_texture3_remake) {
|
||||
|
||||
fwin->flags.need_texture_change = 1;
|
||||
fwin->flags.need_texture3_remake = 0;
|
||||
remakeTexture(fwin, fwin->flags.state, fwin->core->width);
|
||||
}
|
||||
}
|
||||
|
||||
if (fwin->flags.need_texture_change) {
|
||||
fwin->flags.need_texture_change = 0;
|
||||
|
||||
|
||||
updateTexture(fwin);
|
||||
}
|
||||
|
||||
@@ -853,7 +877,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
}
|
||||
|
||||
#ifdef TITLE_TEXT_SHADOW
|
||||
if(wPreferences.title_shadow){
|
||||
if(wPreferences.title_shadow) {
|
||||
int shadowx,shadowy;
|
||||
XSetForeground(dpy, *fwin->title_gc,
|
||||
fwin->title_pixel[fwin->flags.state+3]);
|
||||
@@ -904,7 +928,6 @@ reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
|
||||
height - fwin->resizebar->height);
|
||||
*/
|
||||
if (fwin->core->width != width) {
|
||||
fwin->flags.need_texture_remake = 1;
|
||||
resizedHorizontally = 1;
|
||||
}
|
||||
|
||||
@@ -973,12 +996,14 @@ reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wFrameWindowConfigure(WFrameWindow *fwin, int x, int y, int width, int height)
|
||||
{
|
||||
reconfigure(fwin, x, y, width, height, False);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wFrameWindowResize(WFrameWindow *fwin, int width, int height)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,11 @@ typedef struct WFrameWindow {
|
||||
unsigned int resizebar:1;
|
||||
unsigned int left_button:1;
|
||||
unsigned int right_button:1;
|
||||
unsigned int need_texture_remake:1;
|
||||
|
||||
unsigned int need_texture1_remake:1;
|
||||
unsigned int need_texture2_remake:1;
|
||||
unsigned int need_texture3_remake:1;
|
||||
|
||||
unsigned int single_texture:1;
|
||||
|
||||
unsigned int hide_left_button:1;
|
||||
|
||||
@@ -118,7 +118,7 @@ appearanceObserver(void *self, WMNotification *notif)
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
if (flags & WTextureSettings) {
|
||||
menu->frame->flags.need_texture_remake = 1;
|
||||
menu->frame->flags.need_texture1_remake = 1;
|
||||
}
|
||||
if (flags & (WColorSettings|WTextureSettings))
|
||||
wFrameWindowPaint(menu->frame);
|
||||
|
||||
@@ -714,7 +714,10 @@ wScreenInit(int screen_number)
|
||||
|
||||
/* screen descriptor for raster graphic library */
|
||||
rattr.flags = RC_RenderMode | RC_ColorsPerChannel;
|
||||
rattr.render_mode = wPreferences.no_dithering?RM_MATCH:RM_DITHER;
|
||||
rattr.render_mode = wPreferences.no_dithering
|
||||
? RBestMatchRendering
|
||||
: RDitheredRendering;
|
||||
|
||||
rattr.colors_per_channel = wPreferences.cmap_size;
|
||||
if (rattr.colors_per_channel<2)
|
||||
rattr.colors_per_channel = 2;
|
||||
|
||||
@@ -363,7 +363,7 @@
|
||||
#define MENU_SELECT_DELAY 200
|
||||
|
||||
/* delay for jumpback of scrolled menus */
|
||||
#define MENU_JUMP_BACK_DELAY 300
|
||||
#define MENU_JUMP_BACK_DELAY 400
|
||||
|
||||
/* *** animation speed constants *** */
|
||||
|
||||
|
||||
@@ -144,7 +144,9 @@ appearanceObserver(void *self, WMNotification *notif)
|
||||
wWindowConfigureBorders(wwin);
|
||||
}
|
||||
if (flags & WTextureSettings) {
|
||||
wwin->frame->flags.need_texture_remake = 1;
|
||||
wwin->frame->flags.need_texture1_remake = 1;
|
||||
wwin->frame->flags.need_texture2_remake = 1;
|
||||
wwin->frame->flags.need_texture3_remake = 1;
|
||||
}
|
||||
if (flags & (WTextureSettings | WColorSettings)) {
|
||||
if (wwin->frame->titlebar)
|
||||
|
||||
Reference in New Issue
Block a user