mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
more dnd changes
window cycling stuff finnish pot files
This commit is contained in:
@@ -6,6 +6,11 @@ Changes since version 0.62.0:
|
||||
- added check for XInternAtoms in configure and replacement code
|
||||
- fixed window cycling with single key shortcut
|
||||
- fixed WPrefs crash on menu editor
|
||||
- install only needed icons for WPrefs.app
|
||||
- updated Finnish translations
|
||||
- fixed user-whining-windoze-cycling bug
|
||||
- added option for f'n windoze cycling..
|
||||
- added --create-stdcmap and made std colormap creation off by default
|
||||
|
||||
Changes since version 0.61.1:
|
||||
.............................
|
||||
|
||||
3
INSTALL
3
INSTALL
@@ -205,9 +205,6 @@ To get a list of other options, run ./configure --help
|
||||
--disable-shape
|
||||
disables shaped windows (for oclock, xeyes etc.)
|
||||
|
||||
--enable-debug
|
||||
Do not use it unless you know what you're doing.
|
||||
|
||||
|
||||
PLATFORM SPECIFIC NOTES:
|
||||
========================
|
||||
|
||||
@@ -402,6 +402,7 @@ typedef void WMAction2(void *self, void *clientData);
|
||||
|
||||
typedef void WMCallback(void *data);
|
||||
|
||||
typedef void WMDropDataCallback(WMView *view, WMData *data);
|
||||
|
||||
/* delegate method like stuff */
|
||||
typedef void WMListDrawProc(WMList *lPtr, int index, Drawable d, char *text,
|
||||
@@ -509,9 +510,8 @@ typedef struct W_DragDestinationProcs {
|
||||
unsigned (*draggingEntered)(WMView *self, WMDraggingInfo *info);
|
||||
unsigned (*draggingUpdated)(WMView *self, WMDraggingInfo *info);
|
||||
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
|
||||
char *(*prepareForDragOperation)(WMView *self, WMDraggingInfo *info);
|
||||
Bool (*performDragOperation)(WMView *self, WMDraggingInfo *info,
|
||||
WMData *data);
|
||||
Bool (*prepareForDragOperation)(WMView *self, WMDraggingInfo *info);
|
||||
Bool (*performDragOperation)(WMView *self, WMDraggingInfo *info);
|
||||
void (*concludeDragOperation)(WMView *self, WMDraggingInfo *info);
|
||||
} WMDragDestinationProcs;
|
||||
|
||||
|
||||
@@ -454,6 +454,10 @@ void W_SetViewBackgroundColor(W_View *view, WMColor *color);
|
||||
void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
unsigned int height, WMReliefType relief);
|
||||
|
||||
void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
||||
unsigned int width, unsigned int height,
|
||||
WMReliefType relief,
|
||||
GC black, GC dark, GC light, GC white);
|
||||
|
||||
void W_CleanUpEvents(W_View *view);
|
||||
|
||||
|
||||
@@ -108,13 +108,12 @@ static void defDraggingExited(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
static char* defPrepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
static Bool defPrepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return NULL;
|
||||
return False;
|
||||
}
|
||||
|
||||
static Bool defPerformDragOperation(WMView *self, WMDraggingInfo *info,
|
||||
WMData *data)
|
||||
static Bool defPerformDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
@@ -168,3 +167,49 @@ WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info)
|
||||
{
|
||||
return info->imageLocation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
|
||||
void *cdata, WMData *data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool WMRequestDroppedData(WMView *view, WMDraggingInfo *info, char *type,
|
||||
WMDropDataCallback *callback)
|
||||
{
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
#if 0
|
||||
if (info->finished) {
|
||||
return False;
|
||||
}
|
||||
|
||||
if (type != NULL) {
|
||||
if (!WMRequestSelection(scr->dragInfo.destView,
|
||||
scr->xdndSelectionAtom,
|
||||
XInternAtom(scr->display, type, False),
|
||||
scr->dragInfo.timestamp,
|
||||
receivedData, &scr->dragInfo)) {
|
||||
wwarning("could not request data for dropped data");
|
||||
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -261,8 +261,6 @@ lookForToplevel(WMScreen *scr, Window window, Bool *isAware)
|
||||
}
|
||||
|
||||
XFree(children);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
@@ -1093,7 +1091,7 @@ receivedData(WMView *view, Atom selection, Atom target,
|
||||
WMDraggingInfo *info = (WMDraggingInfo*)cdata;
|
||||
Bool res;
|
||||
|
||||
res = view->dragDestinationProcs->performDragOperation(view, info, data);
|
||||
res = view->dragDestinationProcs->performDragOperation(view, info);
|
||||
|
||||
if (res) {
|
||||
DISPATCH(view, concludeDragOperation, info);
|
||||
@@ -1297,30 +1295,16 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||
|
||||
case WDrop:
|
||||
{
|
||||
char *type;
|
||||
Bool res;
|
||||
|
||||
type = DISPATCH(oldView, prepareForDragOperation, &scr->dragInfo);
|
||||
res = DISPATCH(oldView, prepareForDragOperation, &scr->dragInfo);
|
||||
|
||||
if (type != NULL) {
|
||||
if (!WMRequestSelection(scr->dragInfo.destView,
|
||||
scr->xdndSelectionAtom,
|
||||
XInternAtom(scr->display, type, False),
|
||||
scr->dragInfo.timestamp,
|
||||
receivedData, &scr->dragInfo)) {
|
||||
wwarning("could not request data for dropped data");
|
||||
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
if (res) {
|
||||
res = DISPATCH(oldView, performDragOperation, &scr->dragInfo);
|
||||
}
|
||||
} else {
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
|
||||
if (res) {
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -72,6 +72,7 @@ paintFrame(Frame *fPtr)
|
||||
W_Screen *scrPtr = view->screen;
|
||||
int tx, ty, tw, th;
|
||||
int fy, fh;
|
||||
Bool drawTitle;
|
||||
|
||||
if (fPtr->caption!=NULL)
|
||||
th = WMFontHeight(scrPtr->normalFont);
|
||||
@@ -124,26 +125,65 @@ paintFrame(Frame *fPtr)
|
||||
fy = 0;
|
||||
fh = view->size.height;
|
||||
}
|
||||
/*
|
||||
XClearArea(scrPtr->display, view->window, fy+2, 2, fh-4, view->size.width-4,
|
||||
False);
|
||||
*/
|
||||
XClearWindow(scrPtr->display, view->window);
|
||||
|
||||
W_DrawRelief(scrPtr, view->window, 0, fy, view->size.width, fh,
|
||||
fPtr->flags.relief);
|
||||
|
||||
if (fPtr->caption!=NULL && fPtr->flags.titlePosition!=WTPNoTitle) {
|
||||
|
||||
|
||||
tw = WMWidthOfString(scrPtr->normalFont, fPtr->caption,
|
||||
strlen(fPtr->caption));
|
||||
|
||||
tx = (view->size.width - tw) / 2;
|
||||
|
||||
XFillRectangle(scrPtr->display, view->window, WMColorGC(scrPtr->gray),
|
||||
tx, ty, tw, th);
|
||||
drawTitle = True;
|
||||
} else {
|
||||
drawTitle = False;
|
||||
}
|
||||
|
||||
/* XClearArea(scrPtr->display, view->window, x, y, width, height, False);
|
||||
*/
|
||||
|
||||
{
|
||||
XRectangle rect;
|
||||
Region region, tmp;
|
||||
GC gc[4];
|
||||
int i;
|
||||
|
||||
region = XCreateRegion();
|
||||
|
||||
if (drawTitle) {
|
||||
tmp = XCreateRegion();
|
||||
rect.x = tx;
|
||||
rect.y = ty;
|
||||
rect.width = tw;
|
||||
rect.height = th;
|
||||
XUnionRectWithRegion(&rect, tmp, tmp);
|
||||
}
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = view->size.width;
|
||||
rect.height = view->size.height;
|
||||
XUnionRectWithRegion(&rect, region, region);
|
||||
if (drawTitle) {
|
||||
XSubtractRegion(region, tmp, region);
|
||||
XDestroyRegion(tmp);
|
||||
}
|
||||
gc[0] = WMColorGC(scrPtr->black);
|
||||
gc[1] = WMColorGC(scrPtr->darkGray);
|
||||
gc[2] = WMColorGC(scrPtr->gray);
|
||||
gc[3] = WMColorGC(scrPtr->white);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
XSetRegion(scrPtr->display, gc[i], region);
|
||||
}
|
||||
XDestroyRegion(region);
|
||||
|
||||
W_DrawReliefWithGC(scrPtr, view->window, 0, fy, view->size.width, fh,
|
||||
fPtr->flags.relief, gc[0], gc[1], gc[2], gc[3]);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
XSetClipMask(scrPtr->display, gc[i], None);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawTitle) {
|
||||
WMDrawString(scrPtr, view->window, WMColorGC(scrPtr->black),
|
||||
scrPtr->normalFont, tx, ty, fPtr->caption,
|
||||
strlen(fPtr->caption));
|
||||
@@ -163,8 +203,7 @@ handleEvents(XEvent *event, void *data)
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
if (event->xexpose.count!=0)
|
||||
break;
|
||||
if (event->xexpose.count == 0)
|
||||
paintFrame(fPtr);
|
||||
break;
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
void
|
||||
W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
unsigned int height, WMReliefType relief)
|
||||
{
|
||||
W_DrawReliefWithGC(scr, d, x, y, width, height, relief,
|
||||
WMColorGC(scr->black), WMColorGC(scr->darkGray),
|
||||
WMColorGC(scr->gray), WMColorGC(scr->white));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
unsigned int height, WMReliefType relief,
|
||||
GC black, GC dark, GC light, GC white)
|
||||
{
|
||||
Display *dpy = scr->display;
|
||||
GC bgc;
|
||||
@@ -17,37 +28,36 @@ W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
|
||||
switch (relief) {
|
||||
case WRSimple:
|
||||
XDrawRectangle(dpy, d, WMColorGC(scr->black), x, y, width-1, height-1);
|
||||
XDrawRectangle(dpy, d, black, x, y, width-1, height-1);
|
||||
return;
|
||||
break;
|
||||
|
||||
case WRRaised:
|
||||
bgc = WMColorGC(scr->black);
|
||||
dgc = WMColorGC(scr->darkGray);
|
||||
wgc = WMColorGC(scr->white);
|
||||
lgc = WMColorGC(scr->gray);
|
||||
bgc = black;
|
||||
dgc = dark;
|
||||
wgc = white;
|
||||
lgc = light;
|
||||
break;
|
||||
|
||||
case WRSunken:
|
||||
wgc = WMColorGC(scr->darkGray);
|
||||
lgc = WMColorGC(scr->black);
|
||||
bgc = WMColorGC(scr->white);
|
||||
dgc = WMColorGC(scr->gray);
|
||||
wgc = dark;
|
||||
lgc = black;
|
||||
bgc = white;
|
||||
dgc = light;
|
||||
break;
|
||||
|
||||
case WRPushed:
|
||||
lgc = wgc = WMColorGC(scr->black);
|
||||
dgc = bgc = WMColorGC(scr->white);
|
||||
lgc = wgc = black;
|
||||
dgc = bgc = white;
|
||||
break;
|
||||
|
||||
case WRRidge:
|
||||
lgc = bgc = WMColorGC(scr->darkGray);
|
||||
dgc = wgc = WMColorGC(scr->white);
|
||||
lgc = bgc = dark;
|
||||
dgc = wgc = white;
|
||||
break;
|
||||
|
||||
case WRGroove:
|
||||
wgc = dgc = WMColorGC(scr->darkGray);
|
||||
lgc = bgc = WMColorGC(scr->white);
|
||||
wgc = dgc = dark;
|
||||
lgc = bgc = white;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -77,6 +87,8 @@ W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
fitText(char *text, WMFont *font, int width, int wrap)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,50 @@ testFontPanel(WMScreen *scr)
|
||||
|
||||
|
||||
|
||||
void
|
||||
testFrame(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMFrame *frame;
|
||||
int i;
|
||||
static char* titles[] = {
|
||||
"AboveTop",
|
||||
"AtTop",
|
||||
"BelowTop",
|
||||
"AboveBottom",
|
||||
"AtBottom",
|
||||
"BelowBottom"
|
||||
};
|
||||
static WMTitlePosition pos[] = {
|
||||
WTPAboveTop,
|
||||
WTPAtTop,
|
||||
WTPBelowTop,
|
||||
WTPAboveBottom,
|
||||
WTPAtBottom,
|
||||
WTPBelowBottom
|
||||
};
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testFrame");
|
||||
WMSetWindowTitle(win, "Frame");
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
WMResizeWidget(win, 400, 300);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
frame = WMCreateFrame(win);
|
||||
WMMoveWidget(frame, 8+(i%3)*130, 8+(i/3)*130);
|
||||
WMResizeWidget(frame, 120, 120);
|
||||
WMSetFrameTitle(frame, titles[i]);
|
||||
WMSetFrameTitlePosition(frame, pos[i]);
|
||||
}
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
testList(WMScreen *scr)
|
||||
{
|
||||
@@ -812,7 +856,6 @@ Bool performDragOperation(WMView *self, WMDraggingInfo *info,
|
||||
|
||||
void concludeDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
puts("concluded");
|
||||
|
||||
}
|
||||
|
||||
@@ -955,7 +998,7 @@ int main(int argc, char **argv)
|
||||
* Do NOT use it unless when debugging. It will cause a major
|
||||
* slowdown in your application
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
#if 1
|
||||
XSynchronize(dpy, True);
|
||||
#endif
|
||||
/*
|
||||
@@ -984,6 +1027,9 @@ int main(int argc, char **argv)
|
||||
testDragAndDrop(scr);
|
||||
|
||||
#if 0
|
||||
testFrame(scr);
|
||||
|
||||
|
||||
testColorWell(scr);
|
||||
|
||||
testTabView(scr);
|
||||
|
||||
@@ -51,8 +51,9 @@ showData(_Panel *panel)
|
||||
WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
|
||||
WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
|
||||
WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
|
||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("DisableBlinking"));
|
||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("WindowsCycling"));
|
||||
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
|
||||
WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +67,7 @@ createPanel(Panel *p)
|
||||
WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
|
||||
WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
|
||||
|
||||
for (i=0; i<6; i++) {
|
||||
for (i=0; i<7; i++) {
|
||||
panel->swi[i] = WMCreateSwitchButton(panel->frame);
|
||||
WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
|
||||
WMMoveWidget(panel->swi[i], 20, 20+i*25);
|
||||
@@ -76,8 +77,9 @@ createPanel(Panel *p)
|
||||
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)"));
|
||||
WMSetButtonText(panel->swi[2], _("Automatically save session when exiting WindowMaker"));
|
||||
WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects"));
|
||||
WMSetButtonText(panel->swi[4], _("Disable cycling color highlighting of icons."));
|
||||
WMSetButtonText(panel->swi[5], _("Disable confirmation panel for the Kill command."));
|
||||
WMSetButtonText(panel->swi[4], _("Use Windoze style cycling"));
|
||||
WMSetButtonText(panel->swi[5], _("Disable confirmation panel for the Kill command"));
|
||||
WMSetButtonText(panel->swi[6], _("Disable cycling color highlighting of icons"));
|
||||
|
||||
WMRealizeWidget(panel->frame);
|
||||
WMMapSubwidgets(panel->frame);
|
||||
@@ -97,8 +99,9 @@ storeDefaults(_Panel *panel)
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DisableBlinking");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "WindowsCycling");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
|
||||
}
|
||||
|
||||
|
||||
|
||||
16
configure.in
16
configure.in
@@ -746,22 +746,6 @@ dnl End of Graphic Format Libraries
|
||||
dnl ==============================================
|
||||
|
||||
|
||||
dnl Debugging setup
|
||||
dnl ===============
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug enable debugging ],, enable_debug=no)
|
||||
|
||||
if test "$enable_debug" = yes; then
|
||||
DFLAGS="-g -DDEBUG"
|
||||
# Efence makes things too slow. Add it by hand in the Makefiles
|
||||
# if it is really needed.
|
||||
# AC_CHECK_LIB(efence, malloc, LIBS="$LIBS -lefence")
|
||||
else
|
||||
DFLAGS="-DWITHOUT_NANA"
|
||||
fi
|
||||
AC_SUBST(DFLAGS)
|
||||
|
||||
|
||||
dnl Sound support - Dan
|
||||
dnl =============================================
|
||||
sound=yes
|
||||
|
||||
@@ -24,6 +24,7 @@ wmaker_SOURCES = \
|
||||
client.c \
|
||||
client.h \
|
||||
colormap.c \
|
||||
cycling.c \
|
||||
def_pixmaps.h \
|
||||
defaults.c \
|
||||
defaults.h \
|
||||
|
||||
@@ -103,7 +103,7 @@ bin_PROGRAMS = wmaker
|
||||
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h DI.h DL.h I.h L.h Q.h GDB.h nana.h
|
||||
|
||||
|
||||
wmaker_SOURCES = GNUstep.h WindowMaker.h actions.c actions.h appicon.c appicon.h application.c application.h appmenu.c appmenu.h balloon.c balloon.h client.c client.h colormap.c def_pixmaps.h defaults.c defaults.h dialog.c dialog.h dock.c dockedapp.c dock.h event.c extend_pixmaps.h framewin.c framewin.h geomview.c geomview.h gnome.c gnome.h funcs.h icon.c icon.h keybind.h kwm.h kwm.c main.c menu.c menu.h misc.c motif.c motif.h moveres.c openlook.c openlook.h pixmap.c pixmap.h placement.c plugin.c plugin.h properties.c properties.h proplist.c resources.c resources.h rootmenu.c screen.c screen.h session.h session.c shutdown.c stacking.c stacking.h startup.c superfluous.c superfluous.h switchmenu.c texture.c texture.h usermenu.c usermenu.h xdnd.h xdnd.c xmodifier.h xmodifier.c xutil.c xutil.h wconfig.h wcore.c wcore.h wdefaults.c wdefaults.h window.c window.h winmenu.c winspector.h winspector.c workspace.c workspace.h wmsound.c wmsound.h text.c text.h
|
||||
wmaker_SOURCES = GNUstep.h WindowMaker.h actions.c actions.h appicon.c appicon.h application.c application.h appmenu.c appmenu.h balloon.c balloon.h client.c client.h colormap.c cycling.c def_pixmaps.h defaults.c defaults.h dialog.c dialog.h dock.c dockedapp.c dock.h event.c extend_pixmaps.h framewin.c framewin.h geomview.c geomview.h gnome.c gnome.h funcs.h icon.c icon.h keybind.h kwm.h kwm.c main.c menu.c menu.h misc.c motif.c motif.h moveres.c openlook.c openlook.h pixmap.c pixmap.h placement.c plugin.c plugin.h properties.c properties.h proplist.c resources.c resources.h rootmenu.c screen.c screen.h session.h session.c shutdown.c stacking.c stacking.h startup.c superfluous.c superfluous.h switchmenu.c texture.c texture.h usermenu.c usermenu.h xdnd.h xdnd.c xmodifier.h xmodifier.c xutil.c xutil.h wconfig.h wcore.c wcore.h wdefaults.c wdefaults.h window.c window.h winmenu.c winspector.h winspector.c workspace.c workspace.h wmsound.c wmsound.h text.c text.h
|
||||
|
||||
|
||||
CPPFLAGS = @CPPFLAGS@ @DFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
|
||||
@@ -126,9 +126,9 @@ X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
wmaker_OBJECTS = actions.o appicon.o application.o appmenu.o balloon.o \
|
||||
client.o colormap.o defaults.o dialog.o dock.o dockedapp.o event.o \
|
||||
framewin.o geomview.o gnome.o icon.o kwm.o main.o menu.o misc.o motif.o \
|
||||
moveres.o openlook.o pixmap.o placement.o plugin.o properties.o \
|
||||
client.o colormap.o cycling.o defaults.o dialog.o dock.o dockedapp.o \
|
||||
event.o framewin.o geomview.o gnome.o icon.o kwm.o main.o menu.o misc.o \
|
||||
motif.o moveres.o openlook.o pixmap.o placement.o plugin.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 usermenu.o \
|
||||
xdnd.o xmodifier.o xutil.o wcore.o wdefaults.o window.o winmenu.o \
|
||||
|
||||
@@ -308,6 +308,7 @@ typedef struct WPreferences {
|
||||
char constrain_window_size; /* don't let windows get bigger than
|
||||
* screen */
|
||||
|
||||
char windows_cycling; /* windoze cycling */
|
||||
char circ_raise; /* raise window after Alt-tabbing */
|
||||
|
||||
char ignore_focus_click;
|
||||
@@ -426,6 +427,7 @@ typedef struct WPreferences {
|
||||
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
|
||||
unsigned int noautolaunch:1; /* don't autolaunch apps */
|
||||
unsigned int norestore:1; /* don't restore session */
|
||||
unsigned int createstdcmap:1; /* create std colormap */
|
||||
} flags; /* internal flags */
|
||||
} WPreferences;
|
||||
|
||||
|
||||
312
src/cycling.c
Normal file
312
src/cycling.c
Normal file
@@ -0,0 +1,312 @@
|
||||
/* cycling.c- window cycling
|
||||
*
|
||||
* Window Maker window manager
|
||||
*
|
||||
* Copyright (c) 2000 Alfredo K. Kojima
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "GNUstep.h"
|
||||
#include "screen.h"
|
||||
#include "wcore.h"
|
||||
#include "window.h"
|
||||
#include "framewin.h"
|
||||
#include "keybind.h"
|
||||
#include "actions.h"
|
||||
#include "stacking.h"
|
||||
#include "funcs.h"
|
||||
|
||||
/* Globals */
|
||||
extern WPreferences wPreferences;
|
||||
|
||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static WWindow*
|
||||
nextToFocusAfter(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->prev;
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
tmp = wwin;
|
||||
/* start over from the beginning of the list */
|
||||
while (tmp->next)
|
||||
tmp = tmp->next;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
static WWindow*
|
||||
nextToFocusBefore(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->next;
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
/* start over from the beginning of the list */
|
||||
tmp = wwin;
|
||||
while (tmp->prev)
|
||||
tmp = tmp->prev;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
{
|
||||
WScreen *scr = wScreenForRootWindow(event->xkey.root);
|
||||
Bool done = False;
|
||||
Bool openedSwitchMenu = False;
|
||||
WWindow *newFocused;
|
||||
WWindow *oldFocused;
|
||||
int modifiers;
|
||||
XModifierKeymap *keymap;
|
||||
Bool somethingElse = False;
|
||||
XEvent ev;
|
||||
|
||||
if (!wwin)
|
||||
return;
|
||||
|
||||
keymap = XGetModifierMapping(dpy);
|
||||
|
||||
|
||||
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime);
|
||||
|
||||
if (next) {
|
||||
newFocused = nextToFocusAfter(wwin);
|
||||
} else {
|
||||
newFocused = nextToFocusBefore(wwin);
|
||||
}
|
||||
|
||||
scr->flags.doing_alt_tab = 1;
|
||||
|
||||
|
||||
if (wPreferences.circ_raise)
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
wWindowFocus(newFocused, scr->focused_window);
|
||||
oldFocused = newFocused;
|
||||
|
||||
#if 0
|
||||
if (wPreferences.popup_switchmenu &&
|
||||
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
||||
|
||||
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
|
||||
openedSwitchMenu = True;
|
||||
}
|
||||
#endif
|
||||
while (!done) {
|
||||
WMMaskEvent(dpy,KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
|
||||
|
||||
if (ev.type != KeyRelease && ev.type != KeyPress) {
|
||||
WMHandleEvent(&ev);
|
||||
continue;
|
||||
}
|
||||
/* ignore CapsLock */
|
||||
modifiers = ev.xkey.state & ValidModMask;
|
||||
|
||||
if (ev.type == KeyPress) {
|
||||
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
newFocused = nextToFocusAfter(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
}
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
|
||||
} else if (wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers) {
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
newFocused = nextToFocusBefore(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
}
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
|
||||
} else {
|
||||
somethingElse = True;
|
||||
done = True;
|
||||
}
|
||||
} else if (ev.type == KeyRelease) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
||||
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
||||
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
||||
& 1<<(i/keymap->max_keypermod)) {
|
||||
done = True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
XFreeModifiermap(keymap);
|
||||
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
wSetFocusTo(scr, newFocused);
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
wRaiseFrame(newFocused->frame->core);
|
||||
CommitStacking(scr);
|
||||
}
|
||||
|
||||
scr->flags.doing_alt_tab = 0;
|
||||
if (openedSwitchMenu)
|
||||
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
|
||||
|
||||
if (somethingElse) {
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static WWindow*
|
||||
nextFocusWindow(WScreen *scr)
|
||||
{
|
||||
WWindow *tmp, *wwin, *closest, *min;
|
||||
Window d;
|
||||
|
||||
if (!(wwin = scr->focused_window))
|
||||
return NULL;
|
||||
tmp = wwin->prev;
|
||||
closest = NULL;
|
||||
min = wwin;
|
||||
d = 0xffffffff;
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp)
|
||||
&& (!WFLAGP(tmp, skip_window_list)|| tmp->flags.internal_window)) {
|
||||
if (min->client_win > tmp->client_win)
|
||||
min = tmp;
|
||||
if (tmp->client_win > wwin->client_win
|
||||
&& (!closest
|
||||
|| (tmp->client_win - wwin->client_win) < d)) {
|
||||
closest = tmp;
|
||||
d = tmp->client_win - wwin->client_win;
|
||||
}
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
if (!closest||closest==wwin)
|
||||
return min;
|
||||
return closest;
|
||||
}
|
||||
|
||||
|
||||
static WWindow*
|
||||
prevFocusWindow(WScreen *scr)
|
||||
{
|
||||
WWindow *tmp, *wwin, *closest, *max;
|
||||
Window d;
|
||||
|
||||
if (!(wwin = scr->focused_window))
|
||||
return NULL;
|
||||
tmp = wwin->prev;
|
||||
closest = NULL;
|
||||
max = wwin;
|
||||
d = 0xffffffff;
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) &&
|
||||
(!WFLAGP(tmp, skip_window_list) || tmp->flags.internal_window)) {
|
||||
if (max->client_win < tmp->client_win)
|
||||
max = tmp;
|
||||
if (tmp->client_win < wwin->client_win
|
||||
&& (!closest
|
||||
|| (wwin->client_win - tmp->client_win) < d)) {
|
||||
closest = tmp;
|
||||
d = wwin->client_win - tmp->client_win;
|
||||
}
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
if (!closest||closest==wwin)
|
||||
return max;
|
||||
return closest;
|
||||
}
|
||||
|
||||
|
||||
void CycleWindow(WScreen *scr, Bool forward)
|
||||
{
|
||||
WWindow *wwin;
|
||||
|
||||
if (forward)
|
||||
wwin = nextFocusWindow(scr);
|
||||
else
|
||||
wwin = prevFocusWindow(scr);
|
||||
|
||||
if (wwin != NULL)
|
||||
wSetFocusTo(scr, wwin);
|
||||
}
|
||||
|
||||
@@ -405,6 +405,9 @@ WDefaultEntry optionList[] = {
|
||||
{"RaiseDelay", "0", NULL,
|
||||
&wPreferences.raise_delay, getInt, NULL
|
||||
},
|
||||
{"WindowsCycling", "YES", NULL,
|
||||
&wPreferences.windows_cycling,getBool, NULL
|
||||
},
|
||||
{"CirculateRaise", "NO", NULL,
|
||||
&wPreferences.circ_raise, getBool, NULL
|
||||
},
|
||||
@@ -825,14 +828,14 @@ WDefaultEntry optionList[] = {
|
||||
},
|
||||
{"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT,
|
||||
NULL, getCursor, setCursor
|
||||
}
|
||||
,{"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW,
|
||||
},
|
||||
{"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW,
|
||||
NULL, getCursor, setCursor
|
||||
}
|
||||
,{"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION,
|
||||
},
|
||||
{"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION,
|
||||
NULL, getCursor, setCursor
|
||||
}
|
||||
,{"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT,
|
||||
},
|
||||
{"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT,
|
||||
NULL, getCursor, setCursor
|
||||
}
|
||||
#endif
|
||||
@@ -2541,8 +2544,7 @@ static WCursorLookup cursor_table[] =
|
||||
|
||||
static void check_bitmap_status(int status, char *filename, Pixmap bitmap)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
switch(status) {
|
||||
case BitmapOpenFailed:
|
||||
wwarning(_("failed to open bitmap file \"%s\""), filename);
|
||||
break;
|
||||
@@ -2571,59 +2573,45 @@ static int parse_cursor(WScreen *scr, proplist_t pl, Cursor *cursor)
|
||||
int status = 0;
|
||||
|
||||
nelem = PLGetNumberOfElements(pl);
|
||||
if (nelem < 1)
|
||||
{
|
||||
if (nelem < 1) {
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 0);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
|
||||
if (0 == strcasecmp(val, "none"))
|
||||
{
|
||||
if (0 == strcasecmp(val, "none")) {
|
||||
status = 1;
|
||||
*cursor = None;
|
||||
}
|
||||
else if (0 == strcasecmp(val, "builtin"))
|
||||
{
|
||||
} else if (0 == strcasecmp(val, "builtin")) {
|
||||
int i;
|
||||
int cursor_id = CURSOR_ID_NONE;
|
||||
|
||||
if (2 != nelem)
|
||||
{
|
||||
if (2 != nelem) {
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
|
||||
for (i = 0; NULL != cursor_table[i].name; i++)
|
||||
{
|
||||
if (0 == strcasecmp(val, cursor_table[i].name))
|
||||
{
|
||||
for (i = 0; NULL != cursor_table[i].name; i++) {
|
||||
if (0 == strcasecmp(val, cursor_table[i].name)) {
|
||||
cursor_id = cursor_table[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (CURSOR_ID_NONE == cursor_id)
|
||||
{
|
||||
if (CURSOR_ID_NONE == cursor_id) {
|
||||
wwarning(_("unknown builtin cursor name \"%s\""), val);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*cursor = XCreateFontCursor(dpy, cursor_id);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
else if (0 == strcasecmp(val, "bitmap"))
|
||||
{
|
||||
} else if (0 == strcasecmp(val, "bitmap")) {
|
||||
char *bitmap_name;
|
||||
char *mask_name;
|
||||
int bitmap_status;
|
||||
@@ -2634,33 +2622,28 @@ static int parse_cursor(WScreen *scr, proplist_t pl, Cursor *cursor)
|
||||
int x, y;
|
||||
XColor fg, bg;
|
||||
|
||||
if (3 != nelem)
|
||||
{
|
||||
if (3 != nelem) {
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
bitmap_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!bitmap_name)
|
||||
{
|
||||
if (!bitmap_name) {
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 2);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
free(bitmap_name);
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
mask_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!mask_name)
|
||||
{
|
||||
if (!mask_name) {
|
||||
free(bitmap_name);
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
@@ -2670,8 +2653,7 @@ static int parse_cursor(WScreen *scr, proplist_t pl, Cursor *cursor)
|
||||
bitmap_status = XReadBitmapFile(dpy, scr->w_win, bitmap_name, &w, &h,
|
||||
&bitmap, &x, &y);
|
||||
if ((BitmapSuccess == bitmap_status) &&
|
||||
(BitmapSuccess == mask_status))
|
||||
{
|
||||
(BitmapSuccess == mask_status)) {
|
||||
fg.pixel = scr->black_pixel;
|
||||
bg.pixel = scr->white_pixel;
|
||||
XQueryColor(dpy, scr->w_colormap, &fg);
|
||||
@@ -2687,6 +2669,7 @@ static int parse_cursor(WScreen *scr, proplist_t pl, Cursor *cursor)
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getCursor(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
||||
void **ret)
|
||||
@@ -2696,12 +2679,10 @@ getCursor(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
||||
int changed = 0;
|
||||
|
||||
again:
|
||||
if (!PLIsArray(value))
|
||||
{
|
||||
if (!PLIsArray(value)) {
|
||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
||||
entry->key, "cursor specification");
|
||||
if (!changed)
|
||||
{
|
||||
if (!changed) {
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
@@ -2710,11 +2691,9 @@ again:
|
||||
return(False);
|
||||
}
|
||||
status = parse_cursor(scr, value, &cursor);
|
||||
if (!status)
|
||||
{
|
||||
if (!status) {
|
||||
wwarning(_("Error in cursor specification for key \"%s\""), entry->key);
|
||||
if (!changed)
|
||||
{
|
||||
if (!changed) {
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
@@ -2722,12 +2701,10 @@ again:
|
||||
}
|
||||
return(False);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
if (ret) {
|
||||
*ret = &cursor;
|
||||
}
|
||||
if (addr)
|
||||
{
|
||||
if (addr) {
|
||||
*(Cursor *)addr = cursor;
|
||||
}
|
||||
return(True);
|
||||
@@ -2739,7 +2716,7 @@ again:
|
||||
|
||||
/* ---------------- value setting functions --------------- */
|
||||
static int
|
||||
setJustify(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
|
||||
setJustify(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
|
||||
{
|
||||
return REFRESH_WINDOW_TITLE_COLOR;
|
||||
}
|
||||
|
||||
139
src/event.c
139
src/event.c
@@ -1303,131 +1303,6 @@ windowUnderPointer(WScreen *scr)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
{
|
||||
WScreen *scr = wScreenForRootWindow(event->xkey.root);
|
||||
Bool done = False;
|
||||
Bool openedSwitchMenu = False;
|
||||
WWindow *newFocused;
|
||||
WWindow *oldFocused;
|
||||
int modifiers;
|
||||
XModifierKeymap *keymap;
|
||||
Bool somethingElse = False;
|
||||
XEvent ev;
|
||||
|
||||
if (!wwin)
|
||||
return;
|
||||
|
||||
keymap = XGetModifierMapping(dpy);
|
||||
|
||||
|
||||
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime);
|
||||
|
||||
if (next) {
|
||||
newFocused = NextToFocusAfter(wwin);
|
||||
} else {
|
||||
newFocused = NextToFocusBefore(wwin);
|
||||
}
|
||||
|
||||
scr->flags.doing_alt_tab = 1;
|
||||
|
||||
|
||||
if (wPreferences.circ_raise)
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
wWindowFocus(newFocused, scr->focused_window);
|
||||
oldFocused = newFocused;
|
||||
|
||||
#if 0
|
||||
if (wPreferences.popup_switchmenu &&
|
||||
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
||||
|
||||
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
|
||||
openedSwitchMenu = True;
|
||||
}
|
||||
#endif
|
||||
while (!done) {
|
||||
WMMaskEvent(dpy,KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
|
||||
|
||||
if (ev.type != KeyRelease && ev.type != KeyPress) {
|
||||
WMHandleEvent(&ev);
|
||||
continue;
|
||||
}
|
||||
/* ignore CapsLock */
|
||||
modifiers = ev.xkey.state & ValidModMask;
|
||||
|
||||
if (ev.type == KeyPress) {
|
||||
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
newFocused = NextToFocusAfter(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
}
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
|
||||
} else if (wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers) {
|
||||
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
newFocused = NextToFocusBefore(newFocused);
|
||||
wWindowFocus(newFocused, oldFocused);
|
||||
oldFocused = newFocused;
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
/* restore order */
|
||||
CommitStacking(scr);
|
||||
XRaiseWindow(dpy, newFocused->frame->core->window);
|
||||
}
|
||||
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
|
||||
|
||||
} else {
|
||||
somethingElse = True;
|
||||
done = True;
|
||||
}
|
||||
} else if (ev.type == KeyRelease) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
||||
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
||||
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
||||
& 1<<(i/keymap->max_keypermod)) {
|
||||
done = True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
XFreeModifiermap(keymap);
|
||||
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
wSetFocusTo(scr, newFocused);
|
||||
|
||||
if (wPreferences.circ_raise) {
|
||||
wRaiseFrame(newFocused->frame->core);
|
||||
CommitStacking(scr);
|
||||
}
|
||||
|
||||
scr->flags.doing_alt_tab = 0;
|
||||
if (openedSwitchMenu)
|
||||
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
|
||||
|
||||
if (somethingElse) {
|
||||
handleKeyPress(&ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handleKeyPress(XEvent *event)
|
||||
{
|
||||
@@ -1598,17 +1473,19 @@ handleKeyPress(XEvent *event)
|
||||
}
|
||||
break;
|
||||
case WKBD_FOCUSNEXT:
|
||||
if (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0)
|
||||
doWindozeCycle(wwin, event, True);
|
||||
if (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0
|
||||
&& wPreferences.windows_cycling)
|
||||
StartWindozeCycle(wwin, event, True);
|
||||
else
|
||||
puts("NEXT");
|
||||
CycleWindow(scr, True);
|
||||
break;
|
||||
|
||||
case WKBD_FOCUSPREV:
|
||||
if (wKeyBindings[WKBD_FOCUSPREV].modifier != 0)
|
||||
doWindozeCycle(wwin, event, False);
|
||||
if (wKeyBindings[WKBD_FOCUSPREV].modifier != 0
|
||||
&& wPreferences.windows_cycling)
|
||||
StartWindozeCycle(wwin, event, False);
|
||||
else
|
||||
puts("PREV");
|
||||
CycleWindow(scr, False);
|
||||
break;
|
||||
|
||||
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
|
||||
|
||||
@@ -94,6 +94,11 @@ void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret);
|
||||
void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
||||
unsigned int width, unsigned int height);
|
||||
|
||||
|
||||
void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next);
|
||||
|
||||
void CycleWindow(WScreen *scr, Bool forward);
|
||||
|
||||
#ifdef USECPP
|
||||
char *MakeCPPArgs(char *path);
|
||||
#endif
|
||||
|
||||
58
src/misc.c
58
src/misc.c
@@ -202,64 +202,6 @@ MakeCPPArgs(char *path)
|
||||
|
||||
|
||||
|
||||
|
||||
WWindow*
|
||||
NextToFocusAfter(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->prev;
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
tmp = wwin;
|
||||
/* start over from the beginning of the list */
|
||||
while (tmp->next)
|
||||
tmp = tmp->next;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
WWindow*
|
||||
NextToFocusBefore(WWindow *wwin)
|
||||
{
|
||||
WWindow *tmp = wwin->next;
|
||||
|
||||
while (tmp) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
/* start over from the beginning of the list */
|
||||
tmp = wwin;
|
||||
while (tmp->prev)
|
||||
tmp = tmp->prev;
|
||||
|
||||
while (tmp && tmp != wwin) {
|
||||
if (wWindowCanReceiveFocus(tmp) && !WFLAGP(tmp, skip_window_list)) {
|
||||
|
||||
return tmp;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Is win2 below win1?
|
||||
|
||||
41
src/xutil.c
41
src/xutil.c
@@ -193,44 +193,3 @@ FormatXError(Display *dpy, XErrorEvent *error, char *buffer, int size)
|
||||
sprintf(buffer, " Error serial: %li\n", error->serial);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
* GetSelection--
|
||||
* Request for the current primary selection.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
RequestSelection(Display *dpy, Window requestor, Time timestamp)
|
||||
{
|
||||
if (!Clipboard)
|
||||
Clipboard = XInternAtom(dpy, "CLIPBOARD", False);
|
||||
|
||||
XConvertSelection(dpy, XA_PRIMARY, XA_STRING, Clipboard, requestor,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
GetSelection(Display *dpy, Window requestor)
|
||||
{
|
||||
Atom rtype;
|
||||
int bits;
|
||||
unsigned long len, bytes;
|
||||
unsigned char *data;
|
||||
|
||||
XGetWindowProperty(dpy, requestor, Clipboard,
|
||||
0, MAXLINE/4, False, XA_STRING,
|
||||
&rtype, &bits, &len, &bytes, &data);
|
||||
if ((rtype!=XA_STRING) || (bits!=8)) {
|
||||
wwarning(_("invalid data in selection"));
|
||||
if (data) XFree(data);
|
||||
return NULL;
|
||||
} else {
|
||||
return (char*)data;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user