mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 22:34:18 +01:00
more dnd changes
window cycling stuff finnish pot files
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
299
src/defaults.c
299
src/defaults.c
@@ -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,20 +2544,19 @@ 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;
|
||||
wwarning(_("failed to open bitmap file \"%s\""), filename);
|
||||
break;
|
||||
case BitmapFileInvalid:
|
||||
wwarning(_("\"%s\" is not a valid bitmap file"), filename);
|
||||
break;
|
||||
wwarning(_("\"%s\" is not a valid bitmap file"), filename);
|
||||
break;
|
||||
case BitmapNoMemory:
|
||||
wwarning(_("out of memory reading bitmap file \"%s\""), filename);
|
||||
break;
|
||||
wwarning(_("out of memory reading bitmap file \"%s\""), filename);
|
||||
break;
|
||||
case BitmapSuccess:
|
||||
XFreePixmap(dpy, bitmap);
|
||||
break;
|
||||
XFreePixmap(dpy, bitmap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2565,172 +2567,147 @@ static void check_bitmap_status(int status, char *filename, Pixmap bitmap)
|
||||
*/
|
||||
static int parse_cursor(WScreen *scr, proplist_t pl, Cursor *cursor)
|
||||
{
|
||||
proplist_t elem;
|
||||
char *val;
|
||||
int nelem;
|
||||
int status = 0;
|
||||
|
||||
nelem = PLGetNumberOfElements(pl);
|
||||
if (nelem < 1)
|
||||
{
|
||||
return(status);
|
||||
proplist_t elem;
|
||||
char *val;
|
||||
int nelem;
|
||||
int status = 0;
|
||||
|
||||
nelem = PLGetNumberOfElements(pl);
|
||||
if (nelem < 1) {
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 0);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
return(status);
|
||||
elem = PLGetArrayElement(pl, 0);
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
|
||||
if (0 == strcasecmp(val, "none"))
|
||||
{
|
||||
status = 1;
|
||||
*cursor = None;
|
||||
}
|
||||
else if (0 == strcasecmp(val, "builtin"))
|
||||
{
|
||||
int i;
|
||||
int cursor_id = CURSOR_ID_NONE;
|
||||
|
||||
if (2 != nelem)
|
||||
{
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
val = PLGetString(elem);
|
||||
|
||||
if (0 == strcasecmp(val, "none")) {
|
||||
status = 1;
|
||||
*cursor = None;
|
||||
} else if (0 == strcasecmp(val, "builtin")) {
|
||||
int i;
|
||||
int cursor_id = CURSOR_ID_NONE;
|
||||
|
||||
if (2 != nelem) {
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
return(status);
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
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))
|
||||
{
|
||||
cursor_id = cursor_table[i].id;
|
||||
break;
|
||||
val = PLGetString(elem);
|
||||
|
||||
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)
|
||||
{
|
||||
wwarning(_("unknown builtin cursor name \"%s\""), val);
|
||||
if (CURSOR_ID_NONE == cursor_id) {
|
||||
wwarning(_("unknown builtin cursor name \"%s\""), val);
|
||||
} else {
|
||||
*cursor = XCreateFontCursor(dpy, cursor_id);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*cursor = XCreateFontCursor(dpy, cursor_id);
|
||||
status = 1;
|
||||
} else if (0 == strcasecmp(val, "bitmap")) {
|
||||
char *bitmap_name;
|
||||
char *mask_name;
|
||||
int bitmap_status;
|
||||
int mask_status;
|
||||
Pixmap bitmap;
|
||||
Pixmap mask;
|
||||
unsigned int w, h;
|
||||
int x, y;
|
||||
XColor fg, bg;
|
||||
|
||||
if (3 != nelem) {
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
bitmap_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!bitmap_name) {
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 2);
|
||||
if (!elem || !PLIsString(elem)) {
|
||||
free(bitmap_name);
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
mask_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!mask_name) {
|
||||
free(bitmap_name);
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
}
|
||||
mask_status = XReadBitmapFile(dpy, scr->w_win, mask_name, &w, &h,
|
||||
&mask, &x, &y);
|
||||
bitmap_status = XReadBitmapFile(dpy, scr->w_win, bitmap_name, &w, &h,
|
||||
&bitmap, &x, &y);
|
||||
if ((BitmapSuccess == bitmap_status) &&
|
||||
(BitmapSuccess == mask_status)) {
|
||||
fg.pixel = scr->black_pixel;
|
||||
bg.pixel = scr->white_pixel;
|
||||
XQueryColor(dpy, scr->w_colormap, &fg);
|
||||
XQueryColor(dpy, scr->w_colormap, &bg);
|
||||
*cursor = XCreatePixmapCursor(dpy, bitmap, mask, &fg, &bg, x, y);
|
||||
status = 1;
|
||||
}
|
||||
check_bitmap_status(bitmap_status, bitmap_name, bitmap);
|
||||
check_bitmap_status(mask_status, mask_name, mask);
|
||||
free(bitmap_name);
|
||||
free(mask_name);
|
||||
}
|
||||
else if (0 == strcasecmp(val, "bitmap"))
|
||||
{
|
||||
char *bitmap_name;
|
||||
char *mask_name;
|
||||
int bitmap_status;
|
||||
int mask_status;
|
||||
Pixmap bitmap;
|
||||
Pixmap mask;
|
||||
unsigned int w, h;
|
||||
int x, y;
|
||||
XColor fg, bg;
|
||||
|
||||
if (3 != nelem)
|
||||
{
|
||||
wwarning(_("bad number of arguments in cursor specification"));
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 1);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
bitmap_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!bitmap_name)
|
||||
{
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
}
|
||||
elem = PLGetArrayElement(pl, 2);
|
||||
if (!elem || !PLIsString(elem))
|
||||
{
|
||||
free(bitmap_name);
|
||||
return(status);
|
||||
}
|
||||
val = PLGetString(elem);
|
||||
mask_name = FindImage(wPreferences.pixmap_path, val);
|
||||
if (!mask_name)
|
||||
{
|
||||
free(bitmap_name);
|
||||
wwarning(_("could not find cursor bitmap file \"%s\""), val);
|
||||
return(status);
|
||||
}
|
||||
mask_status = XReadBitmapFile(dpy, scr->w_win, mask_name, &w, &h,
|
||||
&mask, &x, &y);
|
||||
bitmap_status = XReadBitmapFile(dpy, scr->w_win, bitmap_name, &w, &h,
|
||||
&bitmap, &x, &y);
|
||||
if ((BitmapSuccess == bitmap_status) &&
|
||||
(BitmapSuccess == mask_status))
|
||||
{
|
||||
fg.pixel = scr->black_pixel;
|
||||
bg.pixel = scr->white_pixel;
|
||||
XQueryColor(dpy, scr->w_colormap, &fg);
|
||||
XQueryColor(dpy, scr->w_colormap, &bg);
|
||||
*cursor = XCreatePixmapCursor(dpy, bitmap, mask, &fg, &bg, x, y);
|
||||
status = 1;
|
||||
}
|
||||
check_bitmap_status(bitmap_status, bitmap_name, bitmap);
|
||||
check_bitmap_status(mask_status, mask_name, mask);
|
||||
free(bitmap_name);
|
||||
free(mask_name);
|
||||
}
|
||||
return(status);
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getCursor(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
||||
void **ret)
|
||||
{
|
||||
static Cursor cursor;
|
||||
int status;
|
||||
int changed = 0;
|
||||
|
||||
static Cursor cursor;
|
||||
int status;
|
||||
int changed = 0;
|
||||
|
||||
again:
|
||||
if (!PLIsArray(value))
|
||||
{
|
||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
||||
entry->key, "cursor specification");
|
||||
if (!changed)
|
||||
{
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
goto again;
|
||||
if (!PLIsArray(value)) {
|
||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
||||
entry->key, "cursor specification");
|
||||
if (!changed) {
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
goto again;
|
||||
}
|
||||
return(False);
|
||||
return(False);
|
||||
}
|
||||
status = parse_cursor(scr, value, &cursor);
|
||||
if (!status)
|
||||
{
|
||||
wwarning(_("Error in cursor specification for key \"%s\""), entry->key);
|
||||
if (!changed)
|
||||
{
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
goto again;
|
||||
status = parse_cursor(scr, value, &cursor);
|
||||
if (!status) {
|
||||
wwarning(_("Error in cursor specification for key \"%s\""), entry->key);
|
||||
if (!changed) {
|
||||
value = entry->plvalue;
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
goto again;
|
||||
}
|
||||
return(False);
|
||||
return(False);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
*ret = &cursor;
|
||||
if (ret) {
|
||||
*ret = &cursor;
|
||||
}
|
||||
if (addr)
|
||||
{
|
||||
*(Cursor *)addr = cursor;
|
||||
if (addr) {
|
||||
*(Cursor *)addr = cursor;
|
||||
}
|
||||
return(True);
|
||||
return(True);
|
||||
}
|
||||
#undef CURSOR_ID_NONE
|
||||
|
||||
@@ -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