1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-06-10 12:15:25 +02:00

Updating to version 0.20.2

Many bug fixes.
This commit is contained in:
dan
1998-10-21 14:43:47 +00:00
parent 9d2e6ef9f1
commit 9af1c6c415
222 changed files with 9132 additions and 4322 deletions
+8 -4
View File
@@ -1,6 +1,6 @@
/* GNUstep.h-- stuff for compatibility with GNUstep applications
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -42,7 +42,7 @@
#undef WINGS_BOOL_FLAG
#endif
#define WINDOWMAKER_WM_MINIATURIZE_WINDOW "_WINDOWMAKER_WM_MINIATURIZE_WINDOW"
#define GNUSTEP_WM_MINIATURIZE_WINDOW "_GNUSTEP_WM_MINIATURIZE_WINDOW"
#define GNUSTEP_WM_ATTR_NAME "_GNUSTEP_WM_ATTR"
@@ -67,8 +67,9 @@ enum {
};
#endif /* _WINGS_H_ */
/* GNUstep protocols atom names */
#define GNUSTEP_WM_RESIZEBAR "_GNUSTEP_WM_RESIZEBAR"
/* window manager -> appkit notifications */
#define GNUSTEP_WM_NOTIFICATION "GNUSTEP_WM_NOTIFICATION"
typedef struct {
CARD32 flags;
@@ -92,6 +93,9 @@ typedef struct {
/* extra flags */
#define GSDocumentEditedFlag (1<<0)
#define GSWindowWillResizeNotificationsFlag (1<<1)
#define GSWindowWillMoveNotificationsFlag (1<<2)
#define GSNoApplicationIconFlag (1<<5)
+6 -6
View File
@@ -102,16 +102,16 @@ CPPFLAGS = \
INCLUDES = \
-I$(top_srcdir)/wrlib \
-I$(top_srcdir)/WINGs \
@XCFLAGS@ \
@LIBPL_INC_PATH@
-I$(top_srcdir)/libPropList \
-I$(top_srcdir)/wrlib \
-I$(top_srcdir)/WINGs
wmaker_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.a\
@LIBPL_LIBS@ \
-L$(top_builddir)/WINGs -lWINGs\
-L$(top_builddir)/wrlib -lwraster\
-L$(top_builddir)/libPropList -lPropList\
@XLFLAGS@ \
@GFXLIBS@ \
@XLIBS@ \
+7 -10
View File
@@ -68,8 +68,6 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LIBPL_INC_PATH = @LIBPL_INC_PATH@
LIBPL_LIBS = @LIBPL_LIBS@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -193,15 +191,15 @@ CPPFLAGS = \
-DPIXMAPDIR="\"$(pixmapdir)\""
INCLUDES = \
-I$(top_srcdir)/wrlib \
-I$(top_srcdir)/WINGs \
@XCFLAGS@ \
@LIBPL_INC_PATH@
-I$(top_srcdir)/libPropList \
-I$(top_srcdir)/wrlib \
-I$(top_srcdir)/WINGs
wmaker_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.a\
@LIBPL_LIBS@ \
-L$(top_builddir)/WINGs -lWINGs\
-L$(top_builddir)/wrlib -lwraster\
-L$(top_builddir)/libPropList -lPropList\
@XLFLAGS@ \
@GFXLIBS@ \
@XLIBS@ \
@@ -227,8 +225,7 @@ placement.o properties.o proplist.o resources.o rootmenu.o screen.o \
session.o shutdown.o stacking.o startup.o superfluous.o switchmenu.o \
texture.o xmodifier.o xutil.o wcore.o wdefaults.o window.o winmenu.o \
winspector.o workspace.o wmsound.o text.o
wmaker_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.a
wmaker_DEPENDENCIES =
wmaker_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+13 -22
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -127,14 +127,6 @@ typedef struct WObjDescriptor {
#define WTJ_LEFT 1
#define WTJ_RIGHT 2
/* icon box positions */
#define WIB_BOTTOM 0
#define WIB_TOP 1
#define WIB_LEFT 2
#define WIB_RIGHT 3
/* iconification styles */
#define WIS_ZOOM 0
#define WIS_TWIST 1
@@ -157,9 +149,6 @@ typedef struct WObjDescriptor {
#define SPEED_SLOW 3
#define SPEED_ULTRASLOW 4
/* startup warnings */
#define WAR_DEFAULTS_DIR 1 /* created defaults DB directory */
/* window states */
#define WS_FOCUSED 0
@@ -180,18 +169,19 @@ typedef struct WObjDescriptor {
#define IY_LEFT 0
/* program states */
#define WSTATE_NORMAL 0
#define WSTATE_NEED_EXIT 1
#define WSTATE_NEED_RESTART 2
#define WSTATE_EXITING 3
#define WSTATE_RESTARTING 4
typedef struct W2Color {
char *color1;
char *color2;
} W2Color;
typedef struct WCoord {
int x, y;
} WCoord;
typedef struct WPreferences {
char **pixmap_path; /* NULL terminated array of */
/* paths to find pixmaps */
@@ -213,8 +203,9 @@ typedef struct WPreferences {
char use_saveunders; /* turn on SaveUnders for menus,
* icons etc. */
/*
char no_window_under_dock;
*/
char no_window_over_icons;
@@ -257,7 +248,7 @@ typedef struct WPreferences {
WCoord *win_menu_pos;
int icon_yard; /* aka iconbox */
char icon_yard; /* aka iconbox */
int raise_delay; /* delay for autoraise. 0 is disabled */
@@ -298,13 +289,13 @@ typedef struct WPreferences {
int dblclick_time; /* double click delay time in ms */
/* animate menus */
int menu_scroll_speed; /* how fast menus are scrolled */
char menu_scroll_speed; /* how fast menus are scrolled */
/* animate icon sliding */
int icon_slide_speed; /* icon slide animation speed */
char icon_slide_speed; /* icon slide animation speed */
/* shading animation */
int shade_speed;
char shade_speed;
int edge_resistance;
+70 -216
View File
@@ -1,6 +1,6 @@
/* action.c- misc. window commands (miniaturize, hide etc.)
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include "WindowMaker.h"
#include "wcore.h"
@@ -69,8 +70,8 @@ static struct {
{SHADE_STEPS_S, SHADE_DELAY_S},
{SHADE_STEPS_U, SHADE_DELAY_U}};
#define SHADE_STEPS shadePars[wPreferences.shade_speed].steps
#define SHADE_DELAY shadePars[wPreferences.shade_speed].delay
#define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps
#define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
static int ignoreTimestamp=0;
@@ -245,11 +246,12 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
void
wShadeWindow(WWindow *wwin)
{
XWindowAttributes attribs;
#ifdef ANIMATIONS
XWindowAttributes attribs;
time_t time0 = time(NULL);
#ifdef ANIMATIONS
int y, s, w, h;
#endif
if (wwin->flags.shaded)
return;
@@ -276,6 +278,9 @@ wShadeWindow(WWindow *wwin)
wusleep(SHADE_DELAY*1000L);
h-=s;
y-=s;
if (time(NULL)-time0 > MAX_ANIMATION_TIME)
break;
}
XMoveWindow(dpy, wwin->client_win, 0, wwin->frame->top_width);
}
@@ -302,6 +307,7 @@ wShadeWindow(WWindow *wwin)
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup) {
/* Look at processEvents() for reason of this code. */
XSync(dpy, 0);
processEvents(XPending(dpy));
}
@@ -312,6 +318,7 @@ wShadeWindow(WWindow *wwin)
void
wUnshadeWindow(WWindow *wwin)
{
time_t time0 = time(NULL);
#ifdef ANIMATIONS
int y, s, w, h;
#endif /* ANIMATIONS */
@@ -347,6 +354,9 @@ wUnshadeWindow(WWindow *wwin)
wusleep(SHADE_DELAY*2000L/3);
h+=s;
y+=s;
if (time(NULL)-time0 > MAX_ANIMATION_TIME)
break;
}
}
XMoveWindow(dpy, wwin->client_win, 0, wwin->frame->top_width);
@@ -395,13 +405,19 @@ wMaximizeWindow(WWindow *wwin, int directions)
if (!(wPreferences.icon_yard & IY_RIGHT))
new_x += wPreferences.icon_size;
}
#if 0
if (wPreferences.no_window_under_dock
&& wwin->screen_ptr->dock) {
new_width -= wPreferences.icon_size + DOCK_EXTRA_SPACE;
if (!wwin->screen_ptr->dock->on_right_side)
new_x += wPreferences.icon_size + DOCK_EXTRA_SPACE;
}
#endif
if (wwin->screen_ptr->dock && !wwin->screen_ptr->dock->lowered) {
new_width -= wPreferences.icon_size + DOCK_EXTRA_SPACE;
if (!wwin->screen_ptr->dock->on_right_side)
new_x += wPreferences.icon_size + DOCK_EXTRA_SPACE;
}
} else {
new_x = wwin->frame_x;
new_width = wwin->frame->core->width;
@@ -679,181 +695,6 @@ animateResize(WScreen *scr, int x, int y, int w, int h,
#endif /* ANIMATIONS */
/* Here are defined the miniaturize animation functions. The above defined
* functions, use a separate function that implements the animation for each
* different style, and a wrapper that calls them accordingly.
* The below function is a single function that implements all the miniaturize
* animation styles in one single function, using switch{} and if() statements
* to differentiate them.
* The above code is more generic and elegant, letting one to extend it very
* easily (though I don't think one would ;), but will make the code a little
* bit bigger, using three functions and a wrapper.
* The below version, is smaller, being optimised for size, but is less
* elegant, and harder to be extended. Also is harder to read.
* I let them both here so you can take a look, and decide which one you like
* more. I would use the above functions because they are nicer, and easier to
* read and follow, and only a little bit bigger. -Dan
*/
#ifdef ANIMATIONS_DONT_USE_THIS
static void
animateResize(WScreen *scr, int x, int y, int w, int h,
int fx, int fy, int fw, int fh, int hiding)
{
#define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
float cx[FRAMES], cy[FRAMES], cw[FRAMES], ch[FRAMES];
float xstep, ystep, wstep, hstep;
XPoint points[5];
float angle, final_angle, a, d, delta, dx, dch, midy, twist=0.5;
int style = wPreferences.iconification_style; /* Catch the value */
/* to avoid changes while animating */
int frames, steps, delay, i, j;
if (style == WIS_NONE)
return;
switch(style) {
case WIS_TWIST:
frames = MINIATURIZE_ANIMATION_FRAMES_T;
steps = MINIATURIZE_ANIMATION_STEPS_T;
delay = MINIATURIZE_ANIMATION_DELAY_T;
twist = MINIATURIZE_ANIMATION_TWIST_T;
break;
case WIS_FLIP:
frames = MINIATURIZE_ANIMATION_FRAMES_F;
steps = MINIATURIZE_ANIMATION_STEPS_F;
delay = MINIATURIZE_ANIMATION_DELAY_F;
twist = MINIATURIZE_ANIMATION_TWIST_F;
break;
case WIS_ZOOM:
default:
frames = MINIATURIZE_ANIMATION_FRAMES_Z;
steps = MINIATURIZE_ANIMATION_STEPS_Z;
delay = MINIATURIZE_ANIMATION_DELAY_Z;
break;
}
steps = (hiding ? (steps*2)/3 : steps);
if (steps == 0)
return;
if (style == WIS_TWIST) {
x += w/2;
y += h/2;
fx += fw/2;
fy += fh/2;
}
xstep = (float)(fx-x)/steps;
ystep = (float)(fy-y)/steps;
wstep = (float)(fw-w)/steps;
hstep = (float)(fh-h)/steps;
for (j=0; j<frames; j++) {
cx[j] = (float)x;
cy[j] = (float)y;
cw[j] = (float)w;
ch[j] = (float)h;
}
if (style==WIS_TWIST || style==WIS_FLIP) {
final_angle = 2*WM_PI*twist;
delta = (float)(final_angle/frames);
for (angle=0;; angle+=delta) {
if (angle > final_angle)
angle = final_angle;
switch (style) {
case WIS_TWIST:
a = atan(ch[0]/cw[0]);
d = sqrt((cw[0]/2)*(cw[0]/2)+(ch[0]/2)*(ch[0]/2));
points[0].x = cx[0]+cos(angle-a)*d;
points[0].y = cy[0]+sin(angle-a)*d;
points[1].x = cx[0]+cos(angle+a)*d;
points[1].y = cy[0]+sin(angle+a)*d;
points[2].x = cx[0]+cos(angle-a+WM_PI)*d;
points[2].y = cy[0]+sin(angle-a+WM_PI)*d;
points[3].x = cx[0]+cos(angle+a+WM_PI)*d;
points[3].y = cy[0]+sin(angle+a+WM_PI)*d;
points[4].x = cx[0]+cos(angle-a)*d;
points[4].y = cy[0]+sin(angle-a)*d;
break;
case WIS_FLIP:
dx = (cw[0]/10) - ((cw[0]/5) * sin(angle));
dch = (ch[0]/2) * cos(angle);
midy = cy[0] + (ch[0]/2);
points[0].x = cx[0] + dx; points[0].y = midy - dch;
points[1].x = cx[0] + cw[0] - dx; points[1].y = points[0].y;
points[2].x = cx[0] + cw[0] + dx; points[2].y = midy + dch;
points[3].x = cx[0] - dx; points[3].y = points[2].y;
points[4].x = points[0].x; points[4].y = points[0].y;
break;
}
XGrabServer(dpy);
XDrawLines(dpy, scr->root_win, scr->frame_gc, points, 5, CoordModeOrigin);
XFlush(dpy);
if (delay>0)
wusleep(delay);
XDrawLines(dpy, scr->root_win, scr->frame_gc, points, 5, CoordModeOrigin);
XUngrabServer(dpy);
cx[0]+=xstep;
cy[0]+=ystep;
cw[0]+=wstep;
ch[0]+=hstep;
if (angle >= final_angle)
break;
}
XFlush(dpy);
} else {
/* Zoom or default */
XGrabServer(dpy);
for (i=0; i<steps; i++) {
for (j=0; j<frames; j++) {
XDrawRectangle(dpy, scr->root_win, scr->frame_gc,
(int)cx[j], (int)cy[j], (int)cw[j], (int)ch[j]);
}
XFlush(dpy);
if (delay>0)
wusleep(delay);
for (j=0; j<frames; j++) {
XDrawRectangle(dpy, scr->root_win, scr->frame_gc,
(int)cx[j], (int)cy[j], (int)cw[j], (int)ch[j]);
if (j<frames-1) {
cx[j]=cx[j+1];
cy[j]=cy[j+1];
cw[j]=cw[j+1];
ch[j]=ch[j+1];
} else {
cx[j]+=xstep;
cy[j]+=ystep;
cw[j]+=wstep;
ch[j]+=hstep;
}
}
}
for (j=0; j<frames; j++) {
XDrawRectangle(dpy, scr->root_win, scr->frame_gc,
(int)cx[j], (int)cy[j], (int)cw[j], (int)ch[j]);
}
XFlush(dpy);
if (delay>0)
wusleep(MINIATURIZE_ANIMATION_DELAY_Z);
for (j=0; j<frames; j++) {
XDrawRectangle(dpy, scr->root_win, scr->frame_gc,
(int)cx[j], (int)cy[j], (int)cw[j], (int)ch[j]);
}
XUngrabServer(dpy);
}
}
#undef FRAMES
#endif /* ANIMATIONS */
static void
flushExpose()
{
@@ -942,12 +783,23 @@ setupIconGrabs(WIcon *icon)
static WWindow*
recursiveTransientFor(WWindow *wwin)
{
int i;
if (!wwin)
return None;
/* TODO: a buggy client can put this in a infinite loop */
while (wwin->transient_for != None)
/* hackish way to detect transient_for cycle */
i = wwin->screen_ptr->window_count+1;
while (wwin && wwin->transient_for != None && i>0) {
wwin = wWindowFor(wwin->transient_for);
i--;
}
if (i==0 && wwin) {
wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
wwin->frame->title);
return NULL;
}
return wwin;
}
@@ -1009,6 +861,10 @@ wIconifyWindow(WWindow *wwin)
unmapTransientsFor(wwin);
if (present) {
#ifdef WMSOUND
wSoundPlay(WMSOUND_ICONIFY);
#endif
XUngrabPointer(dpy, CurrentTime);
/* prevent window withdrawal when getting UnmapNotify */
XSelectInput(dpy, wwin->client_win,
@@ -1043,9 +899,10 @@ wIconifyWindow(WWindow *wwin)
#endif
if (present) {
WWindow *owner = recursiveTransientFor(wwin->screen_ptr->focused_window);
setupIconGrabs(wwin->icon);
if ((wwin->flags.focused || wwin->client_win ==
recursiveTransientFor(wwin->screen_ptr->focused_window)->client_win)
if ((wwin->flags.focused
|| (owner && wwin->client_win == owner->client_win))
&& wPreferences.focus_mode==WKF_CLICK) {
WWindow *tmp;
@@ -1060,20 +917,18 @@ wIconifyWindow(WWindow *wwin)
} else if (wPreferences.focus_mode!=WKF_CLICK) {
wSetFocusTo(wwin->screen_ptr, NULL);
}
#ifdef WMSOUND
if (present) {
wSoundPlay(WMSOUND_ICONIFY);
}
#endif
#ifdef ANIMATIONS
/*
if (!wwin->screen_ptr->flags.startup) {
Window clientwin = wwin->client_win;
XSync(dpy, 0);
processEvents(XPending(dpy));
/* the window can disappear while doing the processEvents() */
if (!wWindowFor(clientwin))
return;
}
*/
#endif
}
@@ -1111,7 +966,11 @@ wDeiconifyWindow(WWindow *wwin)
wIconSelect(wwin->icon);
XUnmapWindow(dpy, wwin->icon->core->window);
#ifdef WMSOUND
wSoundPlay(WMSOUND_DEICONIFY);
#endif
/* if the window is in another workspace, do it silently */
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
@@ -1144,14 +1003,15 @@ wDeiconifyWindow(WWindow *wwin)
|| wPreferences.focus_mode==WKF_SLOPPY)
wSetFocusTo(wwin->screen_ptr, wwin);
#ifdef WMSOUND
wSoundPlay(WMSOUND_DEICONIFY);
#endif
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup) {
Window clientwin = wwin->client_win;
XSync(dpy, 0);
processEvents(XPending(dpy));
if (!wWindowFor(clientwin))
return;
}
#endif
@@ -1209,6 +1069,9 @@ hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
XUnmapWindow(dpy, wwin->frame->core->window);
wClientSetState(wwin, IconicState, icon->icon_win);
flushExpose();
#ifdef WMSOUND
wSoundPlay(WMSOUND_HIDE);
#endif
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations &&
!wwin->flags.skip_next_animation && animate) {
@@ -1221,10 +1084,6 @@ hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
wwin->flags.skip_next_animation = 0;
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
#ifdef WMSOUND
wSoundPlay(WMSOUND_HIDE);
#endif
}
@@ -1269,7 +1128,7 @@ wHideOtherApplications(WWindow *awin)
}
#endif
if (wwin->main_window==None) {
if (wwin->main_window==None || wwin->window_flags.no_appicon) {
if (!wwin->window_flags.no_miniaturizable) {
wwin->flags.skip_next_animation = 1;
wIconifyWindow(wwin);
@@ -1412,14 +1271,13 @@ unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate,
wwin->flags.hidden=0;
wwin->flags.mapped=1;
#ifdef WMSOUND
wSoundPlay(WMSOUND_UNHIDE);
#endif
#ifdef ANIMATIONS
/* something is redundant here. animate passed here is
* !wwin->flags.skip_next_animation, so this flag is tested twice.
* Either we shold not test skip_next_animation here, or don't pass
* animate to this function. -Dan
*/
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations &&
!wwin->flags.skip_next_animation && animate) {
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
&& animate) {
animateResize(wwin->screen_ptr, icon_x, icon_y,
icon->core->width, icon->core->height,
wwin->frame_x, wwin->frame_y,
@@ -1443,10 +1301,6 @@ unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate,
}
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
#ifdef WMSOUND
wSoundPlay(WMSOUND_UNHIDE);
#endif
}
@@ -1594,7 +1448,7 @@ wRefreshDesktop(WScreen *scr)
attr.save_under = False;
win = XCreateWindow(dpy, scr->root_win, 0, 0, scr->scr_width,
scr->scr_height, 0, CopyFromParent, CopyFromParent,
(Visual *) CopyFromParent, CWBackingStore|CWSaveUnder,
(Visual *)CopyFromParent, CWBackingStore|CWSaveUnder,
&attr);
XMapRaised(dpy, win);
XDestroyWindow(dpy, win);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+9 -6
View File
@@ -1,6 +1,6 @@
/* appicon.c- icon for applications (not mini-window)
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -153,7 +153,9 @@ wAppIconCreate(WWindow *leader_win)
aicon->prev = NULL;
aicon->next = scr->app_icon_list;
if (scr->app_icon_list) {
#ifdef REDUCE_APPICONS
#ifndef REDUCE_APPICONS
scr->app_icon_list->prev = aicon;
#else
/* If we aren't going to have a match, jump straight to new appicon */
if (leader_win->wm_class == NULL || leader_win->wm_class == NULL)
atmp = NULL;
@@ -185,11 +187,9 @@ wAppIconCreate(WWindow *leader_win)
atmp = atmp->next;
}
if (atmp == NULL) {
#endif
scr->app_icon_list->prev = aicon;
#ifdef REDUCE_APPICONS
scr->app_icon_list->prev = aicon;
}
#endif
#endif /* REDUCE_APPICONS */
}
scr->app_icon_list = aicon;
@@ -658,6 +658,9 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
int clickButton = event->xbutton.button;
Pixmap ghost = None;
if (aicon->editing)
return;
if (IsDoubleClick(scr, event)) {
iconDblClick(desc, event);
return;
+1 -1
View File
@@ -1,6 +1,6 @@
/* appicon.h- application icon
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+86 -49
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -132,6 +132,59 @@ extractIcon(WWindow *wwin)
}
static void
saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
{
proplist_t dict = WDWindowAttributes->dictionary;
proplist_t adict, key, iconk;
proplist_t val;
char *tmp;
int i;
i = 0;
if (wm_instance)
i += strlen(wm_instance);
if (wm_class)
i += strlen(wm_class);
tmp = wmalloc(i+8);
*tmp = 0;
if (wm_class && wm_instance) {
sprintf(tmp, "%s.%s", wm_instance, wm_class);
} else {
if (wm_instance)
strcat(tmp, wm_instance);
if (wm_class)
strcat(tmp, wm_class);
}
key = PLMakeString(tmp);
free(tmp);
adict = PLGetDictionaryEntry(dict, key);
iconk = PLMakeString("Icon");
if (adict) {
val = PLGetDictionaryEntry(adict, iconk);
} else {
/* no dictionary for app, so create one */
adict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
PLInsertDictionaryEntry(dict, key, adict);
PLRelease(adict);
val = NULL;
}
if (!val) {
val = PLMakeString(iconPath);
PLInsertDictionaryEntry(adict, iconk, val);
PLRelease(val);
}
PLRelease(key);
if (val)
PLSave(dict, YES);
}
void
wApplicationExtractDirPackIcon(WScreen *scr, char *path,
char *wm_instance, char *wm_class)
@@ -162,59 +215,30 @@ wApplicationExtractDirPackIcon(WScreen *scr, char *path,
}
if (iconPath) {
proplist_t dict = WDWindowAttributes->dictionary;
proplist_t adict, key, iconk;
proplist_t val;
char *tmp;
int i;
i = 0;
if (wm_instance)
i += strlen(wm_instance);
if (wm_class)
i += strlen(wm_class);
saveIconNameFor(iconPath, wm_instance, wm_class);
tmp = wmalloc(i+8);
*tmp = 0;
if (wm_class && wm_instance) {
sprintf(tmp, "%s.%s", wm_instance, wm_class);
} else {
if (wm_instance)
strcat(tmp, wm_instance);
if (wm_class)
strcat(tmp, wm_class);
}
key = PLMakeString(tmp);
free(tmp);
adict = PLGetDictionaryEntry(dict, key);
iconk = PLMakeString("Icon");
if (adict) {
val = PLGetDictionaryEntry(adict, iconk);
} else {
/* no dictionary for app, so create one */
adict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
PLInsertDictionaryEntry(dict, key, adict);
PLRelease(adict);
val = NULL;
}
if (!val) {
val = PLMakeString(iconPath);
PLInsertDictionaryEntry(adict, iconk, val);
PLRelease(val);
}
PLRelease(key);
if (val)
PLSave(dict, YES);
free(iconPath);
}
}
static Bool
extractClientIcon(WAppIcon *icon)
{
char *path;
path = wIconStore(icon->icon);
if (!path)
return False;
saveIconNameFor(path, icon->wm_instance, icon->wm_class);
free(path);
return True;
}
WApplication*
wApplicationCreate(WScreen *scr, Window main_window)
{
@@ -337,6 +361,9 @@ wApplicationCreate(WScreen *scr, Window main_window)
if (wapp->app_icon && !wapp->app_icon->docked) {
#else
if (wapp->app_icon && !wapp->app_icon->docked && wapp->app_icon->num_apps == 1) {
#ifdef THIS_SUCKS
}
#endif
#endif
WIcon *icon = wapp->app_icon->icon;
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
@@ -348,7 +375,7 @@ wApplicationCreate(WScreen *scr, Window main_window)
wapp->app_icon->icon->shadowed = 1;
wapp->app_icon->icon->force_paint = 1;
/* We don't do an wAppIconPaint() here because it's in
* wDockAttachIcon(). -Dan
* wDockAttachIcon(). -Dan.
*/
}
wDockAttachIcon(clip, wapp->app_icon, x, y);
@@ -367,6 +394,16 @@ wApplicationCreate(WScreen *scr, Window main_window)
wArrangeIcons(scr, True);
}
if (wapp->app_icon) {
char *tmp;
/* if the displayed icon was supplied by the client, save the icon */
tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance,
wapp->app_icon->wm_class, True);
if (!tmp)
extractClientIcon(wapp->app_icon);
}
wapp->prev = NULL;
wapp->next = scr->wapp_list;
if (scr->wapp_list)
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+1 -1
View File
@@ -1,6 +1,6 @@
/* appmenu.c- application defined menu
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+1 -1
View File
@@ -1,6 +1,6 @@
/* appmenu.h- application defined menu
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+5 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
@@ -137,7 +137,8 @@ makePixmap(WScreen *scr, int width, int height, int side, Pixmap *mask)
if (!bal->monoGC) {
bal->monoGC = XCreateGC(dpy, bitmap, 0, NULL);
}
XSetForeground(dpy, bal->monoGC, scr->black_pixel);
XSetForeground(dpy, bal->monoGC,
BlackPixelOfScreen(ScreenOfDisplay(dpy, scr->screen)));
XFillRectangle(dpy, bitmap, bal->monoGC, 0, 0, width+SPACE, height+SPACE);
pixmap = XCreatePixmap(dpy, scr->root_win, width+SPACE, height+SPACE,
@@ -152,7 +153,8 @@ makePixmap(WScreen *scr, int width, int height, int side, Pixmap *mask)
}
x = 0;
XSetForeground(dpy, bal->monoGC, scr->white_pixel);
XSetForeground(dpy, bal->monoGC,
WhitePixelOfScreen(ScreenOfDisplay(dpy, scr->screen)));
drawBalloon(bitmap, bal->monoGC, x, y, width, height, side);
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
drawBalloon(pixmap, scr->draw_gc, x+1, y+1, width-2, height-2, side);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+35 -21
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -58,6 +58,11 @@ extern Atom _XA_WINDOWMAKER_MENU;
extern Atom _XA_GNUSTEP_WM_ATTR;
extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
#ifdef SHAPE
extern Bool wShapeSupported;
#endif
/*
*--------------------------------------------------------------------
* wClientRestore--
@@ -72,8 +77,8 @@ wClientRestore(WWindow *wwin)
wClientGetGravityOffsets(wwin, &gx, &gy);
/* set the positio of the frame on screen */
wwin->frame_x -= gx * (wwin->old_border_width - FRAME_BORDER_WIDTH);
wwin->frame_y -= gy * (wwin->old_border_width - FRAME_BORDER_WIDTH);
wwin->frame_x -= gx * FRAME_BORDER_WIDTH;
wwin->frame_y -= gy * FRAME_BORDER_WIDTH;
/* if gravity is to the south, account for the border sizes */
if (gy > 0)
wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width);
@@ -105,7 +110,7 @@ wClientRestore(WWindow *wwin)
void
wClientSetState(WWindow *wwin, int state, Window icon_win)
{
unsigned long data[2];
CARD32 data[2];
wwin->state = state;
@@ -186,7 +191,7 @@ wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
return;
}
#ifdef SHAPE
{
if (wShapeSupported) {
int junk;
unsigned int ujunk;
int b_shaped;
@@ -492,9 +497,16 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
case XA_WM_NORMAL_HINTS:
/* normal (geometry) hints */
XGetWindowAttributes(dpy, wwin->client_win, &attribs);
GetNormalHints(wwin, &attribs, False);
{
int foo;
unsigned bar;
XGetWindowAttributes(dpy, wwin->client_win, &attribs);
wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,
&bar, &bar);
/* TODO: should we check for consistency of the current
* size against the new geometry hints? */
}
break;
case XA_WM_TRANSIENT_FOR:
@@ -593,17 +605,19 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
/*
*----------------------------------------------------------------------
* GetNormalHints--
* wClientGetNormalHints--
* Get size (normal) hints and a default geometry for the client
* window. The hints are also checked for inconsistency.
* window. The hints are also checked for inconsistency. If geometry is
* True, the returned data will account for client specified initial
* geometry.
*
* Side effects:
* normal_hints is filled with valid data and geometry information
* about the client is also changed.
* normal_hints is filled with valid data.
*----------------------------------------------------------------------
*/
void
GetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, int geometry)
wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
int *x, int *y, unsigned *width, unsigned *height)
{
int pre_icccm=0;
@@ -614,11 +628,11 @@ GetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, int geometry)
if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
wwin->normal_hints->flags = 0;
}
wwin->client.x = wattribs->x;
wwin->client.y = wattribs->y;
*x = wattribs->x;
*y = wattribs->y;
wwin->client.width = wattribs->width;
wwin->client.height = wattribs->height;
*width = wattribs->width;
*height = wattribs->height;
if (!(wwin->normal_hints->flags & PWinGravity)) {
wwin->normal_hints->win_gravity = NorthWestGravity;
@@ -677,12 +691,12 @@ GetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, int geometry)
printf("PRE ICCCM\n");
#endif
if (wwin->normal_hints->flags & (USPosition|PPosition)) {
wwin->client.x = wwin->normal_hints->x;
wwin->client.y = wwin->normal_hints->y;
*x = wwin->normal_hints->x;
*y = wwin->normal_hints->y;
}
if (wwin->normal_hints->flags & (USSize|PSize)) {
wwin->client.width = wwin->normal_hints->width;
wwin->client.height = wwin->normal_hints->height;
*width = wwin->normal_hints->width;
*height = wwin->normal_hints->height;
}
}
}
+4 -2
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -32,7 +32,9 @@ void wClientKill(WWindow *wwin);
void wClientCheckProperty(WWindow *wwin, XPropertyEvent *event);
void GetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, int geometry);
void wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs,
Bool geometry, int *x, int *y, unsigned *width,
unsigned *height);
void GetColormapWindows(WWindow *wwin);
#endif
+2 -1
View File
@@ -1,11 +1,12 @@
/* colormap.c - colormap handling code
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
* This code slightly based on fvwm code,
* Copyright (c) Rob Nation and others
* but completely rewritten.
*
* 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
+1 -1
View File
@@ -66,7 +66,7 @@
#define PACKAGE "WindowMaker"
/* package version */
#define VERSION "0.20.1"
#define VERSION "0.20.2"
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
+191 -415
View File
@@ -1,6 +1,6 @@
/* defaults.c - manage configuration through defaults db
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -96,6 +96,14 @@ typedef struct {
} WDefaultEntry;
/* used to map strings to integers */
typedef struct {
char *string;
short value;
char is_alias;
} WOptionEnumeration;
/* type converters */
static int getBool();
@@ -106,20 +114,14 @@ static int getCoord();
static int getString();
#endif
static int getPathList();
static int getFocusMode();
static int getPlacement();
static int getGeomDisp();
static int getEnum();
static int getTexture();
static int getWSBackground();
static int getJust();
static int getFont();
static int getColor();
static int getKeybind();
static int getModMask();
static int getSpeed();
static int getMButton();
static int getIconPosition();
static int getIconificationStyle();
/* value setting functions */
static int setJustify();
@@ -156,6 +158,94 @@ static int setClipTitleColor();
/*
* Tables to convert strings to enumeration values.
* Values stored are char
*/
/* WARNING: sum of length of all value strings must not exceed
* this value */
#define TOTAL_VALUES_LENGTH 80
static WOptionEnumeration seFocusModes[] = {
{"Manual", WKF_CLICK, 0}, {"ClickToFocus", WKF_CLICK, 1},
{"Auto", WKF_POINTER, 0}, {"FocusFollowMouse", WKF_POINTER, 1},
{"Sloppy", WKF_SLOPPY, 0}, {"SemiAuto", WKF_SLOPPY, 1},
{NULL, 0, 0}
};
static WOptionEnumeration seColormapModes[] = {
{"Manual", WKF_CLICK, 0}, {"ClickToFocus", WKF_CLICK, 1},
{"Auto", WKF_POINTER, 0}, {"FocusFollowMouse", WKF_POINTER, 1},
{NULL, 0, 0}
};
static WOptionEnumeration sePlacements[] = {
{"Auto", WPM_SMART, 0}, {"Smart", WPM_SMART, 1},
{"Cascade", WPM_CASCADE, 0},
{"Random", WPM_RANDOM, 0},
{"Manual", WPM_MANUAL, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seGeomDisplays[] = {
{"Center", WDIS_CENTER, 0},
{"Corner", WDIS_TOPLEFT, 0},
{"Floating", WDIS_FRAME_CENTER, 0},
{"Line", WDIS_NEW, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seSpeeds[] = {
{"UltraFast", SPEED_ULTRAFAST, 0},
{"Fast", SPEED_FAST, 0},
{"Medium", SPEED_MEDIUM, 0},
{"Slow", SPEED_SLOW, 0},
{"UltraSlow", SPEED_ULTRASLOW, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seMouseButtons[] = {
{"Left", Button1, 0}, {"Button1", Button1, 1},
{"Middle", Button2, 0}, {"Button2", Button2, 1},
{"Right", Button3, 0}, {"Button3", Button3, 1},
{"Button4", Button4, 0},
{"Button5", Button5, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seIconificationStyles[] = {
{"Zoom", WIS_ZOOM, 0},
{"Twist", WIS_TWIST, 0},
{"Flip", WIS_FLIP, 0},
{"None", WIS_NONE, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seJustifications[] = {
{"Left", WTJ_LEFT, 0},
{"Center", WTJ_CENTER, 0},
{"Right", WTJ_RIGHT, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seIconPositions[] = {
{"blv", IY_BOTTOM|IY_LEFT|IY_VERT, 0},
{"blh", IY_BOTTOM|IY_LEFT|IY_HORIZ, 0},
{"brv", IY_BOTTOM|IY_RIGHT|IY_VERT, 0},
{"brh", IY_BOTTOM|IY_RIGHT|IY_HORIZ, 0},
{"tlv", IY_TOP|IY_LEFT|IY_VERT, 0},
{"tlh", IY_TOP|IY_LEFT|IY_HORIZ, 0},
{"trv", IY_TOP|IY_RIGHT|IY_VERT, 0},
{"trh", IY_TOP|IY_RIGHT|IY_HORIZ, 0},
{NULL, 0, 0}
};
/*
* All entries in the tables bellow, NEED to have a default value
* defined, and this value needs to be correct.
@@ -184,8 +274,8 @@ WDefaultEntry staticOptionList[] = {
{"DisableWSMouseActions", "NO", NULL,
&wPreferences.disable_root_mouse, getBool, NULL
},
{"FocusMode", "manual", (void*)False,
&wPreferences.focus_mode, getFocusMode, NULL
{"FocusMode", "manual", seFocusModes,
&wPreferences.focus_mode, getEnum, NULL
}, /* have a problem when switching from manual to sloppy without restart */
{"NewStyle", "NO", NULL,
&wPreferences.new_style, getBool, NULL
@@ -195,27 +285,27 @@ WDefaultEntry staticOptionList[] = {
},
{"DisableClip", "NO", (void*) WM_CLIP,
NULL, getBool, setIfDockPresent
},
}
};
WDefaultEntry optionList[] = {
/* dynamic options */
{"IconPosition", "blh", NULL,
&wPreferences.icon_yard, getIconPosition, setIconPosition
{"IconPosition", "blh", seIconPositions,
&wPreferences.icon_yard, getEnum, setIconPosition
},
{"IconificationStyle", "Zoom", NULL,
&wPreferences.iconification_style, getIconificationStyle, NULL
{"IconificationStyle", "Zoom", seIconificationStyles,
&wPreferences.iconification_style, getEnum, NULL
},
{"SelectWindowsMouseButton", "Left", NULL,
&wPreferences.select_button, getMButton, NULL
{"SelectWindowsMouseButton", "Left", seMouseButtons,
&wPreferences.select_button, getEnum, NULL
},
{"WindowListMouseButton", "Middle", NULL,
&wPreferences.windowl_button, getMButton, NULL
{"WindowListMouseButton", "Middle", seMouseButtons,
&wPreferences.windowl_button, getEnum, NULL
},
{"ApplicationMenuMouseButton", "Right", NULL,
&wPreferences.menu_button, getMButton, NULL
{"ApplicationMenuMouseButton", "Right", seMouseButtons,
&wPreferences.menu_button, getEnum, NULL
},
{"PixmapPath", DEF_PIXMAP_PATHS, NULL,
&wPreferences.pixmap_path, getPathList, NULL
@@ -223,8 +313,8 @@ WDefaultEntry optionList[] = {
{"IconPath", DEF_ICON_PATHS, NULL,
&wPreferences.icon_path, getPathList, NULL
},
{"ColormapMode", "auto", (void*)True,
&wPreferences.colormap_mode, getFocusMode, NULL
{"ColormapMode", "auto", seColormapModes,
&wPreferences.colormap_mode, getEnum, NULL
},
{"AutoFocus", "NO", NULL,
&wPreferences.auto_focus, getBool, NULL
@@ -256,14 +346,14 @@ WDefaultEntry optionList[] = {
{"ScrollableMenus", "NO", NULL,
&wPreferences.scrollable_menus, getBool, NULL
},
{"MenuScrollSpeed", "medium", NULL,
&wPreferences.menu_scroll_speed, getSpeed, NULL
{"MenuScrollSpeed", "medium", seSpeeds,
&wPreferences.menu_scroll_speed, getEnum, NULL
},
{"IconSlideSpeed", "medium", NULL,
&wPreferences.icon_slide_speed, getSpeed, NULL
{"IconSlideSpeed", "medium", seSpeeds,
&wPreferences.icon_slide_speed, getEnum, NULL
},
{"ShadeSpeed", "medium", NULL,
&wPreferences.shade_speed, getSpeed, NULL
{"ShadeSpeed", "medium", seSpeeds,
&wPreferences.shade_speed, getEnum, NULL
},
{"DoubleClickTime", "250", (void*) &wPreferences.dblclick_time,
&wPreferences.dblclick_time, getInt, setDoubleClick,
@@ -274,8 +364,8 @@ WDefaultEntry optionList[] = {
{"OnTopTransients", "NO", NULL,
&wPreferences.on_top_transients, getBool, NULL
},
{"WindowPlacement", "auto", NULL,
&wPreferences.window_placement, getPlacement, NULL
{"WindowPlacement", "auto", sePlacements,
&wPreferences.window_placement, getEnum, NULL
},
{"IgnoreFocusClick","NO", NULL,
&wPreferences.ignore_focus_click, getBool, NULL
@@ -301,20 +391,22 @@ WDefaultEntry optionList[] = {
{"AutoArrangeIcons", "NO", NULL,
&wPreferences.auto_arrange_icons, getBool, NULL
},
/*
{"NoWindowUnderDock", "NO", NULL,
&wPreferences.no_window_under_dock, getBool, NULL
},
*/
{"NoWindowOverIcons", "NO", NULL,
&wPreferences.no_window_over_icons, getBool, NULL
},
{"WindowPlaceOrigin", "(0, 0)", NULL,
&wPreferences.window_place_origin, getCoord, NULL
},
{"ResizeDisplay", "corner", NULL,
&wPreferences.size_display, getGeomDisp, NULL
{"ResizeDisplay", "corner", seGeomDisplays,
&wPreferences.size_display, getEnum, NULL
},
{"MoveDisplay", "corner", NULL,
&wPreferences.move_display, getGeomDisp, NULL
{"MoveDisplay", "corner", seGeomDisplays,
&wPreferences.move_display, getEnum, NULL
},
{"DontConfirmKill", "NO", NULL,
&wPreferences.dont_confirm_kill, getBool,NULL
@@ -341,8 +433,8 @@ WDefaultEntry optionList[] = {
{"IconBack", "(solid, gray)", NULL,
NULL, getTexture, setIconTile
},
{"TitleJustify", "center", NULL,
&wPreferences.title_justification, getJust, setJustify
{"TitleJustify", "center", seJustifications,
&wPreferences.title_justification, getEnum, setJustify
},
{"WindowTitleFont", DEF_TITLE_FONT, NULL,
NULL, getFont, setWinTitleFont
@@ -504,15 +596,10 @@ WDefaultEntry optionList[] = {
},
{"Workspace10Key", "None", (void*)WKBD_WORKSPACE10,
NULL, getKeybind, setKeyGrab
},
}
};
/* Option names */
static proplist_t DCenter, DCorner, DFloating, DLine;
static proplist_t JLeft, JCenter, JRight;
#if 0
static void rereadDefaults(void);
#endif
@@ -535,15 +622,6 @@ initDefaults()
PLSetStringCmpHook(StringCompareHook);
DCenter = PLMakeString("Center");
DCorner = PLMakeString("Corner");
DFloating = PLMakeString("Floating");
DLine = PLMakeString("Line");
JLeft = PLMakeString("Left");
JCenter = PLMakeString("Center");
JRight = PLMakeString("Right");
for (i=0; i<sizeof(optionList)/sizeof(WDefaultEntry); i++) {
entry = &optionList[i];
@@ -1114,6 +1192,44 @@ wDefaultUpdateIcons(WScreen *scr)
PLGetString(entry->plkey), x); \
return False; }
static int
string2index(proplist_t key, proplist_t val, proplist_t def,
WOptionEnumeration *values)
{
char *str;
WOptionEnumeration *v;
char buffer[TOTAL_VALUES_LENGTH];
if (PLIsString(val) && (str = PLGetString(val))) {
for (v=values; v->string!=NULL; v++) {
if (strcasecmp(v->string, str)==0)
return v->value;
}
}
buffer[0] = 0;
for (v=values; v->string!=NULL; v++) {
if (!v->is_alias) {
if (buffer[0]!=0)
strcat(buffer, ", ");
strcat(buffer, v->string);
}
}
wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
PLGetString(key), buffer);
if (def) {
return string2index(key, val, NULL, values);
}
return -1;
}
/*
* value - is the value in the defaults DB
* addr - is the address to store the data
@@ -1375,88 +1491,19 @@ again:
static int
getFocusMode(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
getEnum(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static char data;
char *val;
int second_pass=0;
STRINGP("one of Manual, Auto or Sloppy");
val = PLGetString(value);
again:
if (strcasecmp(val, "manual")==0 || strcasecmp(val, "clicktofocus")==0)
data = WKF_CLICK;
else if (strcasecmp(val, "auto")==0 || strcasecmp(val, "focusfollowsmouse")==0)
data = WKF_POINTER;
else if ((strcasecmp(val, "semiauto")==0 || strcasecmp(val, "sloppy")==0)
&& !(int)entry->extra_data)
data = WKF_SLOPPY;
else {
if (!(int)entry->extra_data)
wwarning(_("Invalid focus mode \"%s\". Should be Manual, "
"Auto or Sloppy."), PLGetString(value));
else
wwarning(_("Invalid colormap focus mode \"%s\". Should be Manual or "
"Auto."), PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
return True;
}
static int
getPlacement(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static char data;
char *val;
int second_pass=0;
STRINGP("one of Auto, Cascade, Random or Manual");
val = PLGetString(value);
again:
if (strcasecmp(val, "auto")==0 || strcasecmp(val, "smart")==0)
data = WPM_SMART;
else if (strcasecmp(val, "cascade")==0)
data = WPM_CASCADE;
else if (strcasecmp(val, "manual")==0)
data = WPM_MANUAL;
else if (strcasecmp(val, "random")==0)
data = WPM_RANDOM;
else {
wwarning(_("Invalid window placement mode \"%s\". "
"Should be Auto, Cascade, Random or Manual."),
PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
data = string2index(entry->key, value, entry->default_value,
(WOptionEnumeration*)entry->extra_data);
if (data < 0)
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
@@ -1465,185 +1512,6 @@ again:
static int
getGeomDisp(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static char data;
int changed=0;
STRINGP("one of Center, Corner, Floating or Line");
again:
if(PLIsEqual(value, DCenter))
data = WDIS_CENTER;
else if(PLIsEqual(value, DCorner))
data = WDIS_TOPLEFT;
else if(PLIsEqual(value, DFloating))
data = WDIS_FRAME_CENTER;
else if(PLIsEqual(value, DLine))
data = WDIS_NEW;
else {
wwarning(_("Invalid geometry display type \"%s\". Should "
"be Center, Corner, Floating or Line."),
PLGetString(value));
if (changed==0) {
value = entry->plvalue;
changed = 1;
wwarning(_("using default \"%s\" instead"), entry->default_value);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
return True;
}
static int
getSpeed(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static int data;
char *val;
int second_pass=0;
STRINGP("one of UltraFast, Fast, Medium, Slow or UltraSlow");
val = PLGetString(value);
again:
if (strcasecmp(val, "ultrafast")==0)
data = SPEED_ULTRAFAST;
else if (strcasecmp(val, "fast")==0)
data = SPEED_FAST;
else if (strcasecmp(val, "medium")==0)
data = SPEED_MEDIUM;
else if (strcasecmp(val, "slow")==0)
data = SPEED_SLOW;
else if (strcasecmp(val, "ultraslow")==0)
data = SPEED_ULTRASLOW;
else {
wwarning(_("Invalid speed \"%s\". Should be UltraFast, Fast, "
"Medium, Slow or UltraSlow."), PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(int*)addr = data;
return True;
}
static int
getMButton(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static char data;
char *val;
int second_pass=0;
STRINGP("one of Left, Middle, Right or Button1 through Button5");
val = PLGetString(value);
again:
if (strcasecmp(val, "left")==0 || strcasecmp(val, "button1")==0)
data = Button1;
else if (strcasecmp(val, "middle")==0 || strcasecmp(val, "button2")==0)
data = Button2;
else if (strcasecmp(val, "right")==0 || strcasecmp(val, "button3")==0)
data = Button3;
else if (strcasecmp(val, "button4")==0)
data = Button4;
else if (strcasecmp(val, "button5")==0)
data = Button4;
else {
wwarning(_("Invalid mouse button \"%s\". "
"Should be Left, Middle, Right or Button1 through Button5"),
PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
return True;
}
static int
getIconificationStyle(WScreen *scr, WDefaultEntry *entry, proplist_t value,
void *addr, void **ret)
{
static char data;
char *val;
int second_pass=0;
STRINGP("one of Zoom, Twist, Flip or None");
val = PLGetString(value);
again:
if (strcasecmp(val, "zoom")==0)
data = WIS_ZOOM;
else if (strcasecmp(val, "twist")==0)
data = WIS_TWIST;
else if (strcasecmp(val, "flip")==0)
data = WIS_FLIP;
else if (strcasecmp(val, "none")==0)
data = WIS_NONE;
else {
wwarning(_("Invalid iconification style \"%s\". "
"Should be Zoom, Twist, Flip or None"),
PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
return True;
}
/*
* (solid <color>)
* (hgradient <color> <color>)
@@ -1745,7 +1613,7 @@ parse_texture(WScreen *scr, proplist_t pl)
RColor **colors;
int i, count;
int type;
if (nelem < 3) {
wwarning(_("too few arguments in multicolor gradient specification"));
return NULL;
@@ -1759,27 +1627,27 @@ parse_texture(WScreen *scr, proplist_t pl)
type = WTEX_MDGRADIENT;
count = nelem-1;
colors = wmalloc(sizeof(RColor*)*(count+1));
for (i=0; i<count; i++) {
elem = PLGetArrayElement(pl, i+1);
if (!elem || !PLIsString(elem)) {
for ( ; i>=0; --i) {
for (--i; i>=0; --i) {
free(colors[i]);
}
free(colors);
break;
return NULL;
}
val = PLGetString(elem);
if (!XParseColor(dpy, scr->colormap, val, &color)) {
wwarning(_("\"%s\" is not a valid color name"), val);
for ( ; i>=0; --i) {
for (--i; i>=0; --i) {
free(colors[i]);
}
free(colors);
break;
free(colors);
return NULL;
} else {
colors[i] = wmalloc(sizeof(RColor));
colors[i]->red = color.red >> 8;
@@ -2224,43 +2092,6 @@ again:
}
#endif /* !EXPERIMENTAL */
static int
getJust(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static char data;
int changed=0;
STRINGP("one of Left, Center or Right");
again:
if(PLIsEqual(value, JLeft))
data = WTJ_LEFT;
else if(PLIsEqual(value, JRight))
data = WTJ_RIGHT;
else if(PLIsEqual(value, JCenter))
data = WTJ_CENTER;
else {
wwarning(_("Invalid justification type \"%s\". Should be "
"Left, Center or Right"), PLGetString(value));
if (changed==0) {
value = entry->plvalue;
changed = 1;
wwarning(_("using default \"%s\" instead"), entry->default_value);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(char*)addr = data;
return True;
}
static int
getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
@@ -2425,58 +2256,6 @@ getModMask(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
static int
getIconPosition(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
void **ret)
{
static int data;
char *val;
int second_pass=0;
STRINGP("one of blv, blh, brv, brh, tlv, tlh, trv, trh");
val = PLGetString(value);
again:
if (strlen(val)==3) {
if (val[0]=='T' || val[0]=='t') {
data = IY_TOP;
} else {
data = IY_BOTTOM;
}
if (val[1]=='R' || val[1]=='r') {
data |= IY_RIGHT;
} else {
data |= IY_LEFT;
}
if (val[2]=='V' || val[2]=='v') {
data |= IY_VERT;
} else {
data |= IY_HORIZ;
}
} else {
wwarning(_("Invalid icon Position \"%s\". "
"Should be one of blv, blh, brv, brh, tlv, tlh, trv, trh"),
PLGetString(value));
if (second_pass==0) {
val = PLGetString(entry->plvalue);
second_pass = 1;
wwarning(_("using default \"%s\" instead"), val);
goto again;
}
return False;
}
if (ret)
*ret = &data;
if (addr)
*(int*)addr = data;
return True;
}
/* ---------------- value setting functions --------------- */
static int
setJustify(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
@@ -2857,17 +2636,14 @@ setMenuDisabledColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *fo
* WPixel color; // color for solid texture
* proplist_t texture; // for checking updates
* };
*
*
* spixmap and cpixmap textures are rendered by wmsetbg in a buffer
* supplied by wmaker (-x drawable-XID).
* All other textures are rendered by wmaker itself. This is to
* prevent wmaker from blocking when rendering large pixmaps.
* tpixmap must be rendered by wmaker because we dont know the size
* of the image before loading the image. We supply the pixmap
* to wmsetbg, instead of letting wmsetbg create it for 2 reasons:
* 1 - Xlib will free the pixmap when wmsetbg exits
* 2 - it would require wmaker to figure when wmsetbg finished
* rendering (complicated synchronization...).
* All textures are rendered by wmsetbg. When it exits with status 0
* it outputs the pixmap ID.
* wmaker will monitor the fd and when it becomes available it reads the
* pixmap ID and uses it in the texture. The data read from the fd
* is the pixmap ID and the pid of the wmsetbg process, separated by
* a space (the pid is to allow paralel wmsetbg processes).
*
* The workspace background cant be set if the pid field of the
* texture is 0. Otherwise, the texture is still being rendered
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+38 -14
View File
@@ -1,6 +1,6 @@
/* dialog.c - dialog windows for internal use
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -600,11 +600,13 @@ renderText(WMScreen *scr, char *text, char *font, RColor *from, RColor *to)
gradient = RRenderGradient(w, h, from, to, RVerticalGradient);
if (!gradient) {
wwarning("error doing image processing:%s", RErrorString);
wwarning("error doing image processing:%s",
RMessageForError(RErrorCode));
goto bye;
}
if (!RConvertImage(rc, gradient, &grad)) {
wwarning("error doing image processing:%s", RErrorString);
wwarning("error doing image processing:%s",
RMessageForError(RErrorCode));
goto bye;
}
@@ -642,7 +644,7 @@ wShowInfoPanel(WScreen *scr)
WMSize size;
WMFont *font;
char version[32];
char buffer[256];
char buffer[512];
Window parent;
WWindow *wwin;
RColor color1, color2;
@@ -686,10 +688,10 @@ wShowInfoPanel(WScreen *scr)
color1.red = 0;
color1.green = 0;
color1.blue = 0;
color2.red = 0x80;
color2.green = 0x80;
color2.blue = 0x80;
logo = renderText(scr->wmscreen, " WindowMaker ",
color2.red = 0x50;
color2.green = 0x50;
color2.blue = 0x60;
logo = renderText(scr->wmscreen, " Window Maker ",
"-*-times-bold-r-*-*-24-*", &color1, &color2);
if (logo) {
WMSetLabelImagePosition(panel->name1L, WIPImageOnly);
@@ -701,7 +703,7 @@ wShowInfoPanel(WScreen *scr)
WMSetLabelFont(panel->name1L, font);
WMReleaseFont(font);
}
WMSetLabelText(panel->name1L, "WindowMaker");
WMSetLabelText(panel->name1L, "Window Maker");
}
panel->name2L = WMCreateLabel(panel->win);
@@ -735,15 +737,37 @@ wShowInfoPanel(WScreen *scr)
WMSetLabelFont(panel->copyrL, font);
}
sprintf(buffer, "Using visual %s %ibpp (0x%x)\n",
visuals[scr->w_visual->class], scr->w_depth,
(unsigned)scr->w_visual->visualid);
switch (scr->w_depth) {
case 15:
strcpy(version, "32 thousand");
break;
case 16:
strcpy(version, "64 thousand");
break;
case 24:
case 32:
strcpy(version, "16 million");
break;
default:
sprintf(version, "%d", 1<<scr->w_depth);
break;
}
sprintf(buffer, "Using visual 0x%x: %s %ibpp (%s colors)\n",
(unsigned)scr->w_visual->visualid,
visuals[scr->w_visual->class], scr->w_depth, version);
strcat(buffer, "Supported image formats: ");
strl = RSupportedFileFormats();
for (i=0; strl[i]!=NULL; i++) {
strcat(buffer, strl[i]);
strcat(buffer, " ");
}
#ifdef WMSOUND
strcat(buffer, "\nSound support compiled in");
#else
strcat(buffer, "\nSound support not available");
#endif
panel->infoL = WMCreateLabel(panel->win);
WMResizeWidget(panel->infoL, 350, 75);
@@ -801,11 +825,11 @@ typedef struct {
#define LICENSE_TEXT \
" WindowMaker is free software; you can redistribute it and/or modify "\
" Window Maker 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 (at your option) any later version.\n\n\n"\
" WindowMaker is distributed in the hope that it will be useful, but "\
" Window Maker is distributed in the hope that it will be useful, but "\
"WITHOUT ANY WARRANTY; without even the implied warranty of "\
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "\
"General Public License for more details.\n\n\n"\
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+139 -171
View File
@@ -1,6 +1,6 @@
/* dock.c- built-in Dock module for WindowMaker
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -69,22 +69,6 @@
#define CLIP_IDLE 0
#define CLIP_FORWARD 2
/* This should be 24. It looks better.
* Proof: the golden ratio is ~1.6:
* 64/1.6 = 24, thus 24 will look better than 22 :)
* -Alfredo
*
* This is true, but... ;)
* CLIP_BUTTON_SIZE only means the button itself, without the black delimiting
* line. So because one sees the black line together with the button, it should
* be 23. There is no big difference between 23 and 24, but 23 gives also a
* better aspect ratio between the button and the arrow mark.
* Anyway if you feel stronger for 24 you can change it as it is not very
* important.
*
* BTW I think you meant 64-64/1.6=24 or 64/(1.6*1.6) ;)
* -Dan
*/
#define CLIP_BUTTON_SIZE 23
@@ -260,6 +244,9 @@ killCallback(WMenu *menu, WMenuEntry *entry)
assert(entry->clientdata!=NULL);
icon = (WAppIcon*)entry->clientdata;
icon->editing = 1;
#ifdef REDUCE_APPICONS
/* Send a delete message to the main window of each application
* bound to this docked appicon. - cls
@@ -286,6 +273,8 @@ killCallback(WMenu *menu, WMenuEntry *entry)
}
}
#endif /* !REDUCE_APPICONS */
icon->editing = 0;
}
@@ -437,7 +426,7 @@ removeIconsCallback(WMenu *menu, WMenuEntry *entry)
selectedIcons = list_cons(clickedIcon, NULL);
}
while(selectedIcons) {
while (selectedIcons) {
aicon = selectedIcons->head;
keepit = aicon->running && wApplicationOf(aicon->main_window);
wDockDetach(dock, aicon);
@@ -475,7 +464,8 @@ keepIconsCallback(WMenu *menu, WMenuEntry *entry)
if (!selectedIcons && clickedIcon!=dock->screen_ptr->clip_icon) {
char *command = NULL;
if (!clickedIcon->command) {
if (!clickedIcon->command && !clickedIcon->editing) {
clickedIcon->editing = 1;
if (wInputDialog(dock->screen_ptr, _("Keep Icon"),
_("Type the command used to launch the application"),
&command)==WDB_OK) {
@@ -485,7 +475,9 @@ keepIconsCallback(WMenu *menu, WMenuEntry *entry)
command = NULL;
}
clickedIcon->command = command;
clickedIcon->editing = 0;
} else {
clickedIcon->editing = 0;
if (command)
free(command);
return;
@@ -913,7 +905,7 @@ updateClipOptionsMenu(WMenu *menu, WDock *dock)
if (!menu || !dock)
return;
/* floating */
/* keep on top */
entry = menu->entries[index];
entry->flags.indicator_on = !dock->lowered;
entry->clientdata = dock;
@@ -955,7 +947,7 @@ makeClipOptionsMenu(WScreen *scr)
return NULL;
}
entry = wMenuAddCallback(menu, _("Floating Clip"),
entry = wMenuAddCallback(menu, _("Keep Clip On Top"),
toggleLoweredCallback, NULL);
entry->flags.indicator = 1;
entry->flags.indicator_on = 1;
@@ -1003,7 +995,7 @@ dockMenuCreate(WScreen *scr, int type)
menu = wMenuCreate(scr, NULL, False);
if (type != WM_CLIP) {
entry = wMenuAddCallback(menu, _("Floating Dock"),
entry = wMenuAddCallback(menu, _("Keep Dock On Top"),
toggleLoweredCallback, NULL);
entry->flags.indicator = 1;
entry->flags.indicator_on = 1;
@@ -1919,6 +1911,7 @@ wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
wwin = icon->icon->owner;
if (icon->command==NULL) {
icon->editing = 0;
if (XGetCommand(dpy, wwin->client_win, &argv, &argc) && argc>0) {
icon->command = FlattenStringList(argv, argc);
@@ -1928,6 +1921,7 @@ wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
/* icon->forced_dock = 1;*/
if (!icon->attracted || dock->type!=WM_CLIP || dock->keep_attracted) {
icon->editing = 1;
if (wInputDialog(dock->screen_ptr, _("Dock Icon"),
_("Type the command used to launch the application"),
&command)==WDB_OK) {
@@ -1937,7 +1931,9 @@ wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
command = NULL;
}
icon->command = command;
icon->editing = 0;
} else {
icon->editing = 0;
if (command)
free(command);
/* If the target is the dock, reject the icon. If
@@ -1949,13 +1945,15 @@ wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
icon->icon->shadowed = 1;
icon->icon->force_paint = 1;
}
} else
} else {
return False;
}
}
}
}
} else {
icon->editing = 0;
}
for (index=1; index<dock->max_icons; index++)
if (dock->icon_array[index] == NULL)
@@ -2044,6 +2042,7 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
} else {
char *command=NULL;
icon->editing = 1;
/* icon->forced_dock = 1;*/
if (wInputDialog(src->screen_ptr, _("Dock Icon"),
_("Type the command used to launch the application"),
@@ -2055,10 +2054,12 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
}
icon->command = command;
} else {
icon->editing = 0;
if (command)
free(command);
return False;
}
icon->editing = 0;
}
}
@@ -2207,10 +2208,10 @@ wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
int dx, dy;
int ex_x, ex_y;
int i, offset = ICON_SIZE/2;
int only_down = (dock->type == WM_DOCK);
WAppIcon *aicon = NULL;
WAppIcon *nicon = NULL;
dx = dock->x_pos;
dy = dock->y_pos;
@@ -2231,50 +2232,116 @@ wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
else
ex_x = (req_x + offset - dx)/ICON_SIZE;
if ((ex_y < 1 || ex_x != 0) && only_down)
return False;
/* check if the icon is outside the screen boundaries */
if (dx + ex_x*ICON_SIZE < -ICON_SIZE+2 ||
dx + ex_x*ICON_SIZE > scr->scr_width-1 ||
dy + ex_y*ICON_SIZE < -ICON_SIZE+2 ||
dy + ex_y*ICON_SIZE > scr->scr_height-1)
return False;
if (dock->x_pos + ex_x*ICON_SIZE < -ICON_SIZE+2 ||
dock->x_pos + ex_x*ICON_SIZE > scr->scr_width-1 ||
dock->y_pos + ex_y*ICON_SIZE < -ICON_SIZE+2 ||
dock->y_pos + ex_y*ICON_SIZE > scr->scr_height-1)
return False;
if (dock->type == WM_DOCK) {
for (i=0; i<dock->max_icons; i++) {
nicon = dock->icon_array[i];
if (nicon && nicon->yindex == ex_y) {
aicon = nicon;
break;
}
}
for (i=0; i<dock->max_icons; i++) {
nicon = dock->icon_array[i];
if (nicon && nicon->xindex == ex_x && nicon->yindex == ex_y) {
aicon = nicon;
break;
}
}
*ret_x = 0;
if (!only_down) {
int neighbours = 0;
for (i=0; i<dock->max_icons; i++) {
nicon = dock->icon_array[i];
if (nicon && nicon != icon && /* Icon can't be it's own neighbour */
(abs(nicon->xindex - ex_x) <= CLIP_ATTACH_VICINITY &&
abs(nicon->yindex - ex_y) <= CLIP_ATTACH_VICINITY)) {
neighbours = 1;
break;
}
}
if ((!redocking && neighbours && !aicon) ||
(redocking && neighbours && (aicon == icon || !aicon))) {
*ret_x = ex_x;
*ret_y = ex_y;
return True;
}
if (redocking) {
int sig, done, closest;
/* Possible cases when redocking:
*
* icon dragged out of range of any slot -> false
* icon dragged to range of free slot
* icon dragged to range of same slot
* icon dragged to range of different icon
*/
if (abs(ex_x) > DOCK_DETTACH_THRESHOLD)
return False;
if (ex_y >=0 && (aicon == icon || !aicon)) {
*ret_y = ex_y;
return True;
}
/* start looking at the upper slot or lower? */
if (ex_y*ICON_SIZE < (req_y + offset - dy))
sig = 1;
else
sig = -1;
closest = -1;
done = 0;
/* look for closest free slot */
for (i=0; i<(DOCK_DETTACH_THRESHOLD+1)*2 && !done; i++) {
int j;
done = 1;
closest = sig*(i/2) + ex_y;
/* check if this slot is used */
if (closest >= 0) {
for (j = 0; j<dock->max_icons; j++) {
if (dock->icon_array[j]
&& dock->icon_array[j]->yindex==closest) {
/* slot is used by someone else */
if (dock->icon_array[j]!=icon)
done = 0;
break;
}
}
}
sig = -sig;
}
if (done && closest >= 0 &&
((ex_y >= closest && ex_y - closest < DOCK_DETTACH_THRESHOLD+1)
||
(ex_y < closest && closest - ex_y <= DOCK_DETTACH_THRESHOLD+1))) {
*ret_y = closest;
return True;
}
} else { /* !redocking */
/* if slot is free and the icon is close enough, return it */
if (!aicon && ex_x==0 && ex_y>=0) {
*ret_y = ex_y;
return True;
}
}
} else { /* CLIP */
int neighbours = 0;
for (i=0; i<dock->max_icons; i++) {
nicon = dock->icon_array[i];
if (nicon && nicon->xindex == ex_x && nicon->yindex == ex_y) {
aicon = nicon;
break;
}
}
for (i=0; i<dock->max_icons; i++) {
nicon = dock->icon_array[i];
if (nicon && nicon != icon && /* Icon can't be it's own neighbour */
(abs(nicon->xindex - ex_x) <= CLIP_ATTACH_VICINITY &&
abs(nicon->yindex - ex_y) <= CLIP_ATTACH_VICINITY)) {
neighbours = 1;
break;
}
}
if ((!redocking && neighbours && !aicon) ||
(redocking && neighbours && (aicon == icon || !aicon))) {
*ret_x = ex_x;
*ret_y = ex_y;
return True;
}
}
else {
if ((!redocking && !aicon) ||
(redocking && (aicon==icon || !aicon))) {
*ret_x = 0;
*ret_y = ex_y;
return True;
}
}
return False;
}
@@ -2296,18 +2363,12 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
{
WScreen *scr = dock->screen_ptr;
WAppIcon *btn;
#if 1
unsigned char *slot_map;
int mwidth;
int r;
int x, y;
int i, done = False;
int corner;
#else
int n = MAX(dock->max_icons, MAX(scr->scr_width, scr->scr_height)/ICON_SIZE + 1);
unsigned char *north, *south, *east, *west;
int i, j, done=False;
#endif
int sx=0, sy=0, ex=scr->scr_width, ey=scr->scr_height;
/* if the dock is full */
@@ -2326,7 +2387,6 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
ex = dock->x_pos;
if (sx > dock->x_pos+ICON_SIZE)
sx = dock->x_pos+ICON_SIZE;
#if 1
#define C_NONE 0
#define C_NW 1
#define C_NE 2
@@ -2348,9 +2408,6 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
} else
corner = C_NONE;
/* This one checks for diagonal positions, uses less memory
* and CPU. -Alfredo */
/* If the clip is in the corner, use only slots that are in the border
* of the screen */
if (corner!=C_NONE) {
@@ -2530,90 +2587,6 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
free(slot_map);
#undef XY2OFS
return done;
#else
north = (unsigned char*) wmalloc(sizeof(unsigned char) * n);
south = (unsigned char*) wmalloc(sizeof(unsigned char) * n);
east = (unsigned char*) wmalloc(sizeof(unsigned char) * n);
west = (unsigned char*) wmalloc(sizeof(unsigned char) * n);
/* We allow 3 passes to find a free position. This can be increased,
* but usually is more than enough for a normal (<25 icons/clip)
* environment. 25 free slots are found in the first pass for a
* 1024x768 screen size.
*
*/
for (i=0; i<3 && !done; i++) {
memset(north, 0, sizeof(unsigned char) * n);
memset(south, 0, sizeof(unsigned char) * n);
memset(east, 0, sizeof(unsigned char) * n);
memset(west, 0, sizeof(unsigned char) * n);
for (j=0; j<dock->max_icons; j++) {
btn = dock->icon_array[j];
if (!btn)
continue;
if (btn->yindex == i && btn->xindex >= 0)
east[btn->xindex] = 1;
else if (btn->yindex == -i && btn->xindex < 0)
west[-(btn->xindex)] = 1;
else if (btn->xindex == -i && btn->yindex >= 0)
south[btn->yindex] = 1;
else if (btn->xindex == i && btn->yindex < 0)
north[-(btn->yindex)] = 1;
}
for (j=1; j<n; j++) {
int x, y;
if (east[j]==0) {
x = dock->x_pos + j*ICON_SIZE;
y = dock->y_pos + i*ICON_SIZE;
if (ON_SCREEN(x, y, sx, ex, sy, ey)) {
*x_pos = j;
*y_pos = i;
done = True;
break;
}
}
if (west[j]==0) {
x = dock->x_pos + (-j)*ICON_SIZE;
y = dock->y_pos + (-i)*ICON_SIZE;
if (ON_SCREEN(x, y, sx, ex, sy, ey)) {
*x_pos = -j;
*y_pos = -i;
done = True;
break;
}
}
if (south[j]==0) {
x = dock->x_pos + (-i)*ICON_SIZE;
y = dock->y_pos + (j)*ICON_SIZE;
if (ON_SCREEN(x, y, sx, ex, sy, ey)) {
*x_pos = -i;
*y_pos = j;
done = True;
break;
}
}
if (north[j]==0) {
x = dock->x_pos + (i)*ICON_SIZE;
y = dock->y_pos + (-j)*ICON_SIZE;
if (ON_SCREEN(x, y, sx, ex, sy, ey)) {
*x_pos = i;
*y_pos = -j;
done = True;
break;
}
}
}
}
free(north);
free(south);
free(east);
free(west);
return done; /* If done is True this means that we found a free slot */
#endif
}
@@ -2727,8 +2700,8 @@ execCommand(WAppIcon *btn, char *command, WSavedState *state)
else
state->workspace = scr->current_workspace;
}
wAddWindowSavedState(btn->wm_instance, btn->wm_class,
cmdline, pid, state);
wWindowAddSavedState(btn->wm_instance, btn->wm_class, cmdline, pid,
state);
wAddDeathHandler(pid, (WDeathHandler*)trackDeadProcess,
btn->dock);
} else if (state) {
@@ -3051,7 +3024,7 @@ openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
int appIsRunning = aicon->running && aicon->icon && aicon->icon->owner;
if (dock->type == WM_DOCK) {
/* floating */
/* keep on top */
entry = dock->menu->entries[index];
entry->flags.indicator_on = !dock->lowered;
entry->clientdata = dock;
@@ -3124,8 +3097,7 @@ openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
if (dock->type == WM_CLIP) {
x_pos = event->xbutton.x_root+2;
}
else {
} else {
x_pos = dock->on_right_side ?
scr->scr_width - dock->menu->frame->core->width - 2 : 0;
}
@@ -3609,13 +3581,6 @@ handleClipChangeWorkspace(WScreen *scr, XEvent *event)
int new_dir;
WDock *clip = scr->clip_icon->dock;
/* if this is reached during startup (before the 1st wWorkspaceForceChange)
* we will get undesired effects, like having all windows unmapped and
* don't having them back if the clip buttons are clicked.
*/
if (scr->flags.startup2 || scr->flags.startup)
return;
direction = getClipButton(event->xbutton.x, event->xbutton.y);
clip->lclip_button_pushed = direction==CLIP_REWIND;
@@ -3681,6 +3646,9 @@ iconMouseDown(WObjDescriptor *desc, XEvent *event)
WDock *dock = aicon->dock;
WScreen *scr = aicon->icon->core->screen_ptr;
if (aicon->editing)
return;
scr->last_dock = dock;
if (dock->menu->flags.mapped)
+1 -1
View File
@@ -1,6 +1,6 @@
/* dock.h- built-in Dock module for WindowMaker
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+2 -2
View File
@@ -1,6 +1,6 @@
/* dockedapp.c- docked application settings panel
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
@@ -335,7 +335,7 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
WMMoveWidget(panel->iconField, 10, 20);
WMSetTextFieldText(panel->iconField,
wDefaultGetIconFile(scr, aicon->wm_instance,
aicon->wm_class, False));
aicon->wm_class, True));
panel->browseBtn = WMCreateCommandButton(panel->iconFrame);
WMResizeWidget(panel->browseBtn, 70, 24);
+168 -196
View File
@@ -1,6 +1,6 @@
/* event.c- event loop and handling
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -34,6 +34,11 @@
#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif
#ifdef XDE_DND
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#endif
#include "WindowMaker.h"
#include "window.h"
@@ -67,20 +72,29 @@ extern WPreferences wPreferences;
extern Atom _XA_WM_CHANGE_STATE;
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
#ifdef OFFIX_DND
extern Atom _XA_DND_PROTOCOL;
#endif
#ifdef XDE_DND
extern Atom _XA_XDE_REQUEST;
extern Atom _XA_XDE_ENTER;
extern Atom _XA_XDE_LEAVE;
extern Atom _XA_XDE_DATA_AVAILABLE;
extern Atom _XDE_FILETYPE;
extern Atom _XDE_URLTYPE;
#endif
#ifdef SHAPE
extern int ShapeEventBase;
extern Bool wShapeSupported;
extern int wShapeEventBase;
#endif
/* special flags */
extern char WRestartASAP;
extern char WExitASAP;
extern char WProgramState;
extern char WDelayedActionSet;
@@ -132,132 +146,9 @@ typedef struct DeathHandler {
static DeathHandler *deathHandler=NULL;
static WWindowState *windowState=NULL;
WMagicNumber
wAddWindowSavedState(char *instance, char *class, char *command,
pid_t pid, WSavedState *state)
{
WWindowState *wstate;
wstate = malloc(sizeof(WWindowState));
if (!wstate)
return 0;
memset(wstate, 0, sizeof(WWindowState));
wstate->pid = pid;
if (instance)
wstate->instance = wstrdup(instance);
if (class)
wstate->class = wstrdup(class);
if (command)
wstate->command = wstrdup(command);
wstate->state = state;
wstate->next = windowState;
windowState = wstate;
#ifdef DEBUG
printf("Added WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance,
class, command);
#endif
return wstate;
}
#define SAME(x, y) (((x) && (y) && !strcmp((x), (y))) || (!(x) && !(y)))
WMagicNumber
wGetWindowSavedState(Window win)
{
char *instance, *class, *command=NULL;
WWindowState *wstate = windowState;
char **argv;
int argc;
if (!wstate)
return NULL;
if (XGetCommand(dpy, win, &argv, &argc) && argc>0) {
command = FlattenStringList(argv, argc);
XFreeStringList(argv);
}
if (!command)
return NULL;
if (PropGetWMClass(win, &class, &instance)) {
while (wstate) {
if (SAME(instance, wstate->instance) &&
SAME(class, wstate->class) &&
SAME(command, wstate->command)) {
break;
}
wstate = wstate->next;
}
} else {
wstate = NULL;
}
#ifdef DEBUG
printf("Read WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance,
class, command);
#endif
if (command) free(command);
if (instance) XFree(instance);
if (class) XFree(class);
return wstate;
}
void
wDeleteWindowSavedState(WMagicNumber id)
{
WWindowState *tmp, *wstate=(WWindowState*)id;
if (!wstate || !windowState)
return;
tmp = windowState;
if (tmp==wstate) {
windowState = wstate->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
} else {
while (tmp->next) {
if (tmp->next==wstate) {
tmp->next=wstate->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
break;
}
tmp = tmp->next;
}
}
}
WMagicNumber
WDeathHandlerID
wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata)
{
DeathHandler *handler;
@@ -280,7 +171,7 @@ wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata)
void
wDeleteDeathHandler(WMagicNumber id)
wDeleteDeathHandler(WDeathHandlerID id)
{
DeathHandler *tmp, *handler=(DeathHandler*)id;
@@ -312,8 +203,8 @@ DispatchEvent(XEvent *event)
if (deathHandler)
handleDeadProcess(NULL);
if (WExitASAP) {
WExitASAP = 0;
if (WProgramState==WSTATE_NEED_EXIT) {
WProgramState = WSTATE_EXITING;
/*
* WMHandleEvent() can't be called from anything
@@ -331,8 +222,8 @@ DispatchEvent(XEvent *event)
ExecExitScript();
/* received SIGTERM */
exit(0);
} else if (WRestartASAP) {
WRestartASAP = 0;
} else if (WProgramState == WSTATE_NEED_RESTART) {
WProgramState = WSTATE_RESTARTING;
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
@@ -487,26 +378,10 @@ static void
handleDeadProcess(void *foo)
{
DeathHandler *tmp;
WWindowState *wins;
int i;
int tmpPtr = deadProcessPtr;
if (windowState) {
while (tmpPtr>0) {
tmpPtr--;
wins = windowState;
while (wins) {
WWindowState *t;
t = wins->next;
if (wins->pid == deadProcesses[tmpPtr].pid) {
wDeleteWindowSavedState(wins);
}
wins = t;
}
}
for (i=0; i<deadProcessPtr; i++) {
wWindowDeleteSavedStatesForPID(deadProcesses[i].pid);
}
if (!deathHandler) {
@@ -577,7 +452,7 @@ static void
handleExtensions(XEvent *event)
{
#ifdef SHAPE
if (event->type == (ShapeEventBase+ShapeNotify)) {
if (wShapeSupported && event->type == (wShapeEventBase+ShapeNotify)) {
handleShapeNotify(event);
}
#endif
@@ -1012,9 +887,88 @@ handleClientMessage(XEvent *event)
}
}
}
#ifdef XDE_DND
} else if (event->xclient.message_type==_XA_XDE_DATA_AVAILABLE) {
GdkEvent gdkev;
WScreen *scr = wScreenForWindow(event->xclient.window);
Atom tmpatom;
int datalenght;
long tmplong;
char * tmpstr, * runstr, * freestr, * tofreestr;
printf("x\n");
gdkev.dropdataavailable.u.allflags = event->xclient.data.l[1];
gdkev.dropdataavailable.timestamp = event->xclient.data.l[4];
if(gdkev.dropdataavailable.u.flags.isdrop){
gdkev.dropdataavailable.type = GDK_DROP_DATA_AVAIL;
gdkev.dropdataavailable.requestor = event->xclient.data.l[0];
XGetWindowProperty(dpy,gdkev.dropdataavailable.requestor,
event->xclient.data.l[2],
0, LONG_MAX -1,
0, XA_PRIMARY, &tmpatom,
&datalenght,
&gdkev.dropdataavailable.data_numbytes,
&tmplong,
&tmpstr);
datalenght=gdkev.dropdataavailable.data_numbytes-1;
tofreestr=tmpstr;
runstr=NULL;
for(;datalenght>0;datalenght-=(strlen(tmpstr)+1),tmpstr=&tmpstr[strlen(tmpstr)+1]){
freestr=runstr;runstr=wstrappend(runstr,tmpstr);free(freestr);
freestr=runstr;runstr=wstrappend(runstr," ");free(freestr);
}
free(tofreestr);
scr->xdestring=runstr;
/* no need to redirect ? */
wDockReceiveDNDDrop(scr,event);
free(runstr);
scr->xdestring=NULL;
}
} else if (event->xclient.message_type==_XA_XDE_LEAVE) {
printf("leave\n");
} else if (event->xclient.message_type==_XA_XDE_ENTER) {
GdkEvent gdkev;
XEvent replyev;
gdkev.dropenter.u.allflags=event->xclient.data.l[1];
printf("from win %x\n",event->xclient.data.l[0]);
printf("to win %x\n",event->xclient.window);
printf("enter %x\n",event->xclient.data.l[1]);
printf("v %x ",event->xclient.data.l[2]);
printf("%x ",event->xclient.data.l[3]);
printf("%x\n",event->xclient.data.l[4]);
if(event->xclient.data.l[2]==_XDE_FILETYPE ||
event->xclient.data.l[3]==_XDE_FILETYPE ||
event->xclient.data.l[4]==_XDE_FILETYPE ||
event->xclient.data.l[2]==_XDE_URLTYPE ||
event->xclient.data.l[3]==_XDE_URLTYPE ||
event->xclient.data.l[4]==_XDE_URLTYPE)
if(gdkev.dropenter.u.flags.sendreply){
/*reply*/
replyev.xclient.type = ClientMessage;
replyev.xclient.window = event->xclient.data.l[0];
replyev.xclient.format = 32;
replyev.xclient.message_type = _XA_XDE_REQUEST;
replyev.xclient.data.l[0] = event->xclient.window;
gdkev.dragrequest.u.allflags = 0;
gdkev.dragrequest.u.flags.protocol_version = 0;
gdkev.dragrequest.u.flags.willaccept = 1;
gdkev.dragrequest.u.flags.delete_data = 0;
replyev.xclient.data.l[1] = gdkev.dragrequest.u.allflags;
replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
replyev.xclient.data.l[4] = event->xclient.data.l[2];
XSendEvent(dpy, replyev.xclient.window, 0, NoEventMask, &replyev);
XSync(dpy, 0);
}
#endif /* XDE_DND */
#ifdef OFFIX_DND
} else if (event->xclient.message_type==_XA_DND_PROTOCOL) {
if (wDockReceiveDNDDrop(wScreenForWindow(event->xclient.window),event))
WScreen *scr = wScreenForWindow(event->xclient.window);
if (scr && wDockReceiveDNDDrop(scr,event))
goto redirect_message;
#endif /* OFFIX_DND */
} else {
@@ -1197,16 +1151,39 @@ handleShapeNotify(XEvent *event)
{
XShapeEvent *shev = (XShapeEvent*)event;
WWindow *wwin;
puts("got shape notify");
XEvent ev;
#ifdef DEBUG
puts("got shape notify");
#endif
wwin = wWindowFor(event->xany.window);
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
XShapeEvent *sev = (XShapeEvent*)&ev;
if (sev->kind == ShapeBounding) {
if (sev->shaped == shev->shaped) {
*shev = *sev;
} else {
XPutBackEvent(dpy, &ev);
break;
}
}
}
wwin = wWindowFor(shev->window);
if (!wwin || shev->kind != ShapeBounding)
return;
wwin->flags.shaped = shev->shaped;
wWindowSetShape(wwin);
if (!shev->shaped && wwin->flags.shaped) {
wwin->flags.shaped = 0;
wWindowClearShape(wwin);
} else if (shev->shaped) {
wwin->flags.shaped = 1;
wWindowSetShape(wwin);
}
}
#endif /* SHAPE */
@@ -1263,15 +1240,14 @@ handleFocusIn(XEvent *event)
{
WWindow *wwin;
if (event->xfocus.mode == NotifyUngrab) {
return;
}
/*
* For applications that like stealing the focus.
*/
while (XCheckTypedEvent(dpy, FocusIn, event));
saveTimestamp(event);
if (event->xfocus.mode == NotifyUngrab) {
if (event->xfocus.mode == NotifyUngrab
|| event->xfocus.mode == NotifyGrab
|| event->xfocus.detail > NotifyNonlinearVirtual) {
return;
}
@@ -1282,7 +1258,9 @@ handleFocusIn(XEvent *event)
else
wSetFocusTo(wwin->screen_ptr, NULL);
} else if (!wwin) {
wSetFocusTo(wScreenForWindow(event->xfocus.window), NULL);
WScreen *scr = wScreenForWindow(event->xfocus.window);
if (scr)
wSetFocusTo(scr, NULL);
}
}
@@ -1366,7 +1344,7 @@ handleKeyPress(XEvent *event)
CloseWindowMenu(scr);
if (wwin->protocols.MINIATURIZE_WINDOW)
wClientSendProtocol(wwin, _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW,
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
event->xbutton.time);
else {
if (!wwin->window_flags.no_miniaturizable)
@@ -1469,36 +1447,30 @@ handleKeyPress(XEvent *event)
wRaiseFrame(wwin->frame->core);
}
break;
case WKBD_WORKSPACE1:
wWorkspaceChange(scr, 0);
break;
case WKBD_WORKSPACE2:
wWorkspaceChange(scr, 1);
break;
case WKBD_WORKSPACE3:
wWorkspaceChange(scr, 2);
break;
case WKBD_WORKSPACE4:
wWorkspaceChange(scr, 3);
break;
case WKBD_WORKSPACE5:
wWorkspaceChange(scr, 4);
break;
case WKBD_WORKSPACE6:
wWorkspaceChange(scr, 5);
break;
case WKBD_WORKSPACE7:
wWorkspaceChange(scr, 6);
break;
case WKBD_WORKSPACE8:
wWorkspaceChange(scr, 7);
break;
case WKBD_WORKSPACE9:
wWorkspaceChange(scr, 8);
break;
case WKBD_WORKSPACE10:
wWorkspaceChange(scr, 9);
break;
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
#define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
i = (scr->current_workspace/10)*10 + wk - 1;\
if (wPreferences.ws_advance || i<scr->workspace_count)\
wWorkspaceChange(scr, i);\
break
#else
#define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
i = (scr->current_workspace/10)*10 + wk - 1;\
if (wPreferences.ws_advance || i<scr->workspace_count)\
wWorkspaceChange(scr, i);\
break
#endif
GOTOWORKS(1);
GOTOWORKS(2);
GOTOWORKS(3);
GOTOWORKS(4);
GOTOWORKS(5);
GOTOWORKS(6);
GOTOWORKS(7);
GOTOWORKS(8);
GOTOWORKS(9);
GOTOWORKS(10);
#undef GOTOWORKS
case WKBD_NEXTWORKSPACE:
if (scr->current_workspace < scr->workspace_count-1)
wWorkspaceChange(scr, scr->current_workspace+1);
+119 -92
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -523,7 +523,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
if (!img) {
wwarning(_("could not render gradient: %s"), RErrorString);
wwarning(_("could not render gradient: %s"), RMessageForError(RErrorCode));
return;
}
@@ -539,7 +539,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
if (limg) {
RBevelImage(limg, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, limg, lbutton)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
x += limg->width;
w -= limg->width;
@@ -554,7 +554,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
if (rimg) {
RBevelImage(rimg, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, rimg, rbutton)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
w -= rimg->width;
RDestroyImage(rimg);
@@ -565,21 +565,21 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
RBevelImage(mimg, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, mimg, title)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(mimg);
} else {
RBevelImage(img, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, img, title)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
}
} else {
RBevelImage(img, RBEV_RAISED2);
if (!RConvertImage(scr->rcontext, img, title)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
}
@@ -587,6 +587,98 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
static void
updateTexture(WFrameWindow *fwin)
{
int i;
unsigned long pixel;
i = fwin->flags.state;
if (fwin->titlebar) {
if (fwin->title_texture[i]->any.type!=WTEX_SOLID) {
XSetWindowBackgroundPixmap(dpy, fwin->titlebar->window,
fwin->title_back[i]);
if (wPreferences.new_style) {
if (fwin->left_button && fwin->lbutton_back[i])
XSetWindowBackgroundPixmap(dpy, fwin->left_button->window,
fwin->lbutton_back[i]);
if (fwin->right_button && fwin->rbutton_back[i])
XSetWindowBackgroundPixmap(dpy, fwin->right_button->window,
fwin->rbutton_back[i]);
}
} else {
pixel = fwin->title_texture[i]->solid.normal.pixel;
XSetWindowBackground(dpy, fwin->titlebar->window, pixel);
if (wPreferences.new_style) {
if (fwin->left_button)
XSetWindowBackground(dpy, fwin->left_button->window,
pixel);
if (fwin->right_button)
XSetWindowBackground(dpy, fwin->right_button->window,
pixel);
}
}
XClearWindow(dpy, fwin->titlebar->window);
if (fwin->left_button) {
XClearWindow(dpy, fwin->left_button->window);
handleButtonExpose(&fwin->left_button->descriptor, NULL);
}
if (fwin->right_button) {
XClearWindow(dpy, fwin->right_button->window);
handleButtonExpose(&fwin->right_button->descriptor, NULL);
}
}
if (fwin->resizebar) {
XSetWindowBackground(dpy, fwin->resizebar->window,
fwin->resizebar_texture[0]->solid.normal.pixel);
XClearWindow(dpy, fwin->resizebar->window);
}
}
static void
remakeTexture(WFrameWindow *fwin, int state)
{
Pixmap pmap, lpmap, rpmap;
if (fwin->title_texture[state] && fwin->titlebar) {
FREE_PIXMAP(fwin->title_back[state]);
if (wPreferences.new_style) {
FREE_PIXMAP(fwin->lbutton_back[state]);
FREE_PIXMAP(fwin->rbutton_back[state]);
}
if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
int left, right;
int width;
/* eventually surrounded by if new_style */
left = fwin->left_button && !fwin->flags.hide_left_button
&& !fwin->flags.lbutton_dont_fit;
right = fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit;
width = fwin->core->width+1;
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
width, fwin->titlebar->height,
fwin->titlebar->height, fwin->titlebar->height,
left, right, &pmap, &lpmap, &rpmap);
fwin->title_back[state] = pmap;
if (wPreferences.new_style) {
fwin->lbutton_back[state] = lpmap;
fwin->rbutton_back[state] = rpmap;
}
}
}
}
void
wFrameWindowPaint(WFrameWindow *fwin)
{
@@ -596,103 +688,36 @@ wFrameWindowPaint(WFrameWindow *fwin)
if (fwin->flags.need_texture_remake) {
int i;
Pixmap pmap, lpmap, rpmap;
fwin->flags.need_texture_remake = 0;
fwin->flags.need_texture_change = 0;
for (i=0; i < (fwin->flags.single_texture ? 1 : 3); i++) {
if (fwin->title_texture[i] && fwin->titlebar) {
FREE_PIXMAP(fwin->title_back[i]);
if (wPreferences.new_style) {
FREE_PIXMAP(fwin->lbutton_back[i]);
FREE_PIXMAP(fwin->rbutton_back[i]);
}
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);
if (fwin->title_texture[i]->any.type!=WTEX_SOLID) {
int left, right;
int width;
/* eventually surrounded by if new_style */
left = fwin->left_button && !fwin->flags.hide_left_button
&& !fwin->flags.lbutton_dont_fit;
right = fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit;
width = fwin->core->width+1;
renderTexture(fwin->screen_ptr, fwin->title_texture[i],
width, fwin->titlebar->height,
fwin->titlebar->height, fwin->titlebar->height,
left, right, &pmap, &lpmap, &rpmap);
fwin->title_back[i] = pmap;
if (wPreferences.new_style) {
fwin->lbutton_back[i] = lpmap;
fwin->rbutton_back[i] = rpmap;
}
}
for (i=0; i < 3; i++) {
if (i!=fwin->flags.state)
remakeTexture(fwin, i);
}
}
fwin->flags.need_texture_change = 1;
}
if (fwin->flags.need_texture_change) {
int i;
unsigned long pixel;
if (fwin->flags.need_texture_change) {
fwin->flags.need_texture_change = 0;
i = fwin->flags.state;
if (fwin->titlebar) {
if (fwin->title_texture[i]->any.type!=WTEX_SOLID) {
XSetWindowBackgroundPixmap(dpy, fwin->titlebar->window,
fwin->title_back[i]);
if (wPreferences.new_style) {
if (fwin->left_button && fwin->lbutton_back[i])
XSetWindowBackgroundPixmap(dpy,
fwin->left_button->window,
fwin->lbutton_back[i]);
if (fwin->right_button && fwin->rbutton_back[i])
XSetWindowBackgroundPixmap(dpy,
fwin->right_button->window,
fwin->rbutton_back[i]);
}
} else {
pixel = fwin->title_texture[i]->solid.normal.pixel;
XSetWindowBackground(dpy, fwin->titlebar->window, pixel);
if (wPreferences.new_style) {
if (fwin->left_button)
XSetWindowBackground(dpy, fwin->left_button->window,
pixel);
if (fwin->right_button)
XSetWindowBackground(dpy, fwin->right_button->window,
pixel);
}
}
XClearWindow(dpy, fwin->titlebar->window);
if (fwin->left_button) {
XClearWindow(dpy, fwin->left_button->window);
handleButtonExpose(&fwin->left_button->descriptor, NULL);
}
if (fwin->right_button) {
XClearWindow(dpy, fwin->right_button->window);
handleButtonExpose(&fwin->right_button->descriptor, NULL);
}
}
if (fwin->resizebar) {
XSetWindowBackground(dpy, fwin->resizebar->window,
fwin->resizebar_texture[0]->solid.normal.pixel);
XClearWindow(dpy, fwin->resizebar->window);
}
updateTexture(fwin);
}
if (fwin->titlebar && !fwin->flags.repaint_only_resizebar
&& fwin->title_texture[fwin->flags.state]->any.type==WTEX_SOLID) {
wDrawBevel(fwin->titlebar,
wDrawBevel(fwin->titlebar->window, fwin->titlebar->width,
fwin->titlebar->height,
(WTexSolid*)fwin->title_texture[fwin->flags.state],
WREL_RAISED);
}
@@ -1011,10 +1036,12 @@ paintButton(WCoreWindow *button, WTexture *texture, unsigned long color,
if (wPreferences.new_style) {
if (texture->any.type==WTEX_SOLID || pushed) {
wDrawBevel(button, (WTexSolid*)texture, WREL_RAISED);
wDrawBevel(button->window, button->width, button->height,
(WTexSolid*)texture, WREL_RAISED);
}
} else {
wDrawBevel(button, scr->widget_texture, WREL_RAISED);
wDrawBevel(button->window, button->width, button->height,
scr->widget_texture, WREL_RAISED);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+5 -13
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -31,7 +31,8 @@ typedef void (WCallBack)(void *cdata);
typedef void (WDeathHandler)(pid_t pid, unsigned int status, void *cdata);
typedef void* WMagicNumber;
typedef void* WDeathHandlerID;
void RestoreDesktop(WScreen *scr);
@@ -61,14 +62,7 @@ void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
void UpdateSwitchMenuWorkspace(WScreen *scr, int workspace);
WMagicNumber wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata);
WMagicNumber wAddWindowSavedState(char *instance, char *class, char *command,
pid_t pid, WSavedState *state);
WMagicNumber wGetWindowSavedState(Window win);
void wDeleteWindowSavedState(WMagicNumber id);
WDeathHandlerID wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata);
void wColormapInstallForWindow(WScreen *scr, WWindow *wwin);
@@ -117,15 +111,13 @@ char *GetShortcutString(char *text);
void wHackedGrabKey(int keycode, unsigned int modifiers,
Window grab_window, Bool owner_events, int pointer_mode,
int keyboard_mode);
#endif
void wHackedGrabButton(unsigned int button, unsigned int modifiers,
Window grab_window, Bool owner_events,
unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, Cursor cursor);
void wHackedUngrabButton(unsigned int button, unsigned int modifiers,
Window grab_window);
#endif
/* this function is in dock.c */
void ParseCommand(char *command, char ***argv, int *argc);
+112 -21
View File
@@ -1,6 +1,6 @@
/* icon.c - window icon and dock and appicon parent
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -27,8 +27,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <wraster.h>
#include <sys/stat.h>
#include "WindowMaker.h"
#include "wcore.h"
@@ -177,7 +179,7 @@ wIconCreateWithIconFile(WScreen *scr, char *iconfile, int tile)
if (iconfile) {
icon->image = RLoadImage(scr->rcontext, iconfile, 0);
if (!icon->image) {
wwarning(_("error loading image file \"%s\""), iconfile, RErrorString);
wwarning(_("error loading image file \"%s\""), iconfile, RMessageForError(RErrorCode));
}
icon->image = wIconValidateIconSize(scr, icon->image);
@@ -291,7 +293,7 @@ makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
}
if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(tile);
@@ -389,6 +391,106 @@ wIconChangeImageFile(WIcon *icon, char *file)
return !error;
}
static char*
getnameforicon(WWindow *wwin)
{
char *prefix, *suffix;
char *path;
int len;
if (wwin->wm_class && wwin->wm_instance) {
suffix = wmalloc(strlen(wwin->wm_class)+strlen(wwin->wm_instance)+2);
sprintf(suffix, "%s.%s", wwin->wm_instance, wwin->wm_class);
} else if (wwin->wm_class) {
suffix = wmalloc(strlen(wwin->wm_class)+1);
strcpy(suffix, wwin->wm_class);
} else {
suffix = wmalloc(strlen(wwin->wm_instance)+1);
strcpy(suffix, wwin->wm_instance);
}
prefix = getenv("GNUSTEP_USER_PATH");
if (!prefix) {
len = strlen(wgethomedir())+64+strlen(suffix);
path = wmalloc(len+1);
sprintf(path, "%s/GNUstep/.AppInfo", wgethomedir());
} else {
prefix = wexpandpath(prefix);
len = strlen(prefix)+64+strlen(suffix);
path = wmalloc(len+1);
sprintf(path, "%s/.AppInfo", prefix);
free(prefix);
}
if (access(path, F_OK)!=0) {
if (mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR)) {
wsyserror(_("could not create directory %s"), path);
free(path);
free(suffix);
return NULL;
}
}
strcat(path, "/WindowMaker");
if (access(path, F_OK)!=0) {
if (mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR)!=0) {
wsyserror(_("could not create directory %s"), path);
free(path);
free(suffix);
return NULL;
}
}
strcat(path, "/");
strcat(path, suffix);
strcat(path, ".xpm");
free(suffix);
return path;
}
/*
* wIconStore--
* Stores the client supplied icon at ~/GNUstep/.AppInfo/WindowMaker
* and returns the path for that icon. Returns NULL if there is no
* client supplied icon or on failure.
*
* Side effects:
* New directories might be created.
*/
char*
wIconStore(WIcon *icon)
{
char *path;
RImage *image;
WWindow *wwin = icon->owner;
if (!wwin || !wwin->wm_hints || !(wwin->wm_hints->flags & IconPixmapHint)
|| wwin->wm_hints->icon_pixmap == None)
return NULL;
path = getnameforicon(wwin);
image = RCreateImageFromDrawable(icon->core->screen_ptr->rcontext,
wwin->wm_hints->icon_pixmap,
(wwin->wm_hints->flags & IconMaskHint)
? wwin->wm_hints->icon_mask : None);
if (!image) {
free(path);
return NULL;
}
if (!RSaveImage(image, path, "XPM")) {
free(path);
path = NULL;
}
RDestroyImage(image);
return path;
}
/*
void
wIconChangeIconWindow(WIcon *icon, Window new_window);
@@ -399,17 +501,14 @@ cycleColor(void *data)
{
WIcon *icon = (WIcon*)data;
WScreen *scr = icon->core->screen_ptr;
XGCValues gcv;
icon->step--;
gcv.dash_offset = icon->step;
XChangeGC(dpy, scr->icon_select_gc, GCDashOffset, &gcv);
icon->step = !icon->step;
if (icon->step) {
XSetForeground(dpy, scr->icon_select_gc, scr->white_pixel);
XSetBackground(dpy, scr->icon_select_gc, scr->black_pixel);
} else {
XSetForeground(dpy, scr->icon_select_gc, scr->black_pixel);
XSetBackground(dpy, scr->icon_select_gc, scr->white_pixel);
}
XDrawRectangle(dpy, icon->core->window, scr->icon_select_gc, 0, 0,
icon->core->width-1, icon->core->height-1);
icon->core->width-1, icon->core->height-1);
icon->handlerID = WMAddTimerHandler(COLOR_CYCLE_DELAY, cycleColor, icon);
}
@@ -517,17 +616,9 @@ wIconUpdate(WIcon *icon)
if (XGetWindowAttributes(dpy, icon->icon_win, &attr)) {
if (attr.all_event_masks & ButtonPressMask) {
XGrabButton(dpy, Button1, MOD_MASK, icon->core->window, True,
ButtonPressMask, GrabModeSync, GrabModeAsync, None,
wCursor[WCUR_ARROW]);
XGrabButton(dpy, Button1, MOD_MASK|LockMask, icon->core->window,
True, ButtonPressMask, GrabModeSync, GrabModeAsync,
None, wCursor[WCUR_ARROW]);
#ifdef NUMLOCK_HACK
wHackedGrabButton(Button1, MOD_MASK, icon->core->window, True,
ButtonPressMask, GrabModeSync, GrabModeAsync,
None, wCursor[WCUR_ARROW]);
#endif
}
}
} else if (wwin && wwin->wm_hints
@@ -615,7 +706,7 @@ wIconUpdate(WIcon *icon)
image = RLoadImage(scr->rcontext, path, 0);
if (!image) {
wwarning(_("could not load default icon \"%s\":%s"),
file, RErrorString);
file, RMessageForError(RErrorCode));
}
free(path);
}
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -41,14 +41,13 @@ typedef struct WIcon {
char *file; /* the file with the icon image */
RImage *image;
short tile_type;
unsigned int tile_type:4;
unsigned int show_title:1;
unsigned int has_titlebar:1;
unsigned int force_paint:1; /* True for icon update and repaint */
unsigned int selected:1;
unsigned int step:1;
unsigned int step:3; /* selection cycle step */
unsigned int shadowed:1; /* If the icon is to be blured */
unsigned int mapped:1;
unsigned int highlighted:1;
@@ -71,4 +70,6 @@ void wIconSelect(WIcon *icon);
RImage *wIconValidateIconSize(WScreen *scr, RImage *icon);
char *wIconStore(WIcon *icon);
#endif /* WMICON_H_ */
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+1 -1
View File
@@ -131,7 +131,7 @@ list_remove_head(LinkedList** list)
* The difference is that above function do a copying of the structure
* unlike the below that only changes where list points.
* This makes the above function twice slower, because it copies the
* whole structure, which contains 2 pointers. -Dan
* whole structure, which contains 2 pointers. -Dan.
*
* I don't know. I just copied this file from the gcc distribution
* (I liked the API). One could think that the above function would
+42 -19
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -96,7 +96,7 @@ Atom _XA_WM_CLIENT_LEADER;
Atom _XA_WM_COLORMAP_WINDOWS;
Atom _XA_GNUSTEP_WM_ATTR;
Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
Atom _XA_GNUSTEP_WM_RESIZEBAR;
#ifdef MWM_HINTS
@@ -114,6 +114,14 @@ Atom _XA_WINDOWMAKER_WM_FUNCTION;
Atom _XA_DND_PROTOCOL;
Atom _XA_DND_SELECTION;
#endif
#ifdef XDE_DND
Atom _XA_XDE_REQUEST;
Atom _XA_XDE_ENTER;
Atom _XA_XDE_LEAVE;
Atom _XA_XDE_DATA_AVAILABLE;
Atom _XDE_FILETYPE;
Atom _XDE_URLTYPE;
#endif
/* cursors */
@@ -125,13 +133,13 @@ Time LastTimestamp;
Time LastFocusChange;
#ifdef SHAPE
int ShapeEventBase;
Bool wShapeSupported;
int wShapeEventBase;
#endif
/* special flags */
char WRestartASAP = 0;
char WExitASAP = 0;
char WProgramState = WSTATE_NORMAL;
char WDelayedActionSet = 0;
/* temporary stuff */
@@ -174,6 +182,7 @@ Restart(char *manager)
/* fallback */
execv(Arguments[0], Arguments);
}
wsyserror(_("could not exec window manager"));
wfatal(_("Restart failed!!!"));
exit(-1);
}
@@ -186,16 +195,19 @@ SetupEnvironment(WScreen *scr)
char *tmp, *ptr;
char buf[16];
if (wScreenCount == 1)
return;
tmp = wmalloc(strlen(DisplayName)+64);
sprintf(tmp, "DISPLAY=%s", XDisplayName(DisplayName));
ptr = strchr(strchr(DisplayName, ':'), '.');
if (ptr)
*ptr = 0;
sprintf(buf, ".%i", scr->screen);
strcat(tmp, buf);
if (wScreenCount > 1) {
tmp = wmalloc(strlen(DisplayName)+64);
sprintf(tmp, "DISPLAY=%s", XDisplayName(DisplayName));
ptr = strchr(strchr(tmp, ':'), '.');
if (ptr)
*ptr = 0;
sprintf(buf, ".%i", scr->screen);
strcat(tmp, buf);
putenv(tmp);
}
tmp = wmalloc(60);
sprintf(tmp, "WRASTER_COLOR_RESOLUTION%i=%i", scr->screen,
scr->rcontext->attribs->colors_per_channel);
putenv(tmp);
}
@@ -253,8 +265,9 @@ check_defaults()
path = wdefaultspathfordomain("");
if (access(path, R_OK)!=0) {
wfatal(_("could not find user GNUstep directory.\n"
"Make sure you have installed WindowMaker correctly and run wmaker.inst"));
wfatal(_("could not find user GNUstep directory (%s).\n"
"Make sure you have installed Window Maker correctly and run wmaker.inst"),
path);
exit(1);
}
@@ -342,7 +355,7 @@ main(int argc, char **argv)
} else if (strcmp(argv[i], "-noclip")==0) {
wPreferences.flags.noclip=1;
} else if (strcmp(argv[i], "-version")==0) {
printf("WindowMaker %s\n", VERSION);
printf("Window Maker %s\n", VERSION);
exit(0);
} else if (strcmp(argv[i], "-global_defaults_path")==0) {
printf("%s/Defaults/WindowMaker", PKGDATADIR);
@@ -367,7 +380,7 @@ main(int argc, char **argv)
wwarning(_("too few arguments for %s"), argv[i-1]);
exit(0);
}
if (sscanf(argv[i], "%d", &wVisualID)!=1) {
if (sscanf(argv[i], "%i", &wVisualID)!=1) {
wwarning(_("bad value for visualid: \"%s\""), argv[i]);
exit(0);
}
@@ -415,6 +428,16 @@ main(int argc, char **argv)
wwarning(_("cannot set locale modifiers"));
}
#endif
if (Locale) {
char *ptr;
Locale = wstrdup(Locale);
ptr = strchr(Locale, '.');
if (ptr)
*ptr = 0;
}
/* open display */
dpy = XOpenDisplay(DisplayName);
+7 -6
View File
@@ -1,6 +1,6 @@
/* menu.c- generic menu, used for root menu, application menus etc.
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -51,8 +51,8 @@ extern WPreferences wPreferences;
#define MOD_MASK wPreferences.modifier_mask
#define MENU_SCROLL_STEP menuScrollParameters[wPreferences.menu_scroll_speed].steps
#define MENU_SCROLL_DELAY menuScrollParameters[wPreferences.menu_scroll_speed].delay
#define MENU_SCROLL_STEP menuScrollParameters[(int)wPreferences.menu_scroll_speed].steps
#define MENU_SCROLL_DELAY menuScrollParameters[(int)wPreferences.menu_scroll_speed].delay
@@ -858,7 +858,8 @@ keyboardMenu(WMenu *menu)
while (!done) {
XAllowEvents(dpy, AsyncKeyboard, CurrentTime);
WMMaskEvent(dpy, ExposureMask|ButtonMotionMask|ButtonPressMask
|ButtonReleaseMask|KeyPressMask|KeyReleaseMask, &event);
|ButtonReleaseMask|KeyPressMask|KeyReleaseMask
|SubstructureNotifyMask, &event);
switch (event.type) {
case KeyPress:
@@ -1750,7 +1751,7 @@ menuExpose(WObjDescriptor *desc, XEvent *event)
typedef struct {
int *delayed_select;
WMenu *menu;
WMagicNumber magic;
WMHandlerID magic;
} delay_data;
@@ -1853,7 +1854,7 @@ menuMouseDown(WObjDescriptor *desc, XEvent *event)
}
while (!done) {
int x, y;
int x, y;
WMMaskEvent(dpy, ExposureMask|ButtonMotionMask|ButtonReleaseMask
|ButtonPressMask, &ev);
switch (ev.type) {
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -97,6 +97,7 @@ typedef struct WMenu {
unsigned int brother:1; /* if this is a copy of the menu*/
unsigned int editing:1;
unsigned int jump_back_pending:1;
} flags;
} WMenu;
+51 -30
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <pwd.h>
#include <math.h>
#include <time.h>
#include <wraster.h>
@@ -411,8 +412,10 @@ eatExpose()
void
SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
{
time_t time0 = time(NULL);
float dx, dy, x=from_x, y=from_y, sx, sy, px, py;
int dx_is_bigger=0;
/* animation parameters */
static struct {
int delay;
@@ -437,18 +440,18 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
}
if (dx_is_bigger) {
px = dx / apars[wPreferences.icon_slide_speed].slowdown;
if (px < apars[wPreferences.icon_slide_speed].steps && px > 0)
px = apars[wPreferences.icon_slide_speed].steps;
else if (px > -apars[wPreferences.icon_slide_speed].steps && px < 0)
px = -apars[wPreferences.icon_slide_speed].steps;
px = dx / apars[(int)wPreferences.icon_slide_speed].slowdown;
if (px < apars[(int)wPreferences.icon_slide_speed].steps && px > 0)
px = apars[(int)wPreferences.icon_slide_speed].steps;
else if (px > -apars[(int)wPreferences.icon_slide_speed].steps && px < 0)
px = -apars[(int)wPreferences.icon_slide_speed].steps;
py = (sx == 0 ? 0 : px*dy/dx);
} else {
py = dy / apars[wPreferences.icon_slide_speed].slowdown;
if (py < apars[wPreferences.icon_slide_speed].steps && py > 0)
py = apars[wPreferences.icon_slide_speed].steps;
else if (py > -apars[wPreferences.icon_slide_speed].steps && py < 0)
py = -apars[wPreferences.icon_slide_speed].steps;
py = dy / apars[(int)wPreferences.icon_slide_speed].slowdown;
if (py < apars[(int)wPreferences.icon_slide_speed].steps && py > 0)
py = apars[(int)wPreferences.icon_slide_speed].steps;
else if (py > -apars[(int)wPreferences.icon_slide_speed].steps && py < 0)
py = -apars[(int)wPreferences.icon_slide_speed].steps;
px = (sy == 0 ? 0 : py*dx/dy);
}
@@ -461,26 +464,28 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
y = (float)to_y;
if (dx_is_bigger) {
px = px * (1.0 - 1/(float)apars[wPreferences.icon_slide_speed].slowdown);
if (px < apars[wPreferences.icon_slide_speed].steps && px > 0)
px = apars[wPreferences.icon_slide_speed].steps;
else if (px > -apars[wPreferences.icon_slide_speed].steps && px < 0)
px = -apars[wPreferences.icon_slide_speed].steps;
px = px * (1.0 - 1/(float)apars[(int)wPreferences.icon_slide_speed].slowdown);
if (px < apars[(int)wPreferences.icon_slide_speed].steps && px > 0)
px = apars[(int)wPreferences.icon_slide_speed].steps;
else if (px > -apars[(int)wPreferences.icon_slide_speed].steps && px < 0)
px = -apars[(int)wPreferences.icon_slide_speed].steps;
py = (sx == 0 ? 0 : px*dy/dx);
} else {
py = py * (1.0 - 1/(float)apars[wPreferences.icon_slide_speed].slowdown);
if (py < apars[wPreferences.icon_slide_speed].steps && py > 0)
py = apars[wPreferences.icon_slide_speed].steps;
else if (py > -apars[wPreferences.icon_slide_speed].steps && py < 0)
py = -apars[wPreferences.icon_slide_speed].steps;
py = py * (1.0 - 1/(float)apars[(int)wPreferences.icon_slide_speed].slowdown);
if (py < apars[(int)wPreferences.icon_slide_speed].steps && py > 0)
py = apars[(int)wPreferences.icon_slide_speed].steps;
else if (py > -apars[(int)wPreferences.icon_slide_speed].steps && py < 0)
py = -apars[(int)wPreferences.icon_slide_speed].steps;
px = (sy == 0 ? 0 : py*dx/dy);
}
XMoveWindow(dpy, win, (int)x, (int)y);
XFlush(dpy);
if (apars[wPreferences.icon_slide_speed].delay > 0) {
wusleep(apars[wPreferences.icon_slide_speed].delay*1000L);
if (apars[(int)wPreferences.icon_slide_speed].delay > 0) {
wusleep(apars[(int)wPreferences.icon_slide_speed].delay*1000L);
}
if (time(NULL) - time0 > MAX_ANIMATION_TIME)
break;
}
XMoveWindow(dpy, win, to_x, to_y);
@@ -723,16 +728,25 @@ ParseCommand(char *command, char ***argv, int *argc)
*argc = count;
}
#if 0
static void
timeup(void *foo)
{
*(int*)foo=1;
}
#endif
static char*
getselection(WScreen *scr)
{
char *tmp;
extern char *W_GetTextSelection(); /* in WINGs */
tmp = W_GetTextSelection(scr->wmscreen, XA_PRIMARY);
if (!tmp)
tmp = W_GetTextSelection(scr->wmscreen, XA_CUT_BUFFER0);
return tmp;
#if 0
XEvent event;
int timeover=0;
WMHandlerID *id;
@@ -758,6 +772,7 @@ getselection(WScreen *scr)
}
wwarning(_("selection timed-out"));
return NULL;
#endif
}
@@ -806,6 +821,11 @@ get_dnd_selection(WScreen *scr)
char *flat_string;
int count;
#ifdef XDE_DND
if(scr->xdestring) {
return (wstrdup(scr->xdestring));
}
#endif
result=XGetTextProperty(dpy, scr->root_win, &text_ret, _XA_DND_SELECTION);
if (result==0 || text_ret.value==NULL || text_ret.encoding==None
@@ -947,6 +967,10 @@ ExpandOptions(WScreen *scr, char *cmdline)
out = nout;
strcat(out,user_input);
optr+=slen;
} else {
/* Not an error, but user has Canceled the dialog box.
* This will make the command to not be performed. */
goto error;
}
break;
@@ -974,13 +998,10 @@ ExpandOptions(WScreen *scr, char *cmdline)
case 's':
if (!selection) {
if (!XGetSelectionOwner(dpy, XA_PRIMARY)) {
wwarning(_("selection not available"));
goto error;
}
selection = getselection(scr);
}
if (!selection) {
wwarning(_("selection not available"));
goto error;
}
slen = strlen(selection);
@@ -1157,7 +1178,7 @@ GetShortcutString(char *text)
buffer = wstrappend(buffer, "^");
}
buffer = wstrappend(buffer, text);
/* get key */
/* ksym = XStringToKeysym(text);
tmp = keysymToString(ksym, modmask);
+1 -1
View File
@@ -1,7 +1,7 @@
/* motif.h-- stuff for support for mwm hints
* ripped from E.h (enlightenment)
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+15 -5
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -70,10 +70,10 @@ wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
{
#ifdef I18N_MB
*width = XmbTextEscapement(scr->info_text_font->font, "-8888 x -8888", 13);
*height = (3 * scr->info_text_font->height) / 2;
*height = (7 * scr->info_text_font->height) / 4 - 1;
#else
*width = XTextWidth(scr->info_text_font->font, "-8888 x -8888", 13);
*height = (3 * scr->info_text_font->font->ascent) / 2;
*height = (7 * scr->info_text_font->font->ascent) / 4 - 1;
#endif
}
@@ -132,7 +132,9 @@ showPosition(WWindow *wwin, int x, int y)
scr->scr_height);
#endif
} else {
XClearWindow(dpy, scr->geometry_display);
XClearArea(dpy, scr->geometry_display, 1, 1,
scr->geometry_display_width-2, scr->geometry_display_height-2,
False);
sprintf(num, "%+i %-+i", x, y);
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
@@ -143,6 +145,9 @@ showPosition(WWindow *wwin, int x, int y)
(scr->geometry_display_width - 2 - fw) / 2,
(scr->geometry_display_height-fh)/2 + scr->info_text_font->y,
num, strlen(num));
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
scr->geometry_display_height+1, scr->resizebar_texture[0],
WREL_RAISED);
}
}
@@ -326,7 +331,9 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
wDrawString(root, scr->info_text_font, gc,
mx - fw/2 + 1, y - s + fh/2 + 1, num, strlen(num));
} else {
XClearWindow(dpy, scr->geometry_display);
XClearArea(dpy, scr->geometry_display, 1, 1,
scr->geometry_display_width-2, scr->geometry_display_height-2,
False);
sprintf(num, "%i x %-i", (x2 - x1 - wwin->normal_hints->base_width)
/ wwin->normal_hints->width_inc,
(by - ty - wwin->normal_hints->base_height)
@@ -342,6 +349,9 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
(scr->geometry_display_width-fw)/2,
(scr->geometry_display_height-fh)/2 +scr->info_text_font->y,
num, strlen(num));
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
scr->geometry_display_height+1, scr->resizebar_texture[0],
WREL_RAISED);
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -110,7 +110,7 @@ wPixmapCreateFromXBMData(WScreen *scr, char *data, char *mask,
}
#ifdef unused
WPixmap*
wPixmapCreateFromBitmap(WScreen *scr, Pixmap bitmap, Pixmap mask,
unsigned long fg, unsigned long bg)
@@ -169,7 +169,7 @@ wPixmapCreateFromBitmap(WScreen *scr, Pixmap bitmap, Pixmap mask,
pix->depth = scr->w_depth;
return pix;
}
#endif /* unused */
WPixmap*
wPixmapCreate(WScreen *scr, Pixmap image, Pixmap mask)
+1 -7
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -42,12 +42,6 @@ WPixmap *wPixmapCreateFromXPMData(WScreen *scr, char **data);
WPixmap *wPixmapCreateFromXBMData(WScreen *scr, char *data, char *mask,
int width, int height, unsigned long fg,
unsigned long bg);
WPixmap *wPixmapLoadXBMFile(WScreen *scr, char *path, char *mask_path);
WPixmap *wPixmapCreateFromBitmap(WScreen *scr, Pixmap bitmap, Pixmap mask,
unsigned long fg, unsigned long bg);
void wPixmapDestroy(WPixmap *pix);
#endif
+5 -5
View File
@@ -1,6 +1,6 @@
/* placement.c - window and icon placement on screen
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -325,13 +325,13 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret)
int extra_height;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
else
extra_height = 24; /* random value */
swidth = scr->scr_width;
sx = X_ORIGIN;
if (scr->dock && wPreferences.no_window_under_dock) {
if (scr->dock && !scr->dock->lowered) {
if (scr->dock->on_right_side)
swidth -= wPreferences.icon_size + DOCK_EXTRA_SPACE;
else if (X_ORIGIN < wPreferences.icon_size + DOCK_EXTRA_SPACE)
@@ -459,7 +459,7 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret)
if (wPreferences.window_placement == WPM_CASCADE)
scr->cascade_index++;
if (scr->dock && wPreferences.no_window_under_dock) {
if (scr->dock && !scr->dock->lowered) {
int x2;
x2 = *x_ret + wwin->client.width;
@@ -484,7 +484,7 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret)
if (h<1) h = 1;
*x_ret = rand()%w;
*y_ret = rand()%h;
if (scr->dock && wPreferences.no_window_under_dock) {
if (scr->dock && !scr->dock->lowered) {
int x2;
x2 = *x_ret + wwin->client.width;
+30 -11
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -45,7 +45,7 @@ extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_WM_SAVE_YOURSELF;
extern Atom _XA_GNUSTEP_WM_ATTR;
extern Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
extern Atom _XA_WINDOWMAKER_MENU;
@@ -106,7 +106,7 @@ PropGetProtocols(Window window, WProtocols *prots)
prots->DELETE_WINDOW=1;
else if (protocols[i]==_XA_WM_SAVE_YOURSELF)
prots->SAVE_YOURSELF=1;
else if (protocols[i]==_XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW)
else if (protocols[i]==_XA_GNUSTEP_WM_MINIATURIZE_WINDOW)
prots->MINIATURIZE_WINDOW=1;
}
XFree(protocols);
@@ -121,12 +121,11 @@ PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
unsigned long nitems_ret;
unsigned long bytes_after_ret;
CARD32 *data;
if (XGetWindowProperty(dpy, window, _XA_GNUSTEP_WM_ATTR, 0,
sizeof(GNUstepWMAttributes),
if (XGetWindowProperty(dpy, window, _XA_GNUSTEP_WM_ATTR, 0, 9,
False, _XA_GNUSTEP_WM_ATTR,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data)!=Success)
(unsigned char **)&data)!=Success || !data)
return False;
if (type_ret!=_XA_GNUSTEP_WM_ATTR || !data || fmt_ret!=32)
return False;
@@ -162,12 +161,32 @@ PropGetMotifWMHints(Window window, MWMHints **mwmhints)
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
CARD32 *data;
if (XGetWindowProperty(dpy, window, _XA_MOTIF_WM_HINTS, 0, 20,
if (XGetWindowProperty(dpy, window, _XA_MOTIF_WM_HINTS, 0,
PROP_MWM_HINTS_ELEMENTS,
False, _XA_MOTIF_WM_HINTS,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)mwmhints)!=Success)
(unsigned char **)&data)!=Success)
return 0;
if (type_ret!=_XA_MOTIF_WM_HINTS || fmt_ret!=32
|| nitems_ret!=PROP_MWM_HINTS_ELEMENTS || !data)
return 0;
*mwmhints = malloc(sizeof(MWMHints));
if (!*mwmhints) {
XFree(data);
return 0;
}
(*mwmhints)->flags = data[0];
(*mwmhints)->functions = data[1];
(*mwmhints)->decorations = data[2];
(*mwmhints)->inputMode = data[3];
XFree(data);
if (type_ret==_XA_MOTIF_WM_HINTS)
return 1;
else
@@ -199,8 +218,8 @@ PropGetClientLeader(Window window, Window *leader)
unsigned long bytes_after_ret;
Window *win;
if (XGetWindowProperty(dpy, window, _XA_WM_CLIENT_LEADER, 0,
sizeof(Window), False, AnyPropertyType,
if (XGetWindowProperty(dpy, window, _XA_WM_CLIENT_LEADER, 0, 4,
False, AnyPropertyType,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char**)&win)!=Success)
return 0;
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+2 -2
View File
@@ -4,7 +4,7 @@
* property lists with errors, but will print more descriptive error messages
* and will hopefully not crash.
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
@@ -110,7 +110,7 @@ unescapestr(char *src)
ch = *(++src_ptr);
if((ch>='0') && (ch<='3')) /* assume next 2 chars are octal too */
{
*dest_ptr = ((ch & 07) << 3);
*dest_ptr = ((ch & 07) << 6);
*dest_ptr |= ((*(++src_ptr)&07)<<3);
*dest_ptr |= *(++src_ptr)&07;
}
+1 -1
View File
@@ -1,6 +1,6 @@
/* resources.c - manage X resources (fonts, colors etc)
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+26 -28
View File
@@ -1,6 +1,6 @@
/* rootmenu.c- user defined menu
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -151,29 +151,16 @@ static void
execCommand(WMenu *menu, WMenuEntry *entry)
{
char *cmdline;
#if 0
char *path, *chr;
#endif
cmdline = ExpandOptions(menu->frame->screen_ptr, (char*)entry->clientdata);
#if 0
path = wstrdup(cmdline);
chr = strchr(path, ' ');
if (chr)
*chr = 0;
static char *shell = NULL;
if (access(path, X_OK)!=0) {
path = realloc(path, strlen(cmdline)+128);
sprintf(path, _("Program \"%s\" not found or cannot be executed."),
cmdline);
wMessageDialog(menu->frame->screen_ptr, _("Error"), path,
_("OK"), NULL, NULL);
free(path);
free(cmdline);
return;
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
free(path);
#endif
cmdline = ExpandOptions(menu->frame->screen_ptr, (char*)entry->clientdata);
XGrabPointer(dpy, menu->frame->screen_ptr->root_win, True, 0,
GrabModeAsync, GrabModeAsync, None, wCursor[WCUR_WAIT],
CurrentTime);
@@ -184,7 +171,7 @@ execCommand(WMenu *menu, WMenuEntry *entry)
* correctly '~/' expansion and '>' redirection.
* While we can do '~/' expansion ourselves, we can do nothing about
* '>' redirection.
* So we better let /bin/sh to do that for us. -Dan
* So we better let /bin/sh to do that for us. Dan.
* Ok. -Alfredo
*/
if (fork()==0) {
@@ -193,7 +180,8 @@ execCommand(WMenu *menu, WMenuEntry *entry)
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL);
execl(shell, shell, "-c", cmdline, NULL);
wsyserror("could not exec %s -c %s\n", shell, cmdline);
exit(-1);
}
free(cmdline);
@@ -206,8 +194,13 @@ execCommand(WMenu *menu, WMenuEntry *entry)
static void
exitCommand(WMenu *menu, WMenuEntry *entry)
{
static int inside = 0;
/* prevent reentrant calls */
wMenuSetEnabled(menu, entry->order, False);
if (inside)
return;
inside = 1;
if ((int)entry->clientdata==M_QUICK
|| wMessageDialog(menu->frame->screen_ptr, _("Exit"),
_("Exit window manager?"),
@@ -223,15 +216,20 @@ exitCommand(WMenu *menu, WMenuEntry *entry)
ExecExitScript();
exit(0);
}
wMenuSetEnabled(menu, entry->order, True);
inside = 0;
}
static void
shutdownCommand(WMenu *menu, WMenuEntry *entry)
{
static int inside = 0;
/* prevent reentrant calls */
wMenuSetEnabled(menu, entry->order, False);
if (inside)
return;
inside = 1;
if ((int)entry->clientdata==M_QUICK
|| wMessageDialog(menu->frame->screen_ptr, _("Close X session"),
_("Close Window System session?\n(all applications will be closed)"),
@@ -245,7 +243,7 @@ shutdownCommand(WMenu *menu, WMenuEntry *entry)
ExecExitScript();
exit(0);
}
wMenuSetEnabled(menu, entry->order, True);
inside = 0;
}
+7 -5
View File
@@ -1,6 +1,6 @@
/* screen.c - screen management
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -402,7 +402,7 @@ createPixmaps(WScreen *scr)
wwarning(_("could not load logo image for panels"));
} else {
if (!RConvertImageMask(scr->rcontext, image, &p, &m, 128)) {
wwarning(_("error making logo image for panel:%s"), RErrorString);
wwarning(_("error making logo image for panel:%s"), RMessageForError(RErrorCode));
} else {
wmpix = WMCreatePixmapFromXPixmaps(scr->wmscreen, p, m,
image->width, image->height,
@@ -582,7 +582,7 @@ wScreenInit(int screen_number)
scr->rcontext = RCreateContext(dpy, screen_number, &rattr);
if (!scr->rcontext) {
wwarning(_("could not initialize graphics library context: %s"),
RErrorString);
RMessageForError(RErrorCode));
wAbort(False);
} else {
char **formats;
@@ -713,6 +713,7 @@ wScreenSaveState(WScreen *scr)
WWindow *wwin;
char *str;
proplist_t path, old_state, foo;
CARD32 data[2];
make_keys();
@@ -722,11 +723,12 @@ wScreenSaveState(WScreen *scr)
*/
wstate.workspace = scr->current_workspace;
data[0] = wstate.flags;
data[1] = wstate.workspace;
XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_STATE,
_XA_WINDOWMAKER_STATE, 32, PropModeReplace,
(unsigned char *) &wstate,
sizeof(WWorkspaceState)/sizeof(int));
(unsigned char *) data, 2);
/* save state of windows */
wwin = scr->focused_window;
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -26,8 +26,13 @@
#include "WindowMaker.h"
#include <sys/types.h>
#ifdef XDE_DND
#include <gdk/gdk.h>
#endif
#include <proplist.h>
typedef struct WFont {
#ifndef I18N_MB
XFontStruct *font;
@@ -238,6 +243,10 @@ typedef struct _WScreen {
Window autoRaiseWindow; /* window that is scheduled to be
* raised */
#ifdef XDE_DND
char *xdestring;
#endif
struct {
unsigned int startup:1; /* during window manager startup */
unsigned int regenerate_icon_textures:1;
@@ -256,6 +265,7 @@ typedef struct _WScreen {
#define WSS_SWITCHMENU (1<<1)
#define WSS_WSMENU (1<<2)
/* changes must update wSaveScreenState/getWorkspaceState */
typedef struct WWorkspaceState {
int flags;
int workspace;
+2 -2
View File
@@ -2,7 +2,7 @@
*
* Copyright (c) 1998 Dan Pascu
*
* WindowMaker window manager
* Window Maker window manager
*
* 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
@@ -452,7 +452,7 @@ wSessionRestoreState(WScreen *scr)
if (found) {
wDockLaunchWithState(dock, btn, state);
} else if ((pid = execCommand(scr, command, host)) > 0) {
wAddWindowSavedState(instance, class, command, pid, state);
wWindowAddSavedState(instance, class, command, pid, state);
} else {
free(state);
}
+1 -1
View File
@@ -2,7 +2,7 @@
*
* Copyright (c) 1998 Dan Pascu
*
* WindowMaker window manager
* Window Maker window manager
*
* 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
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -111,9 +111,9 @@ WipeDesktop(WScreen *scr)
wwin = scr->focused_window;
while (wwin) {
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
else
wClientKill(wwin);
wClientKill(wwin);
wwin = wwin->prev;
}
XSync(dpy, False);
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -111,7 +111,7 @@ RemakeStackList(WScreen *scr)
scr->window_level_count[level]++;
}
XFree(windows);
#ifdef DEBUG0
#ifdef DEBUG
if (c!=scr->window_count) {
puts("Found different number of windows than in window lists!!!");
}
@@ -153,7 +153,7 @@ CommitStacking(WScreen *scr)
for (level=MAX_WINDOW_LEVELS-1; level>=0; level--) {
tmp = scr->stacking_list[level];
while (tmp) {
#ifndef DEBUG
#ifdef DEBUG
if (i>=nwindows) {
puts("Internal inconsistency! window_count is incorrect!!!");
printf("window_count says %i windows\n", nwindows);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+114 -44
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -36,6 +36,9 @@
#include <X11/cursorfont.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif
#include "WindowMaker.h"
#include "GNUstep.h"
@@ -80,6 +83,11 @@ extern WShortKey wKeyBindings[WKBD_LAST];
extern int wScreenCount;
#ifdef SHAPE
extern Bool wShapeSupported;
extern int wShapeEventBase;
#endif
/* contexts */
extern XContext wWinContext;
extern XContext wAppWinContext;
@@ -102,20 +110,27 @@ extern Atom _XA_WINDOWMAKER_WM_PROTOCOLS;
extern Atom _XA_WINDOWMAKER_STATE;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
extern Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
#ifdef OFFIX_DND
extern Atom _XA_DND_PROTOCOL;
extern Atom _XA_DND_SELECTION;
#endif
#ifdef XDE_DND
extern Atom _XA_XDE_REQUEST;
extern Atom _XA_XDE_ENTER;
extern Atom _XA_XDE_LEAVE;
extern Atom _XA_XDE_DATA_AVAILABLE;
extern Atom _XDE_FILETYPE;
extern Atom _XDE_URLTYPE;
#endif
/* cursors */
extern Cursor wCursor[WCUR_LAST];
/* special flags */
extern char WRestartASAP;
extern char WExitASAP;
extern char WProgramState;
extern char WDelayedActionSet;
/***** Local *****/
@@ -160,6 +175,7 @@ catchXError(Display *dpy, XErrorEvent *error)
*/
|| (error->request_code == X_InstallColormap))) {
#ifndef DEBUG
return 0;
#else
printf("got X error %x %x %x\n", error->request_code,
@@ -167,7 +183,7 @@ catchXError(Display *dpy, XErrorEvent *error)
return 0;
#endif
}
FormatXError(dpy, error, buffer, MAXLINE);
FormatXError(dpy, error, buffer, MAXLINE);
wwarning(_("internal X error: %s\n"), buffer);
return -1;
}
@@ -217,6 +233,7 @@ static RETSIGTYPE
handleSig(int sig)
{
static int already_crashed = 0;
int dumpcore = 0;
#ifndef NO_EMERGENCY_AUTORESTART
char *argv[2];
@@ -225,8 +242,8 @@ handleSig(int sig)
/*
* No functions that potentially do Xlib calls should be called from
* here. Xlib calls are not atomic so, so the logical integrity of
* Xlib is not guaranteed if a Xlib call is made from a signal handler.
* here. Xlib calls are not reentrant so the integrity of Xlib is
* not guaranteed if a Xlib call is made from a signal handler.
*/
if (sig == SIGHUP) {
#ifdef SYS_SIGLIST_DECLARED
@@ -235,7 +252,8 @@ handleSig(int sig)
wwarning(_("got signal %i - restarting\n"), sig);
#endif
WRestartASAP = 1;
WProgramState = WSTATE_NEED_RESTART;
/* setup idle handler, so that this will be handled when
* the select() is returned becaused of the signal, even if
* there are no X events in the queue */
@@ -244,10 +262,11 @@ handleSig(int sig)
WMAddIdleHandler(delayedAction, NULL);
}
return;
} else if (sig==SIGTERM) {
} else if (sig == SIGTERM) {
printf(_("%s: Received signal SIGTERM. Exiting..."), ProgName);
WExitASAP = 1;
WProgramState = WSTATE_NEED_EXIT;
if (!WDelayedActionSet) {
WDelayedActionSet = 1;
WMAddIdleHandler(delayedAction, NULL);
@@ -260,14 +279,16 @@ handleSig(int sig)
#else
wfatal(_("got signal %i\n"), sig);
#endif
if (sig==SIGSEGV || sig==SIGFPE || sig==SIGBUS || sig==SIGILL) {
if (already_crashed) {
wfatal(_("crashed while trying to do some post-crash cleanup. Aborting immediatelly."));
abort();
}
already_crashed = 1;
dumpcore = 1;
#ifndef NO_EMERGENCY_AUTORESTART
/* restart another window manager so that the X session doesn't
* go to space */
@@ -276,7 +297,7 @@ handleSig(int sig)
if (dpy)
XCloseDisplay(dpy);
dpy = NULL;
argv[0] = FALLBACK_WINDOWMANAGER;
execvp(FALLBACK_WINDOWMANAGER, argv);
@@ -287,8 +308,8 @@ handleSig(int sig)
execvp("twm", argv);
#endif /* !NO_EMERGENCY_AUTORESTART */
}
wAbort(sig==SIGSEGV);
wAbort(dumpcore);
}
@@ -328,14 +349,22 @@ getWorkspaceState(Window root, WWorkspaceState **state)
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
CARD32 *data;
if (XGetWindowProperty(dpy, root, _XA_WINDOWMAKER_STATE, 0,
sizeof(WWorkspaceState),
if (XGetWindowProperty(dpy, root, _XA_WINDOWMAKER_STATE, 0, 2,
True, _XA_WINDOWMAKER_STATE,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)state)!=Success)
(unsigned char **)&data)!=Success || !data)
return 0;
if (type_ret==_XA_WINDOWMAKER_STATE)
*state = malloc(sizeof(WWorkspaceState));
if (*state) {
(*state)->flags = data[0];
(*state)->workspace = data[1];
}
XFree(data);
if (*state && type_ret==_XA_WINDOWMAKER_STATE)
return 1;
else
return 0;
@@ -410,7 +439,7 @@ wHackedGrabKey(int keycode, unsigned int modifiers,
grab_window, owner_events, pointer_mode, keyboard_mode);
/* phew, I guess that's all, right? */
}
#endif
void
wHackedGrabButton(unsigned int button, unsigned int modifiers,
@@ -418,9 +447,16 @@ wHackedGrabButton(unsigned int button, unsigned int modifiers,
unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, Cursor cursor)
{
XGrabButton(dpy, button, modifiers, grab_window, owner_events,
event_mask, pointer_mode, keyboard_mode, confine_to, cursor);
if (modifiers==AnyModifier)
return;
XGrabButton(dpy, button, modifiers|LockMask, grab_window, owner_events,
event_mask, pointer_mode, keyboard_mode, confine_to, cursor);
#ifdef NUMLOCK_HACK
/* same as above, but for mouse buttons */
if (_NumLockMask)
XGrabButton(dpy, button, modifiers|_NumLockMask,
@@ -446,9 +482,10 @@ wHackedGrabButton(unsigned int button, unsigned int modifiers,
XGrabButton(dpy, button, modifiers|_ScrollLockMask|_NumLockMask|LockMask,
grab_window, owner_events, event_mask, pointer_mode,
keyboard_mode, confine_to, cursor);
#endif /* NUMLOCK_HACK */
}
#ifdef notused
void
wHackedUngrabButton(unsigned int button, unsigned int modifiers,
Window grab_window)
@@ -466,7 +503,7 @@ wHackedUngrabButton(unsigned int button, unsigned int modifiers,
XUngrabButton(dpy, button, modifiers|_NumLockMask|_ScrollLockMask|LockMask,
grab_window);
}
#endif /* NUMLOCK_HACK */
#endif
@@ -505,7 +542,10 @@ WScreen*
wScreenForWindow(Window window)
{
XWindowAttributes attr;
if (wScreenCount==1)
return wScreen[0];
if (XGetWindowAttributes(dpy, window, &attr)) {
return wScreenForRootWindow(attr.root);
}
@@ -568,12 +608,9 @@ StartUp(Bool defaultScreenOnly)
_XA_WINDOWMAKER_WM_PROTOCOLS =
XInternAtom(dpy, "_WINDOWMAKER_WM_PROTOCOLS", False);
_XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW =
XInternAtom(dpy, WINDOWMAKER_WM_MINIATURIZE_WINDOW, False);
_XA_GNUSTEP_WM_MINIATURIZE_WINDOW =
XInternAtom(dpy, GNUSTEP_WM_MINIATURIZE_WINDOW, False);
_XA_GNUSTEP_WM_RESIZEBAR =
XInternAtom(dpy, GNUSTEP_WM_RESIZEBAR, False);
_XA_WINDOWMAKER_WM_FUNCTION = XInternAtom(dpy, "_WINDOWMAKER_WM_FUNCTION",
False);
@@ -582,6 +619,15 @@ StartUp(Bool defaultScreenOnly)
_XA_DND_SELECTION = XInternAtom(dpy, "DndSelection", False);
_XA_DND_PROTOCOL = XInternAtom(dpy, "DndProtocol", False);
#endif
#ifdef XDE_DND
_XA_XDE_ENTER = XInternAtom(dpy, "_XDE_ENTER", False);
_XA_XDE_REQUEST = XInternAtom(dpy, "_XDE_REQUEST", False);
_XA_XDE_LEAVE = XInternAtom(dpy, "_XDE_LEAVE", False);
_XA_XDE_DATA_AVAILABLE = XInternAtom(dpy, "_XDE_DATA_AVAILABLE", False);
_XDE_FILETYPE = XInternAtom(dpy, "file:ALL", False);
_XDE_URLTYPE = XInternAtom(dpy, "url:ALL", False);
#endif
/* cursors */
wCursor[WCUR_NORMAL] = XCreateFontCursor(dpy, XC_left_ptr);
@@ -659,15 +705,18 @@ StartUp(Bool defaultScreenOnly)
wwarning(_("could not read domain \"%s\" from defaults database"),
"WMWindowAttributes");
}
XSetErrorHandler((XErrorHandler)catchXError);
/* Sound init */
#ifdef WMSOUND
wSoundInit(dpy);
#endif
XSetErrorHandler((XErrorHandler)catchXError);
#ifdef SHAPE
/* ignore j */
wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j);
#endif
if (defaultScreenOnly) {
max = 1;
@@ -675,32 +724,37 @@ StartUp(Bool defaultScreenOnly)
max = ScreenCount(dpy);
}
wScreen = wmalloc(sizeof(WScreen*)*max);
wScreenCount = 0;
/* manage the screens */
for (j = 0; j < max; j++) {
if (defaultScreenOnly || max==1) {
wScreen[j] = wScreenInit(DefaultScreen(dpy));
if (!wScreen[j]) {
wScreen[wScreenCount] = wScreenInit(DefaultScreen(dpy));
if (!wScreen[wScreenCount]) {
wfatal(_("it seems that there already is a window manager running"));
exit(1);
}
} else {
wScreen[j] = wScreenInit(j);
if (!wScreen[j]) {
wScreen[wScreenCount] = wScreenInit(j);
if (!wScreen[wScreenCount]) {
wwarning(_("could not manage screen %i"), j);
continue;
}
}
wScreenCount++;
}
/* initialize/restore state for the screens */
for (j = 0; j < wScreenCount; j++) {
/* restore workspace state */
if (!getWorkspaceState(wScreen[j]->root_win, &ws_state)) {
ws_state = NULL;
}
wScreenRestoreState(wScreen[j]);
/* manage all windows that were already
* here before us */
/* manage all windows that were already here before us */
if (!wPreferences.flags.nodock && wScreen[j]->dock)
wScreen[j]->last_dock = wScreen[j]->dock;
@@ -733,7 +787,7 @@ StartUp(Bool defaultScreenOnly)
/* go to workspace where we were before restart */
if (ws_state) {
wWorkspaceForceChange(wScreen[j], ws_state->workspace);
XFree(ws_state);
free(ws_state);
} else {
wSessionRestoreLastWorkspace(wScreen[j]);
}
@@ -772,6 +826,16 @@ getState(Window window)
}
static Bool
windowInList(Window window, Window *list, int count)
{
for (; count>=0; count--) {
if (window == list[count])
return True;
}
return False;
}
/*
*-----------------------------------------------------------------------
* manageAllWindows--
@@ -865,8 +929,14 @@ manageAllWindows(WScreen *scr)
(wwin->wm_hints->flags & StateHint) && state<0)
state=wwin->wm_hints->initial_state;
if (state==IconicState) {
wIconifyWindow(wwin);
wwin->flags.ignore_next_unmap=1;
/* iconify if it's not a transient */
if (wwin->transient_for==None
|| wwin->transient_for==wwin->client_win
|| !windowInList(wwin->transient_for,
children, nchildren)) {
wIconifyWindow(wwin);
wwin->flags.ignore_next_unmap=1;
}
} else {
wClientSetState(wwin, NormalState, None);
}
+147 -50
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -27,6 +27,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <wraster.h>
#include "WindowMaker.h"
@@ -57,41 +59,106 @@ play(Display *dpy, int pitch, int delay)
}
#endif
#ifdef DEMATERIALIZE_ICON
void
DoKaboom(WScreen *scr, Window win, int x, int y)
{
RImage *icon;
RImage *back;
RImage *image;
Pixmap pixmap;
XImage *ximage;
int i;
int w, h;
h = w = wPreferences.icon_size;
if (x < 0 || x + w > scr->scr_width || y < 0 || y + h > scr->scr_height)
return;
icon = RCreateImageFromDrawable(scr->rcontext, win, None);
if (!icon)
return;
XUnmapWindow(dpy, win);
XSync(dpy, False);
ximage = XGetImage(dpy, scr->root_win, x, y, w, h, AllPlanes, ZPixmap);
back = RCreateImageFromXImage(scr->rcontext, ximage, NULL);
XDestroyImage(ximage);
if (!back) {
RDestroyImage(icon);
return;
}
for (i=0; i<DEMATERIALIZE_STEPS; i++) {
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, scr->copy_gc, 0, 0, w, h, x, y);
XFreePixmap(dpy, pixmap);
XFlush(dpy);
}
XClearArea(dpy, scr->root_win, x, y, w, h, False);
XFlush(dpy);
RDestroyImage(icon);
RDestroyImage(back);
}
#else /* !DEMATERIALIZE_ICON */
void
DoKaboom(WScreen *scr, Window win, int x, int y)
{
int i, j, k;
int sw=scr->scr_width, sh=scr->scr_height;
short px[PIECES], py[PIECES];
#define KAB_PRECISION 4
int px[PIECES];
short py[PIECES];
#ifdef ICON_KABOOM_EXTRA
short ptx[2][PIECES], pty[2][PIECES];
int ll;
#endif
char pvx[PIECES], pvy[PIECES];
char ax[PIECES], ay[PIECES];
Pixmap tmp;
XImage *img;
img=XGetImage(dpy, win, 0, 0, wPreferences.icon_size,
wPreferences.icon_size, AllPlanes, ZPixmap);
XUnmapWindow(dpy,win);
if (!img)
return;
XSetClipMask(dpy, scr->copy_gc, None);
tmp = XCreatePixmap(dpy, scr->root_win, wPreferences.icon_size,
wPreferences.icon_size, scr->depth);
XPutImage(dpy, tmp, scr->copy_gc, img, 0, 0, 0, 0, wPreferences.icon_size,
wPreferences.icon_size);
XDestroyImage(img);
for (i=0,k=0; i<wPreferences.icon_size/PSIZE; i++) {
for (j=0; j<wPreferences.icon_size/PSIZE; j++) {
if (rand()%3) {
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);
else {
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);
}
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*PSIZE;
py[k]=y+j*PSIZE;
pvx[k]=rand()%7-3;
#ifdef SPREAD_ICON
pvy[k]=rand()%7-3;
#else
pvy[k]=-12-rand()%6;
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];
}
#endif
k++;
} else {
@@ -99,56 +166,82 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
}
}
}
XUnmapWindow(dpy, win);
j=k;
while (k>0) {
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);
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);
#endif
px[i]+=pvx[i];
py[i]+=pvy[i];
#ifdef SPREAD_ICON
pvx[i]+=(pvx[i]>0 ? 2 : -2);
pvy[i]+=(pvy[i]>0 ? 2 : -2);
/* The following are nice, but too slow.
* The animation can have an unknown duration, depending
* on what rand() returns. Until the animation ends, the user
* cannot do anything, which is not too good. -Dan
*/
/*pvx[i]+=rand()%5-2;
pvy[i]+=rand()%5-2;*/
#else
_px = px[i]>>KAB_PRECISION;
pvy[i]++;
#endif
if (px[i]<-wPreferences.icon_size || px[i]>sw || py[i]>sh
#ifdef SPREAD_ICON
|| px[i]<0 || py[i]<0
#endif
) {
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--;
}
#else /* !ICON_KABOOM_EXTRA */
ax[i]=-1;
k--;
#endif /* !ICON_KABOOM_EXTRA */
} else {
XCopyArea(dpy, tmp, scr->root_win, scr->copy_gc,
ax[i]*PSIZE, ay[i]*PSIZE,
PSIZE, PSIZE, px[i], py[i]);
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);
#ifdef SPEAKER_SOUND
play(dpy, 100+rand()%250, 12);
#else
# if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
# if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
wusleep(MINIATURIZE_ANIMATION_DELAY_Z*2);
# endif
#endif
for (i=0; i<j; i++) {
if (ax[i]>=0) {
XClearArea(dpy, scr->root_win, px[i], py[i], PSIZE, PSIZE, 1);
}
}
}
XFreePixmap(dpy, tmp);
}
#endif /* !DEMATERIALIZE_ICON */
Pixmap
@@ -275,6 +368,7 @@ DoWindowBirth(WWindow *wwin)
int x, y;
int dw, dh;
int i;
time_t time0 = time(NULL);
dw = (width-w)/WINDOW_BIRTH_STEPS;
dh = (height-h)/WINDOW_BIRTH_STEPS;
@@ -294,8 +388,11 @@ DoWindowBirth(WWindow *wwin)
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);
XFlush(dpy);
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -19,8 +19,7 @@
* USA.
*/
#define PSIZE 4
#define PIECES ((64/PSIZE)*(64/PSIZE))
#define PIECES ((64/ICON_KABOOM_PIECE_SIZE)*(64/ICON_KABOOM_PIECE_SIZE))
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997 Shige Abe and
* Alfredo K. Kojima
+35 -33
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -271,7 +271,7 @@ wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, XColor *color)
image = RLoadImage(scr->rcontext, file, 0);
if (!image) {
wwarning(_("could not load texture pixmap \"%s\":%s"), file,
RErrorString);
RMessageForError(RErrorCode));
free(file);
return NULL;
}
@@ -374,7 +374,7 @@ wTextureRenderImage(WTexture *texture, int width, int height, int relief)
}
if (!image) {
wwarning(_("could not render texture: %s"), RErrorString);
wwarning(_("could not render texture: %s"), RMessageForError(RErrorCode));
return None;
}
@@ -485,11 +485,11 @@ renderTexture(WScreen *scr, int width, int height, WTexture *texture,
img = wTextureRenderImage(texture, width, height, rel);
if (!img) {
wwarning(_("could not render texture: %s"), RErrorString);
wwarning(_("could not render texture: %s"), RMessageForError(RErrorCode));
return None;
}
if (!RConvertImage(scr->rcontext, img, &pix)) {
wwarning(_("error rendering image:%s"), RErrorString);
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(img);
return pix;
@@ -497,7 +497,8 @@ renderTexture(WScreen *scr, int width, int height, WTexture *texture,
void
wDrawBevel(WCoreWindow *core, WTexSolid *texture, int relief)
wDrawBevel(Drawable d, unsigned width, unsigned height,
WTexSolid *texture, int relief)
{
GC light, dim, dark;
XSegment segs[4];
@@ -514,53 +515,54 @@ wDrawBevel(WCoreWindow *core, WTexSolid *texture, int relief)
case WREL_RAISED:
case WREL_ICON:
segs[0].x1 = 1;
segs[0].x2 = core->width - 2;
segs[0].y2 = segs[0].y1 = core->height - 2;
segs[1].x1 = core->width - 2;
segs[0].x2 = width - 2;
segs[0].y2 = segs[0].y1 = height - 2;
segs[1].x1 = width - 2;
segs[1].y1 = 1;
segs[1].x2 = core->width - 2;
segs[1].y2 = core->height - 2;
XDrawSegments(dpy, core->window, dim, segs, 2);
segs[1].x2 = width - 2;
segs[1].y2 = height - 2;
XDrawSegments(dpy, d, dim, segs, 2);
segs[0].x1 = 0;
segs[0].x2 = core->width - 1;
segs[0].y2 = segs[0].y1 = core->height - 1;
segs[1].x1 = segs[1].x2 = core->width - 1;
segs[0].x2 = width - 1;
segs[0].y2 = segs[0].y1 = height - 1;
segs[1].x1 = segs[1].x2 = width - 1;
segs[1].y1 = 0;
segs[1].y2 = core->height - 1;
XDrawSegments(dpy, core->window, dark, segs, 2);
segs[1].y2 = height - 1;
XDrawSegments(dpy, d, dark, segs, 2);
segs[0].x1 = segs[0].y1 = segs[0].y2 = 0;
segs[0].x2 = core->width - 2;
segs[0].x2 = width - 2;
segs[1].x1 = segs[1].y1 = 0;
segs[1].x2 = 0;
segs[1].y2 = core->height - 2;
XDrawSegments(dpy, core->window, light, segs, 2);
segs[1].y2 = height - 2;
XDrawSegments(dpy, d, light, segs, 2);
if (relief==WREL_ICON) {
segs[0].x1 = segs[0].y1 = segs[0].y2 = 1;
segs[0].x2 = core->width - 2;
segs[0].x2 = width - 2;
segs[1].x1 = segs[1].y1 = 1;
segs[1].x2 = 1;
segs[1].y2 = core->height - 2;
XDrawSegments(dpy, core->window, light, segs, 2);
segs[1].y2 = height - 2;
XDrawSegments(dpy, d, light, segs, 2);
}
break;
#ifdef unused
case WREL_SUNKEN:
segs[0].x1 = 0;
segs[0].x2 = core->width - 1;
segs[0].x2 = width - 1;
segs[0].y2 = segs[0].y1 = 0;
segs[1].x1 = segs[1].x2 = 0;
segs[1].y1 = 0;
segs[1].y2 = core->height - 1;
XDrawSegments(dpy, core->window, dark, segs, 2);
segs[1].y2 = height - 1;
XDrawSegments(dpy, d, dark, segs, 2);
segs[0].x1 = 0;
segs[0].y1 = segs[0].y2 = core->height - 1;
segs[0].x2 = core->width - 1;
segs[1].x2 = segs[1].x1 = core->width - 1;
segs[0].y1 = segs[0].y2 = height - 1;
segs[0].x2 = width - 1;
segs[1].x2 = segs[1].x1 = width - 1;
segs[1].y1 = 1;
segs[1].y2 = core->height - 1;
XDrawSegments(dpy, core->window, light, segs, 2);
break;
segs[1].y2 = height - 1;
XDrawSegments(dpy, d, light, segs, 2);
break;
#endif
}
}
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -151,6 +151,7 @@ void wTexturePaintTitlebar(struct WWindow *wwin, WTexture *texture, Pixmap *tdat
#define FREE_PIXMAP(p) if ((p)!=None) XFreePixmap(dpy, (p)), (p)=None
void wDrawBevel(WCoreWindow *core, WTexSolid *texture, int relief);
void wDrawBevel(Drawable d, unsigned width, unsigned height,
WTexSolid *texture, int relief);
#endif
+75 -35
View File
@@ -1,5 +1,5 @@
/*
* wconfig.h- default configuration and definitions
* wconfig.h- default configuration and definitions + compile time options
*
* WindowMaker window manager
*
@@ -25,6 +25,8 @@
#include "config.h"
/*** Change it (wconfig.h) *after* you ran configure ***/
/*
*--------------------------------------------------------------------
* Feature Selection
@@ -40,14 +42,6 @@
#define ANIMATIONS
/*
* #undef if you dont want the window creation animation when superfluous
* is enabled.
* THIS WILL NOT BE MADE RUN-TIME.
*/
#define WINDOW_BIRTH_ZOOM
/*
* mimic N*XTSTEP behaviour as close as possible.
* affected behaviour:
@@ -83,13 +77,11 @@
*/
#define OFFIX_DND
/* define CONFIGURE_WINDOW_WHILE_MOVING if you want WindowMaker to send
* the synthetic ConfigureNotify event to windows while moving at every
* single movement. Default is to send a synthetic ConfigureNotify event
* only at the end of window moving, which improves performance.
/*
* support for XDE drang and drop in the Dock. still in beta
*/
#undef CONFIGURE_WINDOW_WHILE_MOVING
#undef XDE_DND
/*
* Undefine BALLOON_TEXT if you don't want balloons for showing extra
@@ -132,8 +124,37 @@
*/
#define NUMLOCK_HACK
/*
* define REDUCE_APPICONS if you want apps with the same WM_INSTANCE &&
* WM_CLASS to share an appicon
*/
#undef REDUCE_APPICONS
/*
* define OPTIMIZE_SHAPE if you want the shape setting code to be optimized
* for applications that change their shape frequently (like xdaliclock
* -shape), removing flickering. If wmaker and your display are on
* different machines and the network connection is slow, it is not
* recommended.
*/
#undef OPTIMIZE_SHAPE
/* define CONFIGURE_WINDOW_WHILE_MOVING if you want WindowMaker to send
* the synthetic ConfigureNotify event to windows while moving at every
* single movement. Default is to send a synthetic ConfigureNotify event
* only at the end of window moving, which improves performance.
*/
#undef CONFIGURE_WINDOW_WHILE_MOVING
/*
*..........................................................................
* The following options WILL NOT BE MADE RUN-TIME. Please do not request.
* They will only add unneeded bloat.
*..........................................................................
*/
/*
* define SHADOW_RESIZEBAR if you want a resizebar with shadows like in
* NextStep 3.x ??, instead of the default Openstep look. NEXTSTEP 3.3
@@ -141,19 +162,24 @@
*/
#undef SHADOW_RESIZEBAR
/*
* define REDUCE_APPICONS if you want apps with the same WM_INSTANCE &&
* WM_CLASS to share an appicon
*/
#undef REDUCE_APPICONS
/*
* Define SPREAD_ICON if you want icon blowing animation (when detached from
* dock/clip in the superfluous mode), to spread the icon in four directions.
* If this is undefined, then the classic "Falling pieces" animation is used.
* Define DEMATERIALIZE_ICON if you want the undocked icon animation
* to be a progressive disaparison animation.
*/
#undef SPREAD_ICON
#undef DEMATERIALIZE_ICON
/*
* Define ICON_KABOOM_EXTRA if you want extra fancy icon undocking
* explosion animation.
*/
#undef ICON_KABOOM_EXTRA
/*
* #undef if you dont want the window creation animation when superfluous
* is enabled.
*/
#undef WINDOW_BIRTH_ZOOM
/*
@@ -227,6 +253,12 @@
* opposed to OpenStep */
#define SINGLE_MENULEVEL
/* max. time to spend doing animations in seconds. If the animation
* time exceeds this value, it is immediately finished. Usefull for
* moments of high-load.
*/
#define MAX_ANIMATION_TIME 1
/* Zoom animation */
#define MINIATURIZE_ANIMATION_FRAMES_Z 5
#define MINIATURIZE_ANIMATION_STEPS_Z 12
@@ -241,6 +273,9 @@
#define MINIATURIZE_ANIMATION_STEPS_F 16
#define MINIATURIZE_ANIMATION_DELAY_F 1000
#define MINIATURIZE_ANIMATION_TWIST_F 0.5
#define HIDE_ANIMATION_STEPS (MINIATURIZE_ANIMATION_STEPS*2/3)
#define BALLOON_DELAY 1000
@@ -303,9 +338,14 @@
/* window birth animation steps (DO NOT MAKE IT RUN-TIME) */
#define WINDOW_BIRTH_STEPS 20
/* number of steps for icon dematerialization. */
#define DEMATERIALIZE_STEPS 16
/* Delay when cycling colors of selected icons. */
#define COLOR_CYCLE_DELAY 300
#define COLOR_CYCLE_DELAY 200
/* size of the pieces in the undocked icon explosion */
#define ICON_KABOOM_PIECE_SIZE 4
/* Position increment for smart placement. >= 1 raise these values if it's
@@ -319,6 +359,10 @@
/* Vicinity in which an icon can be attached to the clip */
#define CLIP_ATTACH_VICINITY 1
/* The amount of space (in multiples of the icon size)
* a docked icon must be dragged out to detach it */
#define DOCK_DETTACH_THRESHOLD 3
/* Delay (in ms) after which the clip will autocollapse when leaved */
#define AUTO_COLLAPSE_DELAY 1000
@@ -357,14 +401,6 @@
#undef WS_INDICATOR
/* the button positions in the clip */
#define LCLIPB_X 4
#define RCLIPB_X 32
#define CLIPB_Y 41
#define CLIPB_W 27
#define CLIPB_H 18
/*
*----------------------------------------------------------------------
* You should not modify the following values, unless you know
@@ -413,18 +449,22 @@
#define MAXLINE 1024
#ifdef _MAX_PATH
# define DEFAULT_PATH_MAX _MAX_PATH
#else
# define DEFAULT_PATH_MAX 512
#endif
#define DEBUG0
/* some rules */
#ifndef SHAPE
#undef SHAPED_BALLOON
#endif
#define DEBUG0
#if HAVE_LIBINTL_H && I18N
# include <libintl.h>
+75 -35
View File
@@ -1,5 +1,5 @@
/*
* wconfig.h- default configuration and definitions
* wconfig.h- default configuration and definitions + compile time options
*
* WindowMaker window manager
*
@@ -25,6 +25,8 @@
#include "config.h"
/*** Change it (wconfig.h) *after* you ran configure ***/
/*
*--------------------------------------------------------------------
* Feature Selection
@@ -40,14 +42,6 @@
#define ANIMATIONS
/*
* #undef if you dont want the window creation animation when superfluous
* is enabled.
* THIS WILL NOT BE MADE RUN-TIME.
*/
#define WINDOW_BIRTH_ZOOM
/*
* mimic N*XTSTEP behaviour as close as possible.
* affected behaviour:
@@ -83,13 +77,11 @@
*/
#define OFFIX_DND
/* define CONFIGURE_WINDOW_WHILE_MOVING if you want WindowMaker to send
* the synthetic ConfigureNotify event to windows while moving at every
* single movement. Default is to send a synthetic ConfigureNotify event
* only at the end of window moving, which improves performance.
/*
* support for XDE drang and drop in the Dock. still in beta
*/
#undef CONFIGURE_WINDOW_WHILE_MOVING
#undef XDE_DND
/*
* Undefine BALLOON_TEXT if you don't want balloons for showing extra
@@ -132,8 +124,37 @@
*/
#define NUMLOCK_HACK
/*
* define REDUCE_APPICONS if you want apps with the same WM_INSTANCE &&
* WM_CLASS to share an appicon
*/
@REDUCE_APPICONS@
/*
* define OPTIMIZE_SHAPE if you want the shape setting code to be optimized
* for applications that change their shape frequently (like xdaliclock
* -shape), removing flickering. If wmaker and your display are on
* different machines and the network connection is slow, it is not
* recommended.
*/
#undef OPTIMIZE_SHAPE
/* define CONFIGURE_WINDOW_WHILE_MOVING if you want WindowMaker to send
* the synthetic ConfigureNotify event to windows while moving at every
* single movement. Default is to send a synthetic ConfigureNotify event
* only at the end of window moving, which improves performance.
*/
#undef CONFIGURE_WINDOW_WHILE_MOVING
/*
*..........................................................................
* The following options WILL NOT BE MADE RUN-TIME. Please do not request.
* They will only add unneeded bloat.
*..........................................................................
*/
/*
* define SHADOW_RESIZEBAR if you want a resizebar with shadows like in
* NextStep 3.x ??, instead of the default Openstep look. NEXTSTEP 3.3
@@ -141,19 +162,24 @@
*/
#undef SHADOW_RESIZEBAR
/*
* define REDUCE_APPICONS if you want apps with the same WM_INSTANCE &&
* WM_CLASS to share an appicon
*/
@REDUCE_APPICONS@
/*
* Define SPREAD_ICON if you want icon blowing animation (when detached from
* dock/clip in the superfluous mode), to spread the icon in four directions.
* If this is undefined, then the classic "Falling pieces" animation is used.
* Define DEMATERIALIZE_ICON if you want the undocked icon animation
* to be a progressive disaparison animation.
*/
#undef SPREAD_ICON
#undef DEMATERIALIZE_ICON
/*
* Define ICON_KABOOM_EXTRA if you want extra fancy icon undocking
* explosion animation.
*/
#undef ICON_KABOOM_EXTRA
/*
* #undef if you dont want the window creation animation when superfluous
* is enabled.
*/
#undef WINDOW_BIRTH_ZOOM
/*
@@ -227,6 +253,12 @@
* opposed to OpenStep */
#define SINGLE_MENULEVEL
/* max. time to spend doing animations in seconds. If the animation
* time exceeds this value, it is immediately finished. Usefull for
* moments of high-load.
*/
#define MAX_ANIMATION_TIME 1
/* Zoom animation */
#define MINIATURIZE_ANIMATION_FRAMES_Z 5
#define MINIATURIZE_ANIMATION_STEPS_Z 12
@@ -241,6 +273,9 @@
#define MINIATURIZE_ANIMATION_STEPS_F 16
#define MINIATURIZE_ANIMATION_DELAY_F 1000
#define MINIATURIZE_ANIMATION_TWIST_F 0.5
#define HIDE_ANIMATION_STEPS (MINIATURIZE_ANIMATION_STEPS*2/3)
#define BALLOON_DELAY 1000
@@ -303,9 +338,14 @@
/* window birth animation steps (DO NOT MAKE IT RUN-TIME) */
#define WINDOW_BIRTH_STEPS 20
/* number of steps for icon dematerialization. */
#define DEMATERIALIZE_STEPS 16
/* Delay when cycling colors of selected icons. */
#define COLOR_CYCLE_DELAY 300
#define COLOR_CYCLE_DELAY 200
/* size of the pieces in the undocked icon explosion */
#define ICON_KABOOM_PIECE_SIZE 4
/* Position increment for smart placement. >= 1 raise these values if it's
@@ -319,6 +359,10 @@
/* Vicinity in which an icon can be attached to the clip */
#define CLIP_ATTACH_VICINITY 1
/* The amount of space (in multiples of the icon size)
* a docked icon must be dragged out to detach it */
#define DOCK_DETTACH_THRESHOLD 3
/* Delay (in ms) after which the clip will autocollapse when leaved */
#define AUTO_COLLAPSE_DELAY 1000
@@ -357,14 +401,6 @@
#undef WS_INDICATOR
/* the button positions in the clip */
#define LCLIPB_X 4
#define RCLIPB_X 32
#define CLIPB_Y 41
#define CLIPB_W 27
#define CLIPB_H 18
/*
*----------------------------------------------------------------------
* You should not modify the following values, unless you know
@@ -413,18 +449,22 @@
#define MAXLINE 1024
#ifdef _MAX_PATH
# define DEFAULT_PATH_MAX _MAX_PATH
#else
# define DEFAULT_PATH_MAX 512
#endif
#define DEBUG0
/* some rules */
#ifndef SHAPE
#undef SHAPED_BALLOON
#endif
#define DEBUG0
#if HAVE_LIBINTL_H && I18N
# include <libintl.h>
+5 -2
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -65,10 +65,13 @@ wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int height,
attribs.override_redirect = True;
attribs.cursor = wCursor[WCUR_DEFAULT];
attribs.background_pixmap = None;
attribs.background_pixel = screen->light_pixel;
attribs.background_pixel = screen->black_pixel;
attribs.border_pixel = screen->frame_border_pixel;
attribs.event_mask = SubstructureRedirectMask | ButtonPressMask
| ButtonReleaseMask | ButtonMotionMask | ExposureMask | EnterWindowMask
#ifdef XDE_DND
| StructureNotifyMask
#endif
| LeaveWindowMask;
vmask |= CWColormap;
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+2 -2
View File
@@ -1,6 +1,6 @@
/* wdefaults.c - window specific defaults
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -399,7 +399,7 @@ wDefaultGetImage(WScreen *scr, char *winstance, char *wclass)
image = RLoadImage(scr->rcontext, path, 0);
if (!image) {
wwarning(_("error loading image file \"%s\""), path, RErrorString);
wwarning(_("error loading image file \"%s\""), path, RMessageForError(RErrorCode));
}
free(path);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+415 -164
View File
@@ -1,6 +1,6 @@
/* window.c - client window managing class
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -55,8 +55,9 @@
extern WShortKey wKeyBindings[WKBD_LAST];
/* modules */
extern int ModuleNo;
#ifdef SHAPE
extern Bool wShapeSupported;
#endif
/* contexts */
extern XContext wWinContext;
@@ -66,7 +67,7 @@ extern Cursor wCursor[WCUR_LAST];
/* protocol atoms */
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_STATE;
@@ -79,8 +80,14 @@ extern Time LastTimestamp;
/* superfluous... */
extern void DoWindowBirth(WWindow*);
/***** Local Stuff *****/
static WWindowState *windowState=NULL;
/* local functions */
static FocusMode getFocusMode(WWindow *wwin);
@@ -113,6 +120,10 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event);
static void resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event);
WWindow*
wWindowFor(Window window)
{
@@ -424,18 +435,17 @@ WWindow*
wManageWindow(WScreen *scr, Window window)
{
WWindow *wwin;
int width, height;
int x, y;
unsigned width, height;
XWindowAttributes wattribs;
XSetWindowAttributes attribs;
int iconic = 0;
WSavedState *wstate;
WWindowState *win_state;
#ifdef MWM_HINTS
MWMHints *motif_hints = NULL;
#endif
int window_level;
int foo, gx, gy;
int resized_client;
int foo;
int workspace = -1;
char *title;
@@ -456,7 +466,7 @@ wManageWindow(WScreen *scr, Window window)
#endif
#ifdef SHAPE
{
if (wShapeSupported) {
int junk;
unsigned int ujunk;
int b_shaped;
@@ -501,7 +511,8 @@ wManageWindow(WScreen *scr, Window window)
}
#ifdef MWM_HINTS
PropGetMotifWMHints(window, &motif_hints);
if (!PropGetMotifWMHints(window, &motif_hints))
motif_hints = NULL;
#endif /* MWM_HINTS */
if (!PropGetClientLeader(window, &wwin->client_leader)) {
@@ -567,7 +578,7 @@ wManageWindow(WScreen *scr, Window window)
wwin->focus_mode = getFocusMode(wwin);
/* get geometry stuff */
GetNormalHints(wwin, &wattribs, True);
wClientGetNormalHints(wwin, &wattribs, True, &x, &y, &width, &height);
/* get colormap windows */
GetColormapWindows(wwin);
@@ -607,7 +618,7 @@ wManageWindow(WScreen *scr, Window window)
(unsigned)wwin->transient_for);
#endif
}
/* if the window can't be resized, remove the resizebar */
if (wwin->normal_hints->flags & (PMinSize|PMaxSize)
&& (wwin->normal_hints->min_width==wwin->normal_hints->max_width)
@@ -638,7 +649,7 @@ wManageWindow(WScreen *scr, Window window)
}
#ifdef MWM_HINTS
if (motif_hints)
XFree(motif_hints);
free(motif_hints);
#endif
/*
@@ -648,8 +659,8 @@ wManageWindow(WScreen *scr, Window window)
*/
wDefaultFillAttributes(scr, wwin->wm_instance, wwin->wm_class,
&wwin->window_flags, False);
/*
* Sanity checks for attributes that depend on other attributes
*/
@@ -668,7 +679,7 @@ wManageWindow(WScreen *scr, Window window)
*------------------------------------------------------------
*
* Setup the initial state of the window
*
*
*------------------------------------------------------------
*/
if (wwin->window_flags.start_miniaturized
@@ -680,9 +691,9 @@ wManageWindow(WScreen *scr, Window window)
/* if there is a saved state, restore it */
win_state = NULL;
if (wwin->main_window!=None/* && wwin->main_window!=window*/) {
win_state = (WWindowState*)wGetWindowSavedState(wwin->main_window);
win_state = (WWindowState*)wWindowGetSavedState(wwin->main_window);
} else {
win_state = (WWindowState*)wGetWindowSavedState(window);
win_state = (WWindowState*)wWindowGetSavedState(window);
}
if (win_state && !(wwin->wm_hints && wwin->wm_hints->flags&StateHint &&
wwin->wm_hints->initial_state==WithdrawnState)) {
@@ -709,19 +720,22 @@ wManageWindow(WScreen *scr, Window window)
workspace = scr->current_workspace;
}
}
/* if we're restarting, restore saved state. This will overwrite previous */
if (!getSavedState(window, &wstate)) {
wstate = NULL;
} else {
wwin->flags.shaded = wstate->shaded;
wwin->flags.hidden = wstate->hidden;
wwin->flags.miniaturized = 0;
workspace = wstate->workspace;
{
WSavedState *wstate;
if (getSavedState(window, &wstate)) {
wwin->flags.shaded = wstate->shaded;
wwin->flags.hidden = wstate->hidden;
wwin->flags.miniaturized = 0;
workspace = wstate->workspace;
free(wstate);
}
}
/* set workspace on which the window starts */
/* set workspace on which the window starts */
if (workspace >= 0) {
if (workspace > scr->workspace_count-1) {
wWorkspaceMake(scr, workspace - scr->workspace_count + 1);
@@ -738,47 +752,29 @@ wManageWindow(WScreen *scr, Window window)
}
}
/* setup window geometry */
if (win_state && win_state->state->use_geometry) {
width = win_state->state->w;
height = win_state->state->h;
} else {
width = wwin->client.width;
height = wwin->client.height;
}
wWindowConstrainSize(wwin, &width, &height);
resized_client = 0;
if (wwin->client.width != width) {
wwin->client.width = width;
resized_client = 1;
}
if (wwin->client.height != height) {
wwin->client.height = height;
resized_client = 1;
}
/* do not ask for window placement if the window is
* transient, during startup, if the initial workspace is another one
* or if the window wants to
* start iconic.
* If geometry was saved, restore it. */
if (win_state && win_state->state->use_geometry) {
wwin->frame_x = win_state->state->x;
wwin->frame_y = win_state->state->y;
x = win_state->state->x;
y = win_state->state->y;
} else if (wwin->transient_for==None && !scr->flags.startup &&
workspace==scr->current_workspace && !iconic &&
!(wwin->normal_hints->flags & (USPosition|PPosition))) {
PlaceWindow(wwin, &wwin->frame_x, &wwin->frame_y);
} else {
wwin->frame_x = wwin->client.x;
wwin->frame_y = wwin->client.y;
}
PlaceWindow(wwin, &x, &y);
}
if (wwin->window_flags.dont_move_off)
wScreenBringInside(scr, &wwin->frame_x, &wwin->frame_y, width, height);
wScreenBringInside(scr, &x, &y, width, height);
/*
*--------------------------------------------------
@@ -795,15 +791,13 @@ wManageWindow(WScreen *scr, Window window)
foo |= WFF_RESIZEBAR;
wwin->frame = wFrameWindowCreate(scr, window_level,
wwin->frame_x, wwin->frame_y,
width, height, foo,
x, y, width, height, foo,
scr->window_title_texture,
(WTexture**)scr->resizebar_texture,
scr->window_title_pixel,
&scr->window_title_gc,
&scr->title_font);
wwin->frame->flags.is_client_window_frame = 1;
wwin->frame->flags.justification = wPreferences.title_justification;
@@ -838,23 +832,27 @@ wManageWindow(WScreen *scr, Window window)
wwin->frame->on_mousedown_resizebar = resizebarMouseDown;
wwin->client.y += wwin->frame->top_width;
XReparentWindow(dpy, wwin->client_win, wwin->frame->core->window,
0, wwin->frame->top_width);
wClientGetGravityOffsets(wwin, &gx, &gy);
/* set the positio of the frame on screen */
wwin->frame_x += gx * (wwin->old_border_width - FRAME_BORDER_WIDTH);
wwin->frame_y += gy * (wwin->old_border_width - FRAME_BORDER_WIDTH);
/* if gravity is to the south, account for the border sizes */
if (gy > 0)
wwin->frame_y -= wwin->frame->top_width + wwin->frame->bottom_width;
{
int gx, gy;
wClientGetGravityOffsets(wwin, &gx, &gy);
/* set the positio of the frame on screen */
x += gx * FRAME_BORDER_WIDTH;
y += gy * FRAME_BORDER_WIDTH;
/* if gravity is to the south, account for the border sizes */
if (gy > 0)
y -= wwin->frame->top_width + wwin->frame->bottom_width;
}
/*
* force wWindowConfigure() to update the client window's size
* wWindowConfigure() will init the client window's size
* (wwin->client.{width,height}) and all other geometry
* related variables (frame_x,frame_y)
*/
wwin->client.width = 0;
wWindowConfigure(wwin, wwin->frame_x, wwin->frame_y, width, height);
wWindowConfigure(wwin, x, y, width, height);
/*
*--------------------------------------------------
@@ -874,7 +872,7 @@ wManageWindow(WScreen *scr, Window window)
* itself */
leader = wWindowFor(wwin->main_window);
if (leader && leader->main_window==None) {
leader->main_window = leader->client_win;
leader->main_window = leader->client_win;
}
app = wApplicationCreate(scr, wwin->main_window);
@@ -909,11 +907,6 @@ wManageWindow(WScreen *scr, Window window)
XLowerWindow(dpy, window);
/* if window is in this workspace and should be mapped, then map it */
/*
printf("%s %i %i %i %i\n", wwin->wm_class,iconic,workspace == scr->current_workspace,
wwin->flags.hidden,(wwin->wm_hints && (wwin->wm_hints->flags & StateHint)
&& wwin->wm_hints->initial_state == WithdrawnState));
* */
if (!iconic && (workspace == scr->current_workspace
|| wwin->window_flags.omnipresent)
&& !wwin->flags.hidden
@@ -929,7 +922,25 @@ wManageWindow(WScreen *scr, Window window)
wClientSetState(wwin, NormalState, None);
}
if (wPreferences.superfluous && !wPreferences.no_animations
&& !scr->flags.startup && wwin->transient_for==None) {
&& !scr->flags.startup && wwin->transient_for==None
/*
* The brain damaged idiotic non-click to focus modes will
* have trouble with this because:
*
* 1. window is created and mapped by the client
* 2. window is mapped by wmaker in small size
* 3. window is animated to grow to normal size
* 4. this function returns to normal event loop
* 5. eventually, the EnterNotify event that would trigger
* the window focusing (if the mouse is over that window)
* will be processed by wmaker.
* But since this event will be rather delayed
* (step 3 has a large delay) the time when the event ocurred
* and when it is processed, the client that owns that window
* will reject the XSetInputFocus() for it.
*/
&& (wPreferences.focus_mode==WKF_CLICK
|| wPreferences.auto_focus)) {
DoWindowBirth(wwin);
}
XMapSubwindows(dpy, wwin->frame->core->window);
@@ -937,7 +948,7 @@ wManageWindow(WScreen *scr, Window window)
} else {
XMapSubwindows(dpy, wwin->frame->core->window);
}
/* setup stacking descriptor */
if (wPreferences.on_top_transients && wwin->transient_for!=None
&& wwin->transient_for!=scr->root_win) {
@@ -948,7 +959,7 @@ wManageWindow(WScreen *scr, Window window)
} else {
wwin->frame->core->stacking->child_of = NULL;
}
if (!scr->focused_window) {
/* first window on the list */
@@ -967,17 +978,20 @@ wManageWindow(WScreen *scr, Window window)
wwin->prev = NULL;
}
XUngrabServer(dpy);
/*
*--------------------------------------------------
*
*
* Final preparations before window is ready to go
*
*--------------------------------------------------
*
*--------------------------------------------------
*/
wFrameWindowChangeState(wwin->frame, WS_UNFOCUSED);
if (!iconic && workspace == scr->current_workspace) {
WWindow *tmp = wWindowFor(wwin->transient_for);
@@ -987,7 +1001,7 @@ wManageWindow(WScreen *scr, Window window)
wwin->flags.ignore_next_unmap = 1;
}
wWindowResetMouseGrabs(wwin);
if (!wwin->window_flags.no_bind_keys) {
wWindowSetKeyGrabs(wwin);
}
@@ -998,21 +1012,19 @@ wManageWindow(WScreen *scr, Window window)
*/
wwin->flags.mapped=0;
XUngrabServer(dpy);
XSync(dpy, 0);
wColormapInstallForWindow(wwin->screen_ptr, scr->cmap_window);
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_ADD);
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_ADD);
/*
*--------------------------------------------------
* Cleanup temporary stuff
*--------------------------------------------------
*/
if (wstate)
XFree(wstate);
if (win_state)
wDeleteWindowSavedState(win_state);
wWindowDeleteSavedState(win_state);
return wwin;
}
@@ -1341,7 +1353,7 @@ wWindowUnfocus(WWindow *wwin)
void
wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight)
{
XSizeHints *sizeh=wwin->normal_hints;
XSizeHints *sizeh = wwin->normal_hints;
int width = *nwidth;
int height = *nheight;
int winc = sizeh->width_inc;
@@ -1370,8 +1382,8 @@ wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight)
}
} else {
width = (height * sizeh->max_aspect.x) / sizeh->max_aspect.y;
if (width < sizeh->min_width) {
width = sizeh->min_width;
if (width > sizeh->max_width) {
width = sizeh->max_width;
height = (width*sizeh->max_aspect.y) / sizeh->max_aspect.x;
}
}
@@ -1396,27 +1408,21 @@ wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight)
}
}
if (sizeh->base_width != 0)
{
if (sizeh->base_width != 0) {
width = (((width - sizeh->base_width) / winc) * winc)
+ sizeh->base_width;
}
else
{
+ sizeh->base_width;
} else {
width = (((width - sizeh->min_width) / winc) * winc)
+ sizeh->min_width;
}
}
if (sizeh->base_width != 0)
{
if (sizeh->base_width != 0) {
height = (((height - sizeh->base_height) / hinc) * hinc)
+ sizeh->base_height;
}
else
{
} else {
height = (((height - sizeh->min_height) / hinc) * hinc)
+ sizeh->min_height;
}
}
*nwidth = width;
*nheight = height;
@@ -1529,14 +1535,19 @@ int req_width, req_height; /* new size of the client */
if (wwin->window_flags.dont_move_off)
wScreenBringInside(wwin->screen_ptr, &req_x, &req_y,
req_width, req_height);
if (resize) {
if (req_width < MIN_WINDOW_SIZE)
req_width = MIN_WINDOW_SIZE;
if (req_height < MIN_WINDOW_SIZE)
req_height = MIN_WINDOW_SIZE;
XResizeWindow(dpy, wwin->client_win, req_width, req_height);
/* If growing, resize inner part before frame,
* if shrinking, resize frame before.
* This will prevent the frame (that can have a different color)
* to be exposed, causing flicker */
if (req_height > wwin->frame->core->height
|| req_width > wwin->frame->core->width)
XResizeWindow(dpy, wwin->client_win, req_width, req_height);
if (wwin->flags.shaded) {
wFrameWindowResize(wwin->frame, req_width, wwin->frame->core->height);
@@ -1544,6 +1555,10 @@ int req_width, req_height; /* new size of the client */
} else {
wFrameWindowResizeInternal(wwin->frame, req_width, req_height);
}
if (!(req_height > wwin->frame->core->height
|| req_width > wwin->frame->core->width))
XResizeWindow(dpy, wwin->client_win, req_width, req_height);
wwin->client.x = req_x;
wwin->client.y = req_y + wwin->frame->top_width;
@@ -1559,27 +1574,16 @@ int req_width, req_height; /* new size of the client */
}
wwin->frame_x = req_x;
wwin->frame_y = req_y;
#ifdef SHAPE
if (wwin->flags.shaped && resize) {
/*
* Kluge: it seems that without this delay, wmaker will
* use the shape mask of the client before the resize.
* The usleep() should give some time for the client
* to update itself. Wont work all the time, but thats
* better than nothing, I guess...
* There should be a better way of doing this or I'm just
* doing something wrong elsewhere.
*/
XSync(dpy, False);
wusleep(1000);
if (wShapeSupported && wwin->flags.shaped && resize) {
wWindowSetShape(wwin);
XSync(dpy, False);
}
#endif
if (synth_notify)
wWindowSynthConfigureNotify(wwin);
XFlush(dpy);
}
@@ -1745,9 +1749,11 @@ wWindowConfigureBorders(WWindow *wwin)
if (!wwin->window_flags.no_miniaturize_button
&& wwin->frame->flags.hide_left_button)
flags |= WFF_LEFT_BUTTON;
if (!wwin->window_flags.no_close_button
&& wwin->frame->flags.hide_right_button)
flags |= WFF_RIGHT_BUTTON;
if (flags!=0) {
wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, flags);
@@ -1757,11 +1763,19 @@ wWindowConfigureBorders(WWindow *wwin)
if (wwin->window_flags.no_miniaturize_button
&& !wwin->frame->flags.hide_left_button)
flags |= WFF_LEFT_BUTTON;
if (wwin->window_flags.no_close_button
&& !wwin->frame->flags.hide_right_button)
flags |= WFF_RIGHT_BUTTON;
if (flags!=0)
wFrameWindowHideButton(wwin->frame, flags);
#ifdef SHAPE
if (wShapeSupported && wwin->flags.shaped) {
wWindowSetShape(wwin);
}
#endif
}
}
@@ -1769,20 +1783,16 @@ wWindowConfigureBorders(WWindow *wwin)
void
wWindowSaveState(WWindow *wwin)
{
WSavedState state;
/* if (wwin->flags.miniaturized || wwin->flags.hidden) {
state.workspace = 0;
} else {
state.workspace = wwin->frame->workspace;
}*/
state.workspace = wwin->frame->workspace;
state.shaded = wwin->flags.shaded;
state.hidden = wwin->flags.hidden;
CARD32 data[9];
memset(data, 0, sizeof(CARD32)*9);
data[0] = wwin->frame->workspace;
data[2] = wwin->flags.shaded;
data[3] = wwin->flags.hidden;
XChangeProperty(dpy, wwin->client_win, _XA_WINDOWMAKER_STATE,
_XA_WINDOWMAKER_STATE, 32, PropModeReplace,
(unsigned char *) &state, sizeof(WSavedState)/sizeof(int));
(unsigned char *)data, 9);
}
@@ -1793,14 +1803,30 @@ getSavedState(Window window, WSavedState **state)
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
CARD32 *data;
if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0,
sizeof(WSavedState),
if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 9,
True, _XA_WINDOWMAKER_STATE,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)state)!=Success)
(unsigned char **)&data)!=Success || !data)
return 0;
if (type_ret==_XA_WINDOWMAKER_STATE)
*state = malloc(sizeof(WSavedState));
if (*state) {
(*state)->workspace = data[0];
(*state)->miniaturized = data[1];
(*state)->shaded = data[2];
(*state)->hidden = data[3];
(*state)->use_geometry = data[4];
(*state)->x = data[5];
(*state)->y = data[6];
(*state)->w = data[7];
(*state)->h = data[8];
}
XFree(data);
if (*state && type_ret==_XA_WINDOWMAKER_STATE)
return 1;
else
return 0;
@@ -1808,40 +1834,105 @@ getSavedState(Window window, WSavedState **state)
#ifdef SHAPE
void wWindowSetShape(WWindow *wwin)
void
wWindowClearShape(WWindow *wwin)
{
XShapeCombineMask(dpy, wwin->frame->core->window, ShapeBounding,
0, wwin->frame->top_width, None, ShapeSet);
XFlush(dpy);
}
void
wWindowSetShape(WWindow *wwin)
{
XRectangle rect[2];
int count=0;
int count;
#ifdef OPTIMIZE_SHAPE
XRectangle *rects;
XRectangle *urec;
int ordering;
/* only shape is the client's */
if (wwin->window_flags.no_titlebar && wwin->window_flags.no_resizebar) {
goto alt_code;
}
/* Get array of rectangles describing the shape mask */
rects = XShapeGetRectangles(dpy, wwin->client_win, ShapeBounding,
&count, &ordering);
if (!rects) {
goto alt_code;
}
urec = malloc(sizeof(XRectangle)*(count+2));
if (!urec) {
XFree(rects);
goto alt_code;
}
/* insert our decoration rectangles in the rect list */
memcpy(urec, rects, sizeof(XRectangle)*count);
XFree(rects);
XShapeCombineShape(dpy, wwin->frame->core->window, ShapeBounding,
0, wwin->frame->top_width, wwin->client_win,
ShapeBounding, ShapeSet);
if (!wwin->window_flags.no_titlebar) {
rect[count].x = -1;
rect[count].y = -1;
rect[count].width = wwin->frame->core->width+2;
rect[count].height = wwin->frame->top_width+1;
urec[count].x = -1;
urec[count].y = -1 - wwin->frame->top_width;
urec[count].width = wwin->frame->core->width + 2;
urec[count].height = wwin->frame->top_width + 1;
count++;
}
if (!wwin->window_flags.no_resizebar) {
urec[count].x = -1;
urec[count].y = wwin->frame->core->height
- wwin->frame->bottom_width - wwin->frame->top_width;
urec[count].width = wwin->frame->core->width + 2;
urec[count].height = wwin->frame->bottom_width + 1;
count++;
}
/* shape our frame window */
XShapeCombineRectangles(dpy, wwin->frame->core->window, ShapeBounding,
0, wwin->frame->top_width, urec, count,
ShapeSet, Unsorted);
XFlush(dpy);
free(urec);
return;
alt_code:
#endif /* OPTIMIZE_SHAPE */
count = 0;
if (!wwin->window_flags.no_titlebar) {
rect[count].x = -1;
rect[count].y = -1;
rect[count].width = wwin->frame->core->width + 2;
rect[count].height = wwin->frame->top_width + 1;
count++;
}
if (!wwin->window_flags.no_resizebar) {
rect[count].x = -1;
rect[count].y = wwin->frame->core->height - wwin->frame->bottom_width;
rect[count].width = wwin->frame->core->width+2;
rect[count].height = wwin->frame->bottom_width+1;
rect[count].width = wwin->frame->core->width + 2;
rect[count].height = wwin->frame->bottom_width + 1;
count++;
}
XShapeCombineRectangles(dpy,wwin->frame->core->window,ShapeBounding,
0,0,rect,count,ShapeUnion,Unsorted);
if (count > 0) {
XShapeCombineRectangles(dpy, wwin->frame->core->window, ShapeBounding,
0, 0, rect, count, ShapeSet, Unsorted);
}
XShapeCombineShape(dpy, wwin->frame->core->window, ShapeBounding,
0, wwin->frame->top_width, wwin->client_win,
ShapeBounding, (count > 0 ? ShapeUnion : ShapeSet));
XFlush(dpy);
}
#endif
#endif /* SHAPE */
/* ====================================================================== */
static FocusMode
getFocusMode(WWindow *wwin)
{
{
FocusMode mode;
if ((wwin->wm_hints) && (wwin->wm_hints->flags & InputHint)) {
if (wwin->wm_hints->input == True) {
if (wwin->protocols.TAKE_FOCUS)
@@ -1869,8 +1960,8 @@ wWindowSetKeyGrabs(WWindow *wwin)
for (i=0; i<WKBD_LAST; i++) {
key = &wKeyBindings[i];
if (key->keycode==0)
if (key->keycode==0)
continue;
if (key->modifier!=AnyModifier) {
XGrabKey(dpy, key->keycode, key->modifier|LockMask,
@@ -1901,17 +1992,9 @@ wWindowResetMouseGrabs(WWindow *wwin)
if (!wwin->window_flags.no_bind_mouse) {
/* grabs for Meta+drag */
XGrabButton(dpy, AnyButton, MOD_MASK,
wwin->client_win, True, ButtonPressMask, GrabModeSync,
GrabModeAsync, None, wCursor[WCUR_ARROW]);
XGrabButton(dpy, AnyButton, MOD_MASK|LockMask,
wwin->client_win, True, ButtonPressMask, GrabModeSync,
GrabModeAsync, None, wCursor[WCUR_ARROW]);
#ifdef NUMLOCK_HACK
wHackedGrabButton(AnyButton, MOD_MASK, wwin->client_win,
True, ButtonPressMask, GrabModeSync,
GrabModeAsync, None, wCursor[WCUR_ARROW]);
#endif
}
if (!wwin->flags.focused) {
@@ -1941,6 +2024,168 @@ wWindowUpdateGNUstepAttr(WWindow *wwin, GNUstepWMAttributes *attr)
}
WMagicNumber
wWindowAddSavedState(char *instance, char *class, char *command,
pid_t pid, WSavedState *state)
{
WWindowState *wstate;
wstate = malloc(sizeof(WWindowState));
if (!wstate)
return 0;
memset(wstate, 0, sizeof(WWindowState));
wstate->pid = pid;
if (instance)
wstate->instance = wstrdup(instance);
if (class)
wstate->class = wstrdup(class);
if (command)
wstate->command = wstrdup(command);
wstate->state = state;
wstate->next = windowState;
windowState = wstate;
#ifdef DEBUG
printf("Added WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance,
class, command);
#endif
return wstate;
}
#define SAME(x, y) (((x) && (y) && !strcmp((x), (y))) || (!(x) && !(y)))
WMagicNumber
wWindowGetSavedState(Window win)
{
char *instance, *class, *command=NULL;
WWindowState *wstate = windowState;
char **argv;
int argc;
if (!wstate)
return NULL;
if (XGetCommand(dpy, win, &argv, &argc)) {
if (argc > 0)
command = FlattenStringList(argv, argc);
XFreeStringList(argv);
}
if (!command)
return NULL;
if (PropGetWMClass(win, &class, &instance)) {
while (wstate) {
if (SAME(instance, wstate->instance) &&
SAME(class, wstate->class) &&
SAME(command, wstate->command)) {
break;
}
wstate = wstate->next;
}
} else {
wstate = NULL;
}
#ifdef DEBUG
printf("Read WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance,
class, command);
#endif
if (command) free(command);
if (instance) XFree(instance);
if (class) XFree(class);
return wstate;
}
void
wWindowDeleteSavedState(WMagicNumber id)
{
WWindowState *tmp, *wstate=(WWindowState*)id;
if (!wstate || !windowState)
return;
tmp = windowState;
if (tmp==wstate) {
windowState = wstate->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
} else {
while (tmp->next) {
if (tmp->next==wstate) {
tmp->next=wstate->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
break;
}
tmp = tmp->next;
}
}
}
void
wWindowDeleteSavedStatesForPID(pid_t pid)
{
WWindowState *tmp, *wstate;
if (!windowState)
return;
tmp = windowState;
if (tmp->pid == pid) {
wstate = windowState;
windowState = tmp->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
} else {
while (tmp->next) {
if (tmp->next->pid==pid) {
wstate = tmp->next;
tmp->next = wstate->next;
#ifdef DEBUG
printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n",
wstate, wstate->instance, wstate->class, wstate->command);
#endif
if (wstate->instance) free(wstate->instance);
if (wstate->class) free(wstate->class);
if (wstate->command) free(wstate->command);
free(wstate->state);
free(wstate);
break;
}
tmp = tmp->next;
}
}
}
/* ====================================================================== */
@@ -1972,6 +2217,7 @@ resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
if (event->xbutton.state & MOD_MASK) {
/* move the window */
#if 0
if (XGrabPointer(dpy, wwin->frame->resizebar->window, True,
ButtonMotionMask|ButtonReleaseMask|ButtonPressMask,
GrabModeAsync, GrabModeAsync, None,
@@ -1981,11 +2227,13 @@ resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
#endif
return;
}
#endif
wMouseMoveWindow(wwin, event);
XUngrabPointer(dpy, CurrentTime);
} else {
#if 0
/* resize the window */
if (XGrabPointer(dpy, wwin->frame->resizebar->window, False,
if (XGrabPointer(dpy, wwin->frame->resizebar->window, True,
ButtonMotionMask|ButtonReleaseMask|ButtonPressMask,
GrabModeAsync, GrabModeAsync, None,
None, CurrentTime)!=GrabSuccess) {
@@ -1994,6 +2242,7 @@ resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
#endif
return;
}
#endif
wMouseResizeWindow(wwin, event);
XUngrabPointer(dpy, CurrentTime);
}
@@ -2096,7 +2345,7 @@ titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
"Turn it off or some mouse actions and keyboard shortcuts will not work."));
}
#endif
event->xbutton.state &= ValidModMask;
@@ -2122,7 +2371,8 @@ titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
wSelectWindow(wwin);
return;
}
if (XGrabPointer(dpy, wwin->frame->titlebar->window, False,
#if 0
if (XGrabPointer(dpy, wwin->frame->titlebar->window, False,
ButtonMotionMask|ButtonReleaseMask|ButtonPressMask,
GrabModeAsync, GrabModeAsync, None,
None, CurrentTime)!=GrabSuccess) {
@@ -2131,6 +2381,7 @@ titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
#endif
return;
}
#endif
/* move the window */
wMouseMoveWindow(wwin, event);
XUngrabPointer(dpy, CurrentTime);
@@ -2195,7 +2446,7 @@ windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event)
CloseWindowMenu(wwin->screen_ptr);
if (wwin->protocols.MINIATURIZE_WINDOW && event->xbutton.state==0) {
wClientSendProtocol(wwin, _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW,
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
LastTimestamp);
} else {
WApplication *wapp;
+30 -3
View File
@@ -1,5 +1,5 @@
/*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -128,6 +128,9 @@ typedef struct {
/* WindowMaker specific */
unsigned int MINIATURIZE_WINDOW:1;
#ifdef MONITOR_HEARTBEAT
unsigned int HEARTBEAT:1;
#endif
} WProtocols;
@@ -184,6 +187,9 @@ typedef struct WWindow {
FocusMode focus_mode; /* type of keyboard input focus */
#ifdef MONITOR_HEARTBEAT
time_t last_beat;
#endif
struct {
/* state flags */
unsigned int mapped:1;
@@ -219,19 +225,25 @@ typedef struct WWindow {
unsigned int destroyed:1; /* window was already destroyed */
} flags; /* state of the window */
char *icon_text;
struct WIcon *icon; /* icon info for the window */
int icon_x, icon_y; /* position of the icon */
} WWindow;
/*
* Changes to this must update wWindowSaveState/getSavedState
*
*/
typedef struct WSavedState {
int workspace;
int miniaturized;
int shaded;
int hidden;
int use_geometry;
int x, y, w, h;
int x;
int y;
unsigned int w;
unsigned int h;
} WSavedState;
@@ -245,11 +257,16 @@ typedef struct WWindowState {
} WWindowState;
typedef void* WMagicNumber;
void wWindowDestroy(WWindow *wwin);
WWindow *wWindowCreate();
#ifdef SHAPE
void wWindowSetShape(WWindow *wwin);
void wWindowClearShape(WWindow *wwin);
#endif
WWindow *wManageWindow(WScreen *scr, Window window);
@@ -293,4 +310,14 @@ void wWindowMap(WWindow *wwin);
Bool wWindowCanReceiveFocus(WWindow *wwin);
void wWindowDeleteSavedStatesForPID(pid_t pid);
WMagicNumber wWindowAddSavedState(char *instance, char *class, char *command,
pid_t pid, WSavedState *state);
WMagicNumber wWindowGetSavedState(Window win);
void wWindowDeleteSavedState(WMagicNumber id);
#endif
+3 -3
View File
@@ -1,6 +1,6 @@
/* winmenu.c - command menu for windows
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -60,7 +60,7 @@
/**** Global data ***/
extern Time LastTimestamp;
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern WShortKey wKeyBindings[WKBD_LAST];
@@ -92,7 +92,7 @@ execMenuCommand(WMenu *menu, WMenuEntry *entry)
break;
case MC_MINIATURIZE:
if (wwin->protocols.MINIATURIZE_WINDOW) {
wClientSendProtocol(wwin, _XA_WINDOWMAKER_WM_MINIATURIZE_WINDOW,
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
LastTimestamp);
} else {
wIconifyWindow(wwin);
+11 -4
View File
@@ -1,6 +1,6 @@
/* winspector.c - window attribute inspector
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -291,7 +291,7 @@ showIconFor(WMScreen *scrPtr, InspectorPanel *panel,
buf = wmalloc(strlen(file)+80);
sprintf(buf, _("Could not open specified icon \"%s\":%s"),
file, RErrorString);
file, RMessageForError(RErrorCode));
wMessageDialog(panel->frame->screen_ptr, _("Error"), buf,
_("OK"), NULL, NULL);
free(buf);
@@ -936,10 +936,14 @@ textEditedObserver(void *observerData, WMNotification *notification)
if ((int)WMGetNotificationClientData(notification) != WMReturnTextMovement)
return;
showIconFor(WMWidgetScreen(panel->win), panel, NULL, NULL, USE_TEXT_FIELD);
if (observerData == panel->fileText) {
showIconFor(WMWidgetScreen(panel->win), panel, NULL, NULL,
USE_TEXT_FIELD);
/*
WMPerformButtonClick(panel->updateIconBtn);
WMPerformButtonClick(panel->updateIconBtn);
*/
} else
WMPerformButtonClick(panel->setRb);
}
static InspectorPanel*
@@ -1242,6 +1246,9 @@ createInspectorForWindow(WWindow *wwin)
panel->wsText = WMCreateTextField(panel->wsFrm);
WMMoveWidget(panel->wsText, 30, 40);
WMResizeWidget(panel->wsText, PWIDTH - (2 * 15) - 25 - 10 - (2 * 5), 20);
WMAddNotificationObserver(textEditedObserver, panel,
WMTextDidEndEditingNotification,
panel->wsText);
i = wDefaultGetStartWorkspace(wwin->screen_ptr, wwin->wm_instance,
+1 -1
View File
@@ -1,6 +1,6 @@
/* winspector.h - window attribute inspector header file
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+5 -1
View File
@@ -1,6 +1,6 @@
/* workspace.c- Workspace management
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
@@ -182,6 +182,10 @@ wWorkspaceDelete(WScreen *scr, int workspace)
void
wWorkspaceChange(WScreen *scr, int workspace)
{
if (scr->flags.startup || scr->flags.startup2) {
return;
}
if (workspace != scr->current_workspace) {
wWorkspaceForceChange(scr, workspace);
}
+1 -1
View File
@@ -1,6 +1,6 @@
/* workspace.c- Workspace management
*
* WindowMaker window manager
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
+5 -2
View File
@@ -30,8 +30,9 @@
#include "xutil.h"
#include <WUtil.h>
#if 0
static Atom Clipboard=0;
#endif
static char *requestCodes[] = {
"DUMMY",
@@ -169,7 +170,7 @@ FormatXError(Display *dpy, XErrorEvent *error, char *buffer, int size)
return;
buffer += i;
if (error->request_code >= sizeof(requestCodes)/sizeof(char*)) {
sprintf(buffer, "\n Unknown request code: %i\n",
sprintf(buffer, "\n Request code: %i\n",
error->request_code);
} else {
sprintf(buffer, "\n Request code: %i %s\n", error->request_code,
@@ -194,6 +195,7 @@ FormatXError(Display *dpy, XErrorEvent *error, char *buffer, int size)
}
#if 0
/*
*----------------------------------------------------------------------
* GetSelection--
@@ -231,3 +233,4 @@ GetSelection(Display *dpy, Window requestor)
}
}
#endif