mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 06:38:05 +01:00
changed indentation to use spaces only
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Window Maker window manager
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1997-2003 Alfredo K. Kojima
|
||||
* Copyright (c) 1998-2003 Dan Pascu
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
@@ -51,7 +51,7 @@ static void
|
||||
play(Display *dpy, int pitch, int delay)
|
||||
{
|
||||
XKeyboardControl kc;
|
||||
|
||||
|
||||
kc.bell_pitch = pitch;
|
||||
kc.bell_percent = 50;
|
||||
kc.bell_duration = delay;
|
||||
@@ -77,23 +77,23 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
|
||||
XGCValues gcv;
|
||||
int i;
|
||||
int w, h;
|
||||
int run;
|
||||
XEvent event;
|
||||
int run;
|
||||
XEvent event;
|
||||
|
||||
h = w = wPreferences.icon_size;
|
||||
if (x < 0 || x + w > scr->scr_width || y < 0 || y + h > scr->scr_height)
|
||||
return;
|
||||
return;
|
||||
|
||||
icon = RCreateImageFromDrawable(scr->rcontext, win, None);
|
||||
if (!icon)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
gcv.foreground = scr->white_pixel;
|
||||
gcv.background = scr->black_pixel;
|
||||
gcv.graphics_exposures = False;
|
||||
gcv.subwindow_mode = IncludeInferiors;
|
||||
gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground|GCSubwindowMode
|
||||
|GCGraphicsExposures, &gcv);
|
||||
|GCGraphicsExposures, &gcv);
|
||||
|
||||
|
||||
XGrabServer(dpy);
|
||||
@@ -113,19 +113,19 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
|
||||
|
||||
|
||||
for (i=0,run=0; i<DEMATERIALIZE_STEPS; i++) {
|
||||
XEvent foo;
|
||||
if (!run && XCheckTypedEvent(dpy, ButtonPress, &foo)) {
|
||||
run=1;
|
||||
XPutBackEvent(dpy, &foo);
|
||||
}
|
||||
image = RCloneImage(back);
|
||||
RCombineImagesWithOpaqueness(image, icon,
|
||||
(DEMATERIALIZE_STEPS-1-i)*256/(DEMATERIALIZE_STEPS+2));
|
||||
RConvertImage(scr->rcontext, image, &pixmap);
|
||||
XCopyArea(dpy, pixmap, scr->root_win, gc, 0, 0, w, h, x, y);
|
||||
XFreePixmap(dpy, pixmap);
|
||||
XFlush(dpy);
|
||||
if(!run) wusleep(1000);
|
||||
XEvent foo;
|
||||
if (!run && XCheckTypedEvent(dpy, ButtonPress, &foo)) {
|
||||
run=1;
|
||||
XPutBackEvent(dpy, &foo);
|
||||
}
|
||||
image = RCloneImage(back);
|
||||
RCombineImagesWithOpaqueness(image, icon,
|
||||
(DEMATERIALIZE_STEPS-1-i)*256/(DEMATERIALIZE_STEPS+2));
|
||||
RConvertImage(scr->rcontext, image, &pixmap);
|
||||
XCopyArea(dpy, pixmap, scr->root_win, gc, 0, 0, w, h, x, y);
|
||||
XFreePixmap(dpy, pixmap);
|
||||
XFlush(dpy);
|
||||
if(!run) wusleep(1000);
|
||||
}
|
||||
|
||||
while (XCheckTypedEvent(dpy, MotionNotify, &event)) {
|
||||
@@ -163,130 +163,130 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
|
||||
Pixmap tmp;
|
||||
|
||||
XSetClipMask(dpy, scr->copy_gc, None);
|
||||
tmp = XCreatePixmap(dpy, scr->root_win, wPreferences.icon_size,
|
||||
wPreferences.icon_size, scr->depth);
|
||||
tmp = XCreatePixmap(dpy, scr->root_win, wPreferences.icon_size,
|
||||
wPreferences.icon_size, scr->depth);
|
||||
if (scr->w_visual == DefaultVisual(dpy, scr->screen))
|
||||
XCopyArea(dpy, win, tmp, scr->copy_gc, 0, 0, wPreferences.icon_size,
|
||||
wPreferences.icon_size, 0, 0);
|
||||
XCopyArea(dpy, win, tmp, scr->copy_gc, 0, 0, wPreferences.icon_size,
|
||||
wPreferences.icon_size, 0, 0);
|
||||
else {
|
||||
XImage *image;
|
||||
XImage *image;
|
||||
|
||||
image = XGetImage(dpy, win, 0, 0, wPreferences.icon_size,
|
||||
wPreferences.icon_size, AllPlanes, ZPixmap);
|
||||
if (!image) {
|
||||
XUnmapWindow(dpy, win);
|
||||
return;
|
||||
}
|
||||
XPutImage(dpy, tmp, scr->copy_gc, image, 0, 0, 0, 0,
|
||||
wPreferences.icon_size, wPreferences.icon_size);
|
||||
XDestroyImage(image);
|
||||
image = XGetImage(dpy, win, 0, 0, wPreferences.icon_size,
|
||||
wPreferences.icon_size, AllPlanes, ZPixmap);
|
||||
if (!image) {
|
||||
XUnmapWindow(dpy, win);
|
||||
return;
|
||||
}
|
||||
XPutImage(dpy, tmp, scr->copy_gc, image, 0, 0, 0, 0,
|
||||
wPreferences.icon_size, wPreferences.icon_size);
|
||||
XDestroyImage(image);
|
||||
}
|
||||
|
||||
for (i=0,k=0; i<wPreferences.icon_size/ICON_KABOOM_PIECE_SIZE && k<PIECES;
|
||||
i++) {
|
||||
for (j=0; j<wPreferences.icon_size/ICON_KABOOM_PIECE_SIZE && k<PIECES;
|
||||
j++) {
|
||||
if (rand()%2) {
|
||||
ax[k]=i;
|
||||
ay[k]=j;
|
||||
px[k]=(x+i*ICON_KABOOM_PIECE_SIZE)<<KAB_PRECISION;
|
||||
py[k]=y+j*ICON_KABOOM_PIECE_SIZE;
|
||||
pvx[k]=rand()%(1<<(KAB_PRECISION+3))-(1<<(KAB_PRECISION+3))/2;
|
||||
i++) {
|
||||
for (j=0; j<wPreferences.icon_size/ICON_KABOOM_PIECE_SIZE && k<PIECES;
|
||||
j++) {
|
||||
if (rand()%2) {
|
||||
ax[k]=i;
|
||||
ay[k]=j;
|
||||
px[k]=(x+i*ICON_KABOOM_PIECE_SIZE)<<KAB_PRECISION;
|
||||
py[k]=y+j*ICON_KABOOM_PIECE_SIZE;
|
||||
pvx[k]=rand()%(1<<(KAB_PRECISION+3))-(1<<(KAB_PRECISION+3))/2;
|
||||
pvy[k]=-15-rand()%7;
|
||||
#ifdef ICON_KABOOM_EXTRA
|
||||
for (ll=0; ll<2; ll++) {
|
||||
ptx[ll][k] = px[k];
|
||||
pty[ll][k] = py[k];
|
||||
}
|
||||
for (ll=0; ll<2; ll++) {
|
||||
ptx[ll][k] = px[k];
|
||||
pty[ll][k] = py[k];
|
||||
}
|
||||
#endif
|
||||
k++;
|
||||
} else {
|
||||
ax[k]=-1;
|
||||
}
|
||||
}
|
||||
k++;
|
||||
} else {
|
||||
ax[k]=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XUnmapWindow(dpy, win);
|
||||
|
||||
j=k;
|
||||
while (k>0) {
|
||||
XEvent foo;
|
||||
XEvent foo;
|
||||
|
||||
if (XCheckTypedEvent(dpy, ButtonPress, &foo)) {
|
||||
XPutBackEvent(dpy, &foo);
|
||||
XClearWindow(dpy, scr->root_win);
|
||||
break;
|
||||
}
|
||||
if (XCheckTypedEvent(dpy, ButtonPress, &foo)) {
|
||||
XPutBackEvent(dpy, &foo);
|
||||
XClearWindow(dpy, scr->root_win);
|
||||
break;
|
||||
}
|
||||
|
||||
for (i=0; i<j ; i++) {
|
||||
if (ax[i]>=0) {
|
||||
int _px = px[i]>>KAB_PRECISION;
|
||||
for (i=0; i<j ; i++) {
|
||||
if (ax[i]>=0) {
|
||||
int _px = px[i]>>KAB_PRECISION;
|
||||
#ifdef ICON_KABOOM_EXTRA
|
||||
XClearArea(dpy, scr->root_win, ptx[1][i], pty[1][i],
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
False);
|
||||
XClearArea(dpy, scr->root_win, ptx[1][i], pty[1][i],
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
False);
|
||||
|
||||
ptx[1][i] = ptx[0][i];
|
||||
pty[1][i] = pty[0][i];
|
||||
ptx[0][i] = _px;
|
||||
pty[0][i] = py[i];
|
||||
ptx[1][i] = ptx[0][i];
|
||||
pty[1][i] = pty[0][i];
|
||||
ptx[0][i] = _px;
|
||||
pty[0][i] = py[i];
|
||||
#else
|
||||
XClearArea(dpy, scr->root_win, _px, py[i],
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
False);
|
||||
XClearArea(dpy, scr->root_win, _px, py[i],
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
False);
|
||||
#endif
|
||||
px[i]+=pvx[i];
|
||||
py[i]+=pvy[i];
|
||||
_px = px[i]>>KAB_PRECISION;
|
||||
px[i]+=pvx[i];
|
||||
py[i]+=pvy[i];
|
||||
_px = px[i]>>KAB_PRECISION;
|
||||
pvy[i]++;
|
||||
if (_px<-wPreferences.icon_size || _px>sw || py[i]>=sh) {
|
||||
#ifdef ICON_KABOOM_EXTRA
|
||||
if (py[i]>sh && _px<sw && _px>0) {
|
||||
pvy[i] = -(pvy[i]/2);
|
||||
if (abs(pvy[i]) > 3) {
|
||||
py[i] = sh-ICON_KABOOM_PIECE_SIZE;
|
||||
XCopyArea(dpy, tmp, scr->root_win, scr->copy_gc,
|
||||
ax[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ay[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
_px, py[i]);
|
||||
} else {
|
||||
ax[i] = -1;
|
||||
}
|
||||
} else {
|
||||
ax[i] = -1;
|
||||
}
|
||||
if (ax[i]<0) {
|
||||
for (ll=0; ll<2; ll++)
|
||||
XClearArea(dpy, scr->root_win, ptx[ll][i], pty[ll][i],
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE, False);
|
||||
k--;
|
||||
}
|
||||
if (py[i]>sh && _px<sw && _px>0) {
|
||||
pvy[i] = -(pvy[i]/2);
|
||||
if (abs(pvy[i]) > 3) {
|
||||
py[i] = sh-ICON_KABOOM_PIECE_SIZE;
|
||||
XCopyArea(dpy, tmp, scr->root_win, scr->copy_gc,
|
||||
ax[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ay[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
_px, py[i]);
|
||||
} else {
|
||||
ax[i] = -1;
|
||||
}
|
||||
} else {
|
||||
ax[i] = -1;
|
||||
}
|
||||
if (ax[i]<0) {
|
||||
for (ll=0; ll<2; ll++)
|
||||
XClearArea(dpy, scr->root_win, ptx[ll][i], pty[ll][i],
|
||||
ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE, False);
|
||||
k--;
|
||||
}
|
||||
#else /* !ICON_KABOOM_EXTRA */
|
||||
ax[i]=-1;
|
||||
k--;
|
||||
k--;
|
||||
#endif /* !ICON_KABOOM_EXTRA */
|
||||
} else {
|
||||
XCopyArea(dpy, tmp, scr->root_win, scr->copy_gc,
|
||||
ax[i]*ICON_KABOOM_PIECE_SIZE, ay[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
_px, py[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
XCopyArea(dpy, tmp, scr->root_win, scr->copy_gc,
|
||||
ax[i]*ICON_KABOOM_PIECE_SIZE, ay[i]*ICON_KABOOM_PIECE_SIZE,
|
||||
ICON_KABOOM_PIECE_SIZE, ICON_KABOOM_PIECE_SIZE,
|
||||
_px, py[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XFlush(dpy);
|
||||
XFlush(dpy);
|
||||
#ifdef SPEAKER_SOUND
|
||||
play(dpy, 100+rand()%250, 12);
|
||||
play(dpy, 100+rand()%250, 12);
|
||||
#else
|
||||
# if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
|
||||
wusleep(MINIATURIZE_ANIMATION_DELAY_Z*2);
|
||||
# if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
|
||||
wusleep(MINIATURIZE_ANIMATION_DELAY_Z*2);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
XFreePixmap(dpy, tmp);
|
||||
}
|
||||
#endif /* NORMAL_ICON_KABOOM */
|
||||
@@ -314,20 +314,20 @@ MakeGhostDock(WDock *dock, int sx, int dx, int y)
|
||||
virtual_tiles = h / wPreferences.icon_size; /* The visible ones */
|
||||
if (h % wPreferences.icon_size)
|
||||
virtual_tiles++; /* There is one partially visible tile at end */
|
||||
|
||||
|
||||
img=XGetImage(dpy, scr->root_win, dx, y, wPreferences.icon_size, h,
|
||||
AllPlanes, ZPixmap);
|
||||
if (!img)
|
||||
return None;
|
||||
return None;
|
||||
|
||||
red_mask = img->red_mask;
|
||||
green_mask = img->green_mask;
|
||||
blue_mask = img->blue_mask;
|
||||
|
||||
|
||||
back = RCreateImageFromXImage(scr->rcontext, img, NULL);
|
||||
XDestroyImage(img);
|
||||
if (!back) {
|
||||
return None;
|
||||
return None;
|
||||
}
|
||||
|
||||
for (i=0;i<dock->max_icons;i++) {
|
||||
@@ -336,7 +336,7 @@ MakeGhostDock(WDock *dock, int sx, int dx, int y)
|
||||
Pixmap which;
|
||||
j = dock->icon_array[i]->yindex * wPreferences.icon_size;
|
||||
n = (h - j < wPreferences.icon_size) ? h - j :
|
||||
wPreferences.icon_size;
|
||||
wPreferences.icon_size;
|
||||
if (dock->icon_array[i]->icon->pixmap)
|
||||
which = dock->icon_array[i]->icon->pixmap;
|
||||
else
|
||||
@@ -368,9 +368,9 @@ MakeGhostDock(WDock *dock, int sx, int dx, int y)
|
||||
|
||||
|
||||
RConvertImage(scr->rcontext, back, &pixmap);
|
||||
|
||||
|
||||
RReleaseImage(back);
|
||||
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
@@ -384,12 +384,12 @@ MakeGhostIcon(WScreen *scr, Drawable drawable)
|
||||
|
||||
|
||||
if (!drawable)
|
||||
return None;
|
||||
|
||||
return None;
|
||||
|
||||
back = RCreateImageFromDrawable(scr->rcontext, drawable, None);
|
||||
if (!back)
|
||||
return None;
|
||||
|
||||
if (!back)
|
||||
return None;
|
||||
|
||||
color.red = 0xff;
|
||||
color.green = 0xff;
|
||||
color.blue = 0xff;
|
||||
@@ -397,9 +397,9 @@ MakeGhostIcon(WScreen *scr, Drawable drawable)
|
||||
|
||||
RClearImage(back, &color);
|
||||
RConvertImage(scr->rcontext, back, &pixmap);
|
||||
|
||||
|
||||
RReleaseImage(back);
|
||||
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ DoWindowBirth(WWindow *wwin)
|
||||
int width = wwin->frame->core->width;
|
||||
int height = wwin->frame->core->height;
|
||||
int w = WMIN(width, 20);
|
||||
int h = WMIN(height, 20);
|
||||
int h = WMIN(height, 20);
|
||||
int x, y;
|
||||
int dw, dh;
|
||||
int i;
|
||||
@@ -425,24 +425,24 @@ DoWindowBirth(WWindow *wwin)
|
||||
y = wwin->frame_y + (height-h)/2;
|
||||
|
||||
XMoveResizeWindow(dpy, wwin->frame->core->window, x, y, w, h);
|
||||
|
||||
|
||||
XMapWindow(dpy, wwin->frame->core->window);
|
||||
|
||||
|
||||
XFlush(dpy);
|
||||
for (i=0; i<WINDOW_BIRTH_STEPS; i++) {
|
||||
x -= dw/2 + dw%2;
|
||||
y -= dh/2 + dh%2;
|
||||
w += dw;
|
||||
h += dh;
|
||||
XMoveResizeWindow(dpy, wwin->frame->core->window, x, y, w, h);
|
||||
XFlush(dpy);
|
||||
/* a timeout */
|
||||
if (time(NULL)-time0 > MAX_ANIMATION_TIME)
|
||||
break;
|
||||
x -= dw/2 + dw%2;
|
||||
y -= dh/2 + dh%2;
|
||||
w += dw;
|
||||
h += dh;
|
||||
XMoveResizeWindow(dpy, wwin->frame->core->window, x, y, w, h);
|
||||
XFlush(dpy);
|
||||
/* a timeout */
|
||||
if (time(NULL)-time0 > MAX_ANIMATION_TIME)
|
||||
break;
|
||||
}
|
||||
|
||||
XMoveResizeWindow(dpy, wwin->frame->core->window,
|
||||
wwin->frame_x, wwin->frame_y, width, height);
|
||||
wwin->frame_x, wwin->frame_y, width, height);
|
||||
XFlush(dpy);
|
||||
}
|
||||
#else
|
||||
@@ -464,8 +464,8 @@ void DoWindowBirth(WWindow *wwin)
|
||||
center_y = wwin->frame_y + (height - h) / 2;
|
||||
|
||||
animateResize(scr, center_x, center_y, 1, 1,
|
||||
wwin->frame_x , wwin->frame_y, width, height,
|
||||
0);
|
||||
wwin->frame_x , wwin->frame_y, width, height,
|
||||
0);
|
||||
}
|
||||
#else
|
||||
void
|
||||
@@ -494,29 +494,29 @@ loadData(WScreen *scr)
|
||||
|
||||
f = fopen(PKGDATADIR"/xtree.dat", "rb");
|
||||
if (!f)
|
||||
return False;
|
||||
return False;
|
||||
|
||||
image = RCreateImage(50, 50, False);
|
||||
if (!image) {
|
||||
fclose(f);
|
||||
return False;
|
||||
fclose(f);
|
||||
return False;
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (fread(image->data, 50*50*3, 1, f)!=1) {
|
||||
goto error;
|
||||
}
|
||||
if (!RConvertImage(scr->rcontext, image, &(d[i]))) {
|
||||
goto error;
|
||||
}
|
||||
if (fread(image->data, 50*50*3, 1, f)!=1) {
|
||||
goto error;
|
||||
}
|
||||
if (!RConvertImage(scr->rcontext, image, &(d[i]))) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
RReleaseImage(image);
|
||||
|
||||
fclose(f);
|
||||
|
||||
for (i=0; i<12; i++) {
|
||||
data[i] = WMCreatePixmapFromXPixmaps(scr->wmscreen, d[i], None, 50, 50,
|
||||
scr->w_depth);
|
||||
data[i] = WMCreatePixmapFromXPixmaps(scr->wmscreen, d[i], None, 50, 50,
|
||||
scr->w_depth);
|
||||
}
|
||||
|
||||
return True;
|
||||
@@ -527,7 +527,7 @@ error:
|
||||
fclose(f);
|
||||
|
||||
while (--i > 0) {
|
||||
XFreePixmap(dpy, d[i]);
|
||||
XFreePixmap(dpy, d[i]);
|
||||
}
|
||||
|
||||
return False;
|
||||
@@ -553,19 +553,19 @@ InitXThing(WScreen *scr)
|
||||
static int i = 0;
|
||||
|
||||
if (i)
|
||||
return True;
|
||||
return True;
|
||||
|
||||
t = time(NULL);
|
||||
l = localtime(&t);
|
||||
if ((l->tm_mon!=11||l->tm_mday<24||l->tm_mday>26)) {
|
||||
return False;
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!loadData(scr))
|
||||
return False;
|
||||
return False;
|
||||
|
||||
i = 1;
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
@@ -617,30 +617,30 @@ InitGhostWindowMove(WWindow *wwin)
|
||||
gdata->boxY = wwin->frame_y;
|
||||
|
||||
gdata->window =
|
||||
XCreateSimpleWindow(dpy, scr->root_win, wwin->frame_x, wwin->frame_y,
|
||||
gdata->width, gdata->height, 0, 0, 0);
|
||||
XCreateSimpleWindow(dpy, scr->root_win, wwin->frame_x, wwin->frame_y,
|
||||
gdata->width, gdata->height, 0, 0, 0);
|
||||
|
||||
gdata->winImage = RGetXImage(scr->rcontext, wwin->frame->core->window,
|
||||
0, 0, gdata->width, gdata->height);
|
||||
gdata->winImage = RGetXImage(scr->rcontext, wwin->frame->core->window,
|
||||
0, 0, gdata->width, gdata->height);
|
||||
|
||||
gdata->backImage = RCreateXImage(scr->rcontext, scr->w_depth,
|
||||
gdata->width, gdata->height);
|
||||
gdata->backImage = RCreateXImage(scr->rcontext, scr->w_depth,
|
||||
gdata->width, gdata->height);
|
||||
|
||||
memcpy(gdata->backImage->image->data, gdata->winImage->image->data,
|
||||
gdata->winImage->image->bytes_per_line * gdata->height);
|
||||
gdata->winImage->image->bytes_per_line * gdata->height);
|
||||
|
||||
gdata->image = RCreateXImage(scr->rcontext, scr->w_depth,
|
||||
gdata->width, gdata->height);
|
||||
gdata->width, gdata->height);
|
||||
|
||||
ptr = (unsigned short*)gdata->winImage->image->data;
|
||||
|
||||
mask = 0x7b00|0x3d0|0x1e;
|
||||
|
||||
for (i = 0;
|
||||
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||
i++, ptr++) {
|
||||
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||
i++, ptr++) {
|
||||
|
||||
*ptr &= mask;
|
||||
*ptr &= mask;
|
||||
}
|
||||
|
||||
return gdata;
|
||||
@@ -661,11 +661,11 @@ mergeGhostWindow(_GhostWindowData *gdata)
|
||||
count = gdata->winImage->image->bytes_per_line * gdata->height;
|
||||
|
||||
while (count--) {
|
||||
*ptr = (*ptrw + *ptrb) >> 1;
|
||||
*ptr = (*ptrw + *ptrb) >> 1;
|
||||
|
||||
ptr++;
|
||||
ptrw++;
|
||||
ptrb++;
|
||||
ptr++;
|
||||
ptrw++;
|
||||
ptrb++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,131 +677,131 @@ UpdateGhostWindowMove(void *data, int x, int y)
|
||||
WScreen *scr = gdata->scr;
|
||||
|
||||
/* no intersection of new background with current */
|
||||
if (x + gdata->width <= gdata->boxX
|
||||
|| x >= gdata->boxX + gdata->width
|
||||
|| y + gdata->height <= gdata->boxY
|
||||
|| y >= gdata->boxY + gdata->height) {
|
||||
int i;
|
||||
if (x + gdata->width <= gdata->boxX
|
||||
|| x >= gdata->boxX + gdata->width
|
||||
|| y + gdata->height <= gdata->boxY
|
||||
|| y >= gdata->boxY + gdata->height) {
|
||||
int i;
|
||||
|
||||
RDestroyXImage(gdata->backImage);
|
||||
RDestroyXImage(gdata->backImage);
|
||||
|
||||
gdata->backImage = RGetXImage(scr->rcontext, scr->root_win, x, y,
|
||||
gdata->width, gdata->height);
|
||||
gdata->backImage = RGetXImage(scr->rcontext, scr->root_win, x, y,
|
||||
gdata->width, gdata->height);
|
||||
|
||||
ptr = (unsigned short*)gdata->backImage->image->data;
|
||||
ptr = (unsigned short*)gdata->backImage->image->data;
|
||||
|
||||
mask = 0x7b00|0x3d0|0x1e;
|
||||
mask = 0x7b00|0x3d0|0x1e;
|
||||
|
||||
for (i = 0;
|
||||
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||
i++, ptr++) {
|
||||
for (i = 0;
|
||||
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||
i++, ptr++) {
|
||||
|
||||
*ptr &= mask;
|
||||
}
|
||||
*ptr &= mask;
|
||||
}
|
||||
} else {
|
||||
int hx, hw, hy, hh;
|
||||
int vx, vw, vy, vh;
|
||||
int i, j;
|
||||
unsigned char *backP = gdata->backImage->image->data;
|
||||
unsigned char *winP = gdata->winImage->image->data;
|
||||
int backLineLen = gdata->backImage->image->bytes_per_line;
|
||||
int winLineLen = gdata->winImage->image->bytes_per_line;
|
||||
int hx, hw, hy, hh;
|
||||
int vx, vw, vy, vh;
|
||||
int i, j;
|
||||
unsigned char *backP = gdata->backImage->image->data;
|
||||
unsigned char *winP = gdata->winImage->image->data;
|
||||
int backLineLen = gdata->backImage->image->bytes_per_line;
|
||||
int winLineLen = gdata->winImage->image->bytes_per_line;
|
||||
|
||||
/* 1st move the area of the current backImage that overlaps
|
||||
* the new backImage to it's new position */
|
||||
/* 1st move the area of the current backImage that overlaps
|
||||
* the new backImage to it's new position */
|
||||
|
||||
if (x < gdata->boxX) {
|
||||
vx = x + gdata->width;
|
||||
vw = gdata->width - vx;
|
||||
} else if (x > gdata->boxX) {
|
||||
vw = gdata->boxX + gdata->width - x;
|
||||
vx = gdata->boxX - vw;
|
||||
} else {
|
||||
vx = 0;
|
||||
vw = gdata->width;
|
||||
}
|
||||
if (x < gdata->boxX) {
|
||||
vx = x + gdata->width;
|
||||
vw = gdata->width - vx;
|
||||
} else if (x > gdata->boxX) {
|
||||
vw = gdata->boxX + gdata->width - x;
|
||||
vx = gdata->boxX - vw;
|
||||
} else {
|
||||
vx = 0;
|
||||
vw = gdata->width;
|
||||
}
|
||||
|
||||
if (y < gdata->boxY) {
|
||||
vy = y + gdata->height;
|
||||
vh = gdata->height - vy;
|
||||
} else if (y > gdata->boxY) {
|
||||
vh = gdata->boxY + gdata->height - y;
|
||||
vy = gdata->boxY - vh;
|
||||
} else {
|
||||
vy = 0;
|
||||
vh = gdata->height;
|
||||
}
|
||||
if (y < gdata->boxY) {
|
||||
vy = y + gdata->height;
|
||||
vh = gdata->height - vy;
|
||||
} else if (y > gdata->boxY) {
|
||||
vh = gdata->boxY + gdata->height - y;
|
||||
vy = gdata->boxY - vh;
|
||||
} else {
|
||||
vy = 0;
|
||||
vh = gdata->height;
|
||||
}
|
||||
|
||||
if (y < gdata->boxY) {
|
||||
int dy = vy - gdata->boxY;
|
||||
if (y < gdata->boxY) {
|
||||
int dy = vy - gdata->boxY;
|
||||
|
||||
if (x < gdata->boxX) {
|
||||
for (i = vh - 1; i >= 0; i--) {
|
||||
memmove(&backP[(i + dy) * backLineLen + 2 * vx],
|
||||
&backP[i * backLineLen], 2 * vw);
|
||||
}
|
||||
} else /* if (x > gdata->boxX) */ {
|
||||
for (i = vh - 1; i >= 0; i--) {
|
||||
memmove(&backP[(i + dy) * backLineLen],
|
||||
&backP[i * backLineLen + 2 * vx], 2 * vw);
|
||||
}
|
||||
}
|
||||
} else /*if (y > gdata->boxY) */ {
|
||||
int dy = gdata->boxY - vy;
|
||||
if (x < gdata->boxX) {
|
||||
for (i = vh - 1; i >= 0; i--) {
|
||||
memmove(&backP[(i + dy) * backLineLen + 2 * vx],
|
||||
&backP[i * backLineLen], 2 * vw);
|
||||
}
|
||||
} else /* if (x > gdata->boxX) */ {
|
||||
for (i = vh - 1; i >= 0; i--) {
|
||||
memmove(&backP[(i + dy) * backLineLen],
|
||||
&backP[i * backLineLen + 2 * vx], 2 * vw);
|
||||
}
|
||||
}
|
||||
} else /*if (y > gdata->boxY) */ {
|
||||
int dy = gdata->boxY - vy;
|
||||
|
||||
if (x < gdata->boxX) {
|
||||
for (i = 0; i < vh - 1; i++) {
|
||||
memmove(&backP[i * backLineLen + 2 * vx],
|
||||
&backP[(i + dy) * backLineLen], 2 * vw);
|
||||
}
|
||||
} else /*if (x > gdata->boxX) */ {
|
||||
for (i = 0; i < vh - 1; i++) {
|
||||
memmove(&backP[i * backLineLen],
|
||||
&backP[(i + dy) * backLineLen + 2 * vx], 2 * vw);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x < gdata->boxX) {
|
||||
for (i = 0; i < vh - 1; i++) {
|
||||
memmove(&backP[i * backLineLen + 2 * vx],
|
||||
&backP[(i + dy) * backLineLen], 2 * vw);
|
||||
}
|
||||
} else /*if (x > gdata->boxX) */ {
|
||||
for (i = 0; i < vh - 1; i++) {
|
||||
memmove(&backP[i * backLineLen],
|
||||
&backP[(i + dy) * backLineLen + 2 * vx], 2 * vw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 2nd grab the background image from the screen and copy to the
|
||||
* buffer. also maskout the lsb of rgb in each pixel of grabbed data */
|
||||
/* 2nd grab the background image from the screen and copy to the
|
||||
* buffer. also maskout the lsb of rgb in each pixel of grabbed data */
|
||||
|
||||
if (y < gdata->boxY) {
|
||||
vy = y;
|
||||
vh = gdata->boxY - vy;
|
||||
if (y < gdata->boxY) {
|
||||
vy = y;
|
||||
vh = gdata->boxY - vy;
|
||||
|
||||
hy = y + vh;
|
||||
hh = gdata->height - vh;
|
||||
} else if (y > gdata->boxY) {
|
||||
vy = gdata->boxY + gdata->height;
|
||||
vh = vy - (y + gdata->height);
|
||||
hy = y + vh;
|
||||
hh = gdata->height - vh;
|
||||
} else if (y > gdata->boxY) {
|
||||
vy = gdata->boxY + gdata->height;
|
||||
vh = vy - (y + gdata->height);
|
||||
|
||||
hy = y;
|
||||
hh = y - gdata->boxY;
|
||||
} else {
|
||||
vy = vh = 0;
|
||||
hy = y;
|
||||
hh = y - gdata->boxY;
|
||||
} else {
|
||||
vy = vh = 0;
|
||||
|
||||
hy = y;
|
||||
hh = gdata->height;
|
||||
}
|
||||
hy = y;
|
||||
hh = gdata->height;
|
||||
}
|
||||
|
||||
if (x < gdata->boxX) {
|
||||
hx = x;
|
||||
hw = gdata->boxX - hx;
|
||||
} else if (x > gdata->boxX) {
|
||||
hx = gdata->boxX + gdata->width;
|
||||
hw = hx - (x + gdata->width);
|
||||
} else {
|
||||
hx = hw = 0;
|
||||
if (x < gdata->boxX) {
|
||||
hx = x;
|
||||
hw = gdata->boxX - hx;
|
||||
} else if (x > gdata->boxX) {
|
||||
hx = gdata->boxX + gdata->width;
|
||||
hw = hx - (x + gdata->width);
|
||||
} else {
|
||||
hx = hw = 0;
|
||||
|
||||
vx = x;
|
||||
vw = gdata->width;
|
||||
}
|
||||
vx = x;
|
||||
vw = gdata->width;
|
||||
}
|
||||
|
||||
/* 1st the top/bottom part */
|
||||
/* 1st the top/bottom part */
|
||||
|
||||
|
||||
|
||||
/* 2nd the left/right part */
|
||||
|
||||
/* 2nd the left/right part */
|
||||
}
|
||||
|
||||
mergeGhostWindow(gdata);
|
||||
|
||||
Reference in New Issue
Block a user