mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
fixed many bugs, removed linked list
This commit is contained in:
@@ -43,8 +43,6 @@ wmaker_SOURCES = \
|
|||||||
keybind.h \
|
keybind.h \
|
||||||
kwm.h \
|
kwm.h \
|
||||||
kwm.c \
|
kwm.c \
|
||||||
list.c \
|
|
||||||
list.h \
|
|
||||||
main.c \
|
main.c \
|
||||||
menu.c \
|
menu.c \
|
||||||
menu.h \
|
menu.h \
|
||||||
|
|||||||
@@ -59,12 +59,10 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP_PATH = @CPP_PATH@
|
CPP_PATH = @CPP_PATH@
|
||||||
DFLAGS = @DFLAGS@
|
DFLAGS = @DFLAGS@
|
||||||
DLLIBS = @DLLIBS@
|
DLLIBS = @DLLIBS@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GFXLIBS = @GFXLIBS@
|
GFXLIBS = @GFXLIBS@
|
||||||
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
||||||
ICONEXT = @ICONEXT@
|
ICONEXT = @ICONEXT@
|
||||||
@@ -79,7 +77,6 @@ MAKEINFO = @MAKEINFO@
|
|||||||
MOFILES = @MOFILES@
|
MOFILES = @MOFILES@
|
||||||
NLSDIR = @NLSDIR@
|
NLSDIR = @NLSDIR@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
@@ -100,7 +97,7 @@ bin_PROGRAMS = wmaker
|
|||||||
|
|
||||||
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h
|
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.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 gnome.c gnome.h funcs.h icon.c icon.h keybind.h kwm.h kwm.c list.c list.h 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 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 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)\"
|
CPPFLAGS = @CPPFLAGS@ @DFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
|
||||||
@@ -124,8 +121,8 @@ X_LIBS = @X_LIBS@
|
|||||||
X_PRE_LIBS = @X_PRE_LIBS@
|
X_PRE_LIBS = @X_PRE_LIBS@
|
||||||
wmaker_OBJECTS = actions.o appicon.o application.o appmenu.o balloon.o \
|
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 \
|
client.o colormap.o defaults.o dialog.o dock.o dockedapp.o event.o \
|
||||||
framewin.o gnome.o icon.o kwm.o list.o main.o menu.o misc.o motif.o \
|
framewin.o gnome.o icon.o kwm.o main.o menu.o misc.o motif.o moveres.o \
|
||||||
moveres.o openlook.o pixmap.o placement.o plugin.o properties.o proplist.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 \
|
resources.o rootmenu.o screen.o session.o shutdown.o stacking.o \
|
||||||
startup.o superfluous.o switchmenu.o texture.o usermenu.o xdnd.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 winspector.o \
|
xmodifier.o xutil.o wcore.o wdefaults.o window.o winmenu.o winspector.o \
|
||||||
@@ -144,7 +141,7 @@ wconfig.h.in
|
|||||||
|
|
||||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
TAR = tar
|
TAR = gtar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
SOURCES = $(wmaker_SOURCES)
|
SOURCES = $(wmaker_SOURCES)
|
||||||
OBJECTS = $(wmaker_OBJECTS)
|
OBJECTS = $(wmaker_OBJECTS)
|
||||||
|
|||||||
@@ -46,7 +46,6 @@
|
|||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#include "winspector.h"
|
#include "winspector.h"
|
||||||
#include "list.h"
|
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
@@ -1766,15 +1765,20 @@ void
|
|||||||
wSelectWindow(WWindow *wwin, Bool flag)
|
wSelectWindow(WWindow *wwin, Bool flag)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
wwin->flags.selected = 1;
|
wwin->flags.selected = 1;
|
||||||
XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel);
|
XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel);
|
||||||
scr->selected_windows = list_cons(wwin, scr->selected_windows);
|
if (!scr->selected_windows)
|
||||||
|
scr->selected_windows = WMCreateBag(4);
|
||||||
|
WMPutInBag(scr->selected_windows, wwin);
|
||||||
} else {
|
} else {
|
||||||
wwin->flags.selected = 0;
|
wwin->flags.selected = 0;
|
||||||
XSetWindowBorder(dpy, wwin->frame->core->window,
|
XSetWindowBorder(dpy, wwin->frame->core->window,
|
||||||
scr->frame_border_pixel);
|
scr->frame_border_pixel);
|
||||||
scr->selected_windows = list_remove_elem(scr->selected_windows, wwin);
|
if (scr->selected_windows) {
|
||||||
|
WMRemoveFromBag(scr->selected_windows, wwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ updateDockNumbers(WScreen *scr)
|
|||||||
length = strlen(ws_numbers);
|
length = strlen(ws_numbers);
|
||||||
|
|
||||||
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
||||||
scr->icon_title_font->y+1, False);
|
WMFontHeight(scr->icon_title_font)+1, False);
|
||||||
|
|
||||||
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
||||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ static WOptionEnumeration seSpeeds[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static WOptionEnumeration seMouseButtons[] = {
|
static WOptionEnumeration seMouseButtons[] = {
|
||||||
|
{"None", -1, 0},
|
||||||
{"Left", Button1, 0}, {"Button1", Button1, 1},
|
{"Left", Button1, 0}, {"Button1", Button1, 1},
|
||||||
{"Middle", Button2, 0}, {"Button2", Button2, 1},
|
{"Middle", Button2, 0}, {"Button2", Button2, 1},
|
||||||
{"Right", Button3, 0}, {"Button3", Button3, 1},
|
{"Right", Button3, 0}, {"Button3", Button3, 1},
|
||||||
@@ -898,7 +899,7 @@ wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* global system dictionary */
|
/* global system dictionary */
|
||||||
sprintf(path, "%s/%s", SYSCONFDIR, domain);
|
sprintf(path, "%s/WindowMaker/%s", SYSCONFDIR, domain);
|
||||||
if (stat(path, &stbuf)>=0) {
|
if (stat(path, &stbuf)>=0) {
|
||||||
shared_dict = ReadProplistFromFile(path);
|
shared_dict = ReadProplistFromFile(path);
|
||||||
if (shared_dict) {
|
if (shared_dict) {
|
||||||
@@ -922,8 +923,8 @@ wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wwarning(_("could not load domain %s from global defaults database"),
|
wwarning(_("could not load domain %s from global defaults database (%s)"),
|
||||||
domain);
|
domain, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1108,6 +1109,7 @@ wReadDefaults(WScreen *scr, proplist_t new_dict)
|
|||||||
proplist_t plvalue, old_value;
|
proplist_t plvalue, old_value;
|
||||||
WDefaultEntry *entry;
|
WDefaultEntry *entry;
|
||||||
int i, must_update;
|
int i, must_update;
|
||||||
|
int update_workspace_back = 0; /* kluge :/ */
|
||||||
int needs_refresh;
|
int needs_refresh;
|
||||||
void *tdata;
|
void *tdata;
|
||||||
proplist_t old_dict = (WDWindowMaker->dictionary!=new_dict
|
proplist_t old_dict = (WDWindowMaker->dictionary!=new_dict
|
||||||
@@ -1146,16 +1148,33 @@ wReadDefaults(WScreen *scr, proplist_t new_dict)
|
|||||||
} else if (!PLIsEqual(plvalue, old_value)) {
|
} else if (!PLIsEqual(plvalue, old_value)) {
|
||||||
/* value has changed */
|
/* value has changed */
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (strcmp(entry->key, "WorkspaceBack") == 0
|
||||||
|
&& update_workspace_back
|
||||||
|
&& scr->flags.backimage_helper_launched) {
|
||||||
|
} else {
|
||||||
/* value was not changed since last time */
|
/* value was not changed since last time */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (plvalue) {
|
if (plvalue) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Updating %s to %s\n", entry->key, PLGetDescription(plvalue));
|
printf("Updating %s to %s\n", entry->key,
|
||||||
|
PLGetDescription(plvalue));
|
||||||
#endif
|
#endif
|
||||||
/* convert data */
|
/* convert data */
|
||||||
if ((*entry->convert)(scr, entry, plvalue, entry->addr, &tdata)) {
|
if ((*entry->convert)(scr, entry, plvalue, entry->addr, &tdata)) {
|
||||||
|
/*
|
||||||
|
* If the WorkspaceSpecificBack data has been changed
|
||||||
|
* so that the helper will be launched now, we must be
|
||||||
|
* sure to send the default background texture config
|
||||||
|
* to the helper.
|
||||||
|
*/
|
||||||
|
if (strcmp(entry->key, "WorkspaceSpecificBack") == 0
|
||||||
|
&& !scr->flags.backimage_helper_launched) {
|
||||||
|
update_workspace_back = 1;
|
||||||
|
}
|
||||||
if (entry->update) {
|
if (entry->update) {
|
||||||
needs_refresh |=
|
needs_refresh |=
|
||||||
(*entry->update)(scr, entry, tdata, entry->extra_data);
|
(*entry->update)(scr, entry, tdata, entry->extra_data);
|
||||||
@@ -2014,7 +2033,7 @@ getTextRenderer(WScreen *scr, WDefaultEntry *entry, proplist_t value,
|
|||||||
{
|
{
|
||||||
proplist_t elem;
|
proplist_t elem;
|
||||||
char *val, *lib, *func, **argv;
|
char *val, *lib, *func, **argv;
|
||||||
int argc, i, changed;
|
int argc, changed;
|
||||||
|
|
||||||
if (strcmp(entry->key, "FTitleColor")==0) {
|
if (strcmp(entry->key, "FTitleColor")==0) {
|
||||||
wPluginDestroyFunction(scr->drawstring_func[changed = W_STRING_FTITLE]);
|
wPluginDestroyFunction(scr->drawstring_func[changed = W_STRING_FTITLE]);
|
||||||
@@ -2057,6 +2076,8 @@ getTextRenderer(WScreen *scr, WDefaultEntry *entry, proplist_t value,
|
|||||||
} else if (PLIsString(value)) {
|
} else if (PLIsString(value)) {
|
||||||
return getColor(scr, entry, value, addr, ret);
|
return getColor(scr, entry, value, addr, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return False;
|
||||||
}
|
}
|
||||||
#endif /* DRAWSTRING_PLUGIN */
|
#endif /* DRAWSTRING_PLUGIN */
|
||||||
|
|
||||||
@@ -2841,6 +2862,7 @@ setWorkspaceSpecificBack(WScreen *scr, WDefaultEntry *entry, proplist_t value,
|
|||||||
|
|
||||||
SendHelperMessage(scr, 'P', -1, wPreferences.pixmap_path);
|
SendHelperMessage(scr, 'P', -1, wPreferences.pixmap_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < PLGetNumberOfElements(value); i++) {
|
for (i = 0; i < PLGetNumberOfElements(value); i++) {
|
||||||
|
|||||||
137
src/dock.c
137
src/dock.c
@@ -54,7 +54,6 @@
|
|||||||
#include "framewin.h"
|
#include "framewin.h"
|
||||||
#include "superfluous.h"
|
#include "superfluous.h"
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
@@ -313,17 +312,17 @@ numberOfSelectedIcons(WDock *dock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LinkedList*
|
static WMBag*
|
||||||
getSelected(WDock *dock)
|
getSelected(WDock *dock)
|
||||||
{
|
{
|
||||||
LinkedList *ret=NULL;
|
WMBag *ret = WMCreateBag(8);
|
||||||
WAppIcon *btn;
|
WAppIcon *btn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=1; i<dock->max_icons; i++) {
|
for (i=1; i<dock->max_icons; i++) {
|
||||||
btn = dock->icon_array[i];
|
btn = dock->icon_array[i];
|
||||||
if (btn && btn->icon->selected) {
|
if (btn && btn->icon->selected) {
|
||||||
ret = list_cons(btn, ret);
|
WMPutInBag(ret, btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,8 +481,9 @@ omnipresentCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
WAppIcon *clickedIcon = entry->clientdata;
|
WAppIcon *clickedIcon = entry->clientdata;
|
||||||
WAppIcon *aicon;
|
WAppIcon *aicon;
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
LinkedList *selectedIcons;
|
WMBag *selectedIcons;
|
||||||
int failed;
|
int failed;
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(entry->clientdata!=NULL);
|
assert(entry->clientdata!=NULL);
|
||||||
|
|
||||||
@@ -491,18 +491,19 @@ omnipresentCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
selectedIcons = getSelected(dock);
|
selectedIcons = getSelected(dock);
|
||||||
|
|
||||||
if (!selectedIcons)
|
if (!WMGetBagItemCount(selectedIcons))
|
||||||
selectedIcons = list_cons(clickedIcon, NULL);
|
WMPutInBag(selectedIcons, clickedIcon);
|
||||||
|
|
||||||
failed = 0;
|
failed = 0;
|
||||||
while (selectedIcons) {
|
for (i = 0; i < WMGetBagItemCount(selectedIcons); i++) {
|
||||||
aicon = selectedIcons->head;
|
aicon = WMGetFromBag(selectedIcons, i);
|
||||||
|
|
||||||
if (wClipMakeIconOmnipresent(aicon, !aicon->omnipresent) == WO_FAILED)
|
if (wClipMakeIconOmnipresent(aicon, !aicon->omnipresent) == WO_FAILED)
|
||||||
failed++;
|
failed++;
|
||||||
else if (aicon->icon->selected)
|
else if (aicon->icon->selected)
|
||||||
wIconSelect(aicon->icon);
|
wIconSelect(aicon->icon);
|
||||||
list_remove_head(&selectedIcons);
|
|
||||||
}
|
}
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
|
|
||||||
if (failed > 1) {
|
if (failed > 1) {
|
||||||
wMessageDialog(dock->screen_ptr, _("Warning"),
|
wMessageDialog(dock->screen_ptr, _("Warning"),
|
||||||
@@ -530,8 +531,9 @@ removeIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
WAppIcon *aicon;
|
WAppIcon *aicon;
|
||||||
LinkedList *selectedIcons;
|
WMBag *selectedIcons;
|
||||||
int keepit;
|
int keepit;
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(clickedIcon!=NULL);
|
assert(clickedIcon!=NULL);
|
||||||
|
|
||||||
@@ -539,20 +541,23 @@ removeIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
selectedIcons = getSelected(dock);
|
selectedIcons = getSelected(dock);
|
||||||
|
|
||||||
if (selectedIcons) {
|
if (WMGetBagItemCount(selectedIcons)) {
|
||||||
if (wMessageDialog(dock->screen_ptr, _("Workspace Clip"),
|
if (wMessageDialog(dock->screen_ptr, _("Workspace Clip"),
|
||||||
_("All selected icons will be removed!"),
|
_("All selected icons will be removed!"),
|
||||||
_("OK"), _("Cancel"), NULL)!=WAPRDefault) {
|
_("OK"), _("Cancel"), NULL)!=WAPRDefault) {
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clickedIcon->xindex==0 && clickedIcon->yindex==0)
|
if (clickedIcon->xindex==0 && clickedIcon->yindex==0) {
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
return;
|
return;
|
||||||
selectedIcons = list_cons(clickedIcon, NULL);
|
}
|
||||||
|
WMPutInBag(selectedIcons, clickedIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (selectedIcons) {
|
for (i = 0; i < WMGetBagItemCount(selectedIcons); i++) {
|
||||||
aicon = selectedIcons->head;
|
aicon = WMGetFromBag(selectedIcons, i);
|
||||||
keepit = aicon->running && wApplicationOf(aicon->main_window);
|
keepit = aicon->running && wApplicationOf(aicon->main_window);
|
||||||
wDockDetach(dock, aicon);
|
wDockDetach(dock, aicon);
|
||||||
if (keepit) {
|
if (keepit) {
|
||||||
@@ -562,8 +567,8 @@ removeIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
if (!dock->mapped || dock->collapsed)
|
if (!dock->mapped || dock->collapsed)
|
||||||
XMapWindow(dpy, aicon->icon->core->window);
|
XMapWindow(dpy, aicon->icon->core->window);
|
||||||
}
|
}
|
||||||
list_remove_head(&selectedIcons);
|
|
||||||
}
|
}
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
|
|
||||||
if (wPreferences.auto_arrange_icons)
|
if (wPreferences.auto_arrange_icons)
|
||||||
wArrangeIcons(dock->screen_ptr, True);
|
wArrangeIcons(dock->screen_ptr, True);
|
||||||
@@ -576,14 +581,16 @@ keepIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
WAppIcon *aicon;
|
WAppIcon *aicon;
|
||||||
LinkedList *selectedIcons;
|
WMBag *selectedIcons;
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(clickedIcon!=NULL);
|
assert(clickedIcon!=NULL);
|
||||||
dock = clickedIcon->dock;
|
dock = clickedIcon->dock;
|
||||||
|
|
||||||
selectedIcons = getSelected(dock);
|
selectedIcons = getSelected(dock);
|
||||||
|
|
||||||
if (!selectedIcons && clickedIcon!=dock->screen_ptr->clip_icon) {
|
if (!WMGetBagItemCount(selectedIcons)
|
||||||
|
&& clickedIcon!=dock->screen_ptr->clip_icon) {
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
|
|
||||||
if (!clickedIcon->command && !clickedIcon->editing) {
|
if (!clickedIcon->command && !clickedIcon->editing) {
|
||||||
@@ -602,15 +609,16 @@ keepIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
clickedIcon->editing = 0;
|
clickedIcon->editing = 0;
|
||||||
if (command)
|
if (command)
|
||||||
free(command);
|
free(command);
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedIcons = list_cons(clickedIcon, NULL);
|
WMPutInBag(selectedIcons, clickedIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (selectedIcons) {
|
for (i = 0; i < WMGetBagItemCount(selectedIcons); i++) {
|
||||||
aicon = selectedIcons->head;
|
aicon = WMGetFromBag(selectedIcons, i);
|
||||||
if (aicon->icon->selected)
|
if (aicon->icon->selected)
|
||||||
wIconSelect(aicon->icon);
|
wIconSelect(aicon->icon);
|
||||||
if (aicon && aicon->attracted && aicon->command) {
|
if (aicon && aicon->attracted && aicon->command) {
|
||||||
@@ -621,8 +629,8 @@ keepIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
wAppIconPaint(aicon);
|
wAppIconPaint(aicon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list_remove_head(&selectedIcons);
|
|
||||||
}
|
}
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -740,7 +748,7 @@ selectIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
{
|
{
|
||||||
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
WAppIcon *clickedIcon = (WAppIcon*)entry->clientdata;
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
LinkedList *selectedIcons;
|
WMBag *selectedIcons;
|
||||||
WAppIcon *btn;
|
WAppIcon *btn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -749,7 +757,7 @@ selectIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
selectedIcons = getSelected(dock);
|
selectedIcons = getSelected(dock);
|
||||||
|
|
||||||
if (!selectedIcons) {
|
if (!WMGetBagItemCount(selectedIcons)) {
|
||||||
for (i=1; i<dock->max_icons; i++) {
|
for (i=1; i<dock->max_icons; i++) {
|
||||||
btn = dock->icon_array[i];
|
btn = dock->icon_array[i];
|
||||||
if (btn && !btn->icon->selected) {
|
if (btn && !btn->icon->selected) {
|
||||||
@@ -757,12 +765,12 @@ selectIconsCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(selectedIcons) {
|
for (i = 0; i < WMGetBagItemCount(selectedIcons); i++) {
|
||||||
btn = selectedIcons->head;
|
btn = WMGetFromBag(selectedIcons, i);
|
||||||
wIconSelect(btn->icon);
|
wIconSelect(btn->icon);
|
||||||
list_remove_head(&selectedIcons);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
|
|
||||||
wMenuPaint(menu);
|
wMenuPaint(menu);
|
||||||
}
|
}
|
||||||
@@ -906,7 +914,7 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
WAppIcon *btn, *icon = (WAppIcon*) entry->clientdata;
|
WAppIcon *btn, *icon = (WAppIcon*) entry->clientdata;
|
||||||
WScreen *scr = icon->icon->core->screen_ptr;
|
WScreen *scr = icon->icon->core->screen_ptr;
|
||||||
WDock *src, *dest;
|
WDock *src, *dest;
|
||||||
LinkedList *selectedIcons;
|
WMBag *selectedIcons;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (entry->order == scr->current_workspace)
|
if (entry->order == scr->current_workspace)
|
||||||
@@ -916,14 +924,14 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
selectedIcons = getSelected(src);
|
selectedIcons = getSelected(src);
|
||||||
|
|
||||||
if (selectedIcons) {
|
if (WMGetBagItemCount(selectedIcons)) {
|
||||||
while(selectedIcons) {
|
int i;
|
||||||
btn = selectedIcons->head;
|
for (i = 0; i < WMGetBagItemCount(selectedIcons); i++) {
|
||||||
|
btn = WMGetFromBag(selectedIcons, i);
|
||||||
if (wDockFindFreeSlot(dest, &x, &y)) {
|
if (wDockFindFreeSlot(dest, &x, &y)) {
|
||||||
moveIconBetweenDocks(src, dest, btn, x, y);
|
moveIconBetweenDocks(src, dest, btn, x, y);
|
||||||
XUnmapWindow(dpy, btn->icon->core->window);
|
XUnmapWindow(dpy, btn->icon->core->window);
|
||||||
}
|
}
|
||||||
list_remove_head(&selectedIcons);
|
|
||||||
}
|
}
|
||||||
} else if (icon != scr->clip_icon) {
|
} else if (icon != scr->clip_icon) {
|
||||||
if (wDockFindFreeSlot(dest, &x, &y)) {
|
if (wDockFindFreeSlot(dest, &x, &y)) {
|
||||||
@@ -931,6 +939,7 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
XUnmapWindow(dpy, icon->icon->core->window);
|
XUnmapWindow(dpy, icon->icon->core->window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WMFreeBag(selectedIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1432,7 +1441,7 @@ dockSaveState(WDock *dock)
|
|||||||
int i;
|
int i;
|
||||||
proplist_t icon_info;
|
proplist_t icon_info;
|
||||||
proplist_t list=NULL, dock_state=NULL;
|
proplist_t list=NULL, dock_state=NULL;
|
||||||
proplist_t value;
|
proplist_t value, key;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
list = PLMakeArrayFromElements(NULL);
|
list = PLMakeArrayFromElements(NULL);
|
||||||
@@ -1449,17 +1458,24 @@ dockSaveState(WDock *dock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dock_state = PLMakeDictionaryFromEntries(dApplications, list, NULL);
|
dock_state = PLMakeDictionaryFromEntries(dApplications, list,
|
||||||
|
NULL);
|
||||||
PLRelease(list);
|
|
||||||
|
|
||||||
if (dock->type == WM_DOCK) {
|
if (dock->type == WM_DOCK) {
|
||||||
|
sprintf(buffer, "Applications%i", dock->screen_ptr->scr_height);
|
||||||
|
key = PLMakeString(buffer);
|
||||||
|
PLInsertDictionaryEntry(dock_state, key, list);
|
||||||
|
PLRelease(key);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0),
|
sprintf(buffer, "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0),
|
||||||
dock->y_pos);
|
dock->y_pos);
|
||||||
value = PLMakeString(buffer);
|
value = PLMakeString(buffer);
|
||||||
PLInsertDictionaryEntry(dock_state, dPosition, value);
|
PLInsertDictionaryEntry(dock_state, dPosition, value);
|
||||||
PLRelease(value);
|
PLRelease(value);
|
||||||
}
|
}
|
||||||
|
PLRelease(list);
|
||||||
|
|
||||||
|
|
||||||
value = (dock->lowered ? dYes : dNo);
|
value = (dock->lowered ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dLowered, value);
|
PLInsertDictionaryEntry(dock_state, dLowered, value);
|
||||||
@@ -1486,12 +1502,36 @@ dockSaveState(WDock *dock)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wDockSaveState(WScreen *scr)
|
wDockSaveState(WScreen *scr, proplist_t old_state)
|
||||||
{
|
{
|
||||||
proplist_t dock_state;
|
proplist_t dock_state;
|
||||||
|
proplist_t keys;
|
||||||
|
|
||||||
dock_state = dockSaveState(scr->dock);
|
dock_state = dockSaveState(scr->dock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copy saved states of docks with different sizes.
|
||||||
|
*/
|
||||||
|
if (old_state) {
|
||||||
|
int i;
|
||||||
|
proplist_t tmp;
|
||||||
|
|
||||||
|
keys = PLGetAllDictionaryKeys(old_state);
|
||||||
|
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
|
||||||
|
tmp = PLGetArrayElement(keys, i);
|
||||||
|
|
||||||
|
if (strncasecmp(PLGetString(tmp), "applications", 12) == 0
|
||||||
|
&& !PLGetDictionaryEntry(dock_state, tmp)) {
|
||||||
|
|
||||||
|
PLInsertDictionaryEntry(dock_state,
|
||||||
|
tmp,
|
||||||
|
PLGetDictionaryEntry(old_state, tmp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PLRelease(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PLInsertDictionaryEntry(scr->session_state, dDock, dock_state);
|
PLInsertDictionaryEntry(scr->session_state, dDock, dock_state);
|
||||||
|
|
||||||
PLRelease(dock_state);
|
PLRelease(dock_state);
|
||||||
@@ -1872,7 +1912,28 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
/* application list */
|
/* application list */
|
||||||
|
|
||||||
|
{
|
||||||
|
proplist_t tmp;
|
||||||
|
char buffer[64];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When saving, it saves the dock state in
|
||||||
|
* Applications and Applicationsnnn
|
||||||
|
*
|
||||||
|
* When loading, it will first try Applicationsnnn.
|
||||||
|
* If it does not exist, use Applications as default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sprintf(buffer, "Applications%i", scr->scr_height);
|
||||||
|
|
||||||
|
tmp = PLMakeString(buffer);
|
||||||
|
apps = PLGetDictionaryEntry(dock_state, tmp);
|
||||||
|
PLRelease(tmp);
|
||||||
|
|
||||||
|
if (!apps) {
|
||||||
apps = PLGetDictionaryEntry(dock_state, dApplications);
|
apps = PLGetDictionaryEntry(dock_state, dApplications);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!apps) {
|
if (!apps) {
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void wDockShowIcons(WDock *dock);
|
|||||||
void wDockLower(WDock *dock);
|
void wDockLower(WDock *dock);
|
||||||
void wDockRaise(WDock *dock);
|
void wDockRaise(WDock *dock);
|
||||||
void wDockRaiseLower(WDock *dock);
|
void wDockRaiseLower(WDock *dock);
|
||||||
void wDockSaveState(WScreen *scr);
|
void wDockSaveState(WScreen *scr, proplist_t old_state);
|
||||||
|
|
||||||
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
|
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
|
||||||
Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
|
Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
|
||||||
|
|||||||
166
src/event.c
166
src/event.c
@@ -56,7 +56,7 @@
|
|||||||
#include "framewin.h"
|
#include "framewin.h"
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "balloon.h"
|
#include "balloon.h"
|
||||||
#include "list.h"
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
# include "gnome.h"
|
# include "gnome.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -149,11 +149,10 @@ static int deadProcessPtr=0;
|
|||||||
typedef struct DeathHandler {
|
typedef struct DeathHandler {
|
||||||
WDeathHandler *callback;
|
WDeathHandler *callback;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct DeathHandler *next;
|
|
||||||
void *client_data;
|
void *client_data;
|
||||||
} DeathHandler;
|
} DeathHandler;
|
||||||
|
|
||||||
static DeathHandler *deathHandler=NULL;
|
static WMBag *deathHandlers=NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -170,9 +169,10 @@ wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata)
|
|||||||
handler->callback = callback;
|
handler->callback = callback;
|
||||||
handler->client_data = cdata;
|
handler->client_data = cdata;
|
||||||
|
|
||||||
handler->next = deathHandler;
|
if (!deathHandlers)
|
||||||
|
deathHandlers = WMCreateBag(8);
|
||||||
|
|
||||||
deathHandler = handler;
|
WMPutInBag(deathHandlers, handler);
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
@@ -182,32 +182,21 @@ wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata)
|
|||||||
void
|
void
|
||||||
wDeleteDeathHandler(WMagicNumber id)
|
wDeleteDeathHandler(WMagicNumber id)
|
||||||
{
|
{
|
||||||
DeathHandler *tmp, *handler=(DeathHandler*)id;
|
DeathHandler *handler=(DeathHandler*)id;
|
||||||
|
|
||||||
if (!handler || !deathHandler)
|
if (!handler || !deathHandlers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tmp = deathHandler;
|
WMRemoveFromBag(deathHandlers, handler);
|
||||||
if (tmp==handler) {
|
|
||||||
deathHandler = handler->next;
|
|
||||||
free(handler);
|
free(handler);
|
||||||
} else {
|
|
||||||
while (tmp->next) {
|
|
||||||
if (tmp->next==handler) {
|
|
||||||
tmp->next=handler->next;
|
|
||||||
free(handler);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DispatchEvent(XEvent *event)
|
DispatchEvent(XEvent *event)
|
||||||
{
|
{
|
||||||
if (deathHandler)
|
if (deathHandlers)
|
||||||
handleDeadProcess(NULL);
|
handleDeadProcess(NULL);
|
||||||
|
|
||||||
if (WCHECK_STATE(WSTATE_NEED_EXIT)) {
|
if (WCHECK_STATE(WSTATE_NEED_EXIT)) {
|
||||||
@@ -379,7 +368,7 @@ handleDeadProcess(void *foo)
|
|||||||
wWindowDeleteSavedStatesForPID(deadProcesses[i].pid);
|
wWindowDeleteSavedStatesForPID(deadProcesses[i].pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deathHandler) {
|
if (!deathHandlers) {
|
||||||
deadProcessPtr=0;
|
deadProcessPtr=0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -388,11 +377,10 @@ handleDeadProcess(void *foo)
|
|||||||
while (deadProcessPtr>0) {
|
while (deadProcessPtr>0) {
|
||||||
deadProcessPtr--;
|
deadProcessPtr--;
|
||||||
|
|
||||||
tmp = deathHandler;
|
for (i = WMGetBagItemCount(deathHandlers)-1; i >= 0; i--) {
|
||||||
while (tmp) {
|
tmp = WMGetFromBag(deathHandlers, i);
|
||||||
DeathHandler *t;
|
if (!tmp)
|
||||||
|
continue;
|
||||||
t = tmp->next;
|
|
||||||
|
|
||||||
if (tmp->pid == deadProcesses[deadProcessPtr].pid) {
|
if (tmp->pid == deadProcesses[deadProcessPtr].pid) {
|
||||||
(*tmp->callback)(tmp->pid,
|
(*tmp->callback)(tmp->pid,
|
||||||
@@ -400,7 +388,6 @@ handleDeadProcess(void *foo)
|
|||||||
tmp->client_data);
|
tmp->client_data);
|
||||||
wDeleteDeathHandler(tmp);
|
wDeleteDeathHandler(tmp);
|
||||||
}
|
}
|
||||||
tmp = t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,7 +461,7 @@ handleMapRequest(XEvent *ev)
|
|||||||
Window window = ev->xmaprequest.window;
|
Window window = ev->xmaprequest.window;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got map request for %x\n", (unsigned)window);
|
dprintf("got map request for %x\n", (unsigned)window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((wwin = wWindowFor(window))) {
|
if ((wwin = wWindowFor(window))) {
|
||||||
@@ -553,7 +540,7 @@ handleDestroyNotify(XEvent *event)
|
|||||||
Window window = event->xdestroywindow.window;
|
Window window = event->xdestroywindow.window;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got destroy notify");
|
dputs("got destroy notify");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wwin = wWindowFor(window);
|
wwin = wWindowFor(window);
|
||||||
@@ -590,7 +577,7 @@ handleExpose(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got expose");
|
dputs("got expose");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
||||||
@@ -614,7 +601,7 @@ handleButtonPress(XEvent *event)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got button press");
|
dputs("got button press");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
scr = wScreenForRootWindow(event->xbutton.root);
|
scr = wScreenForRootWindow(event->xbutton.root);
|
||||||
@@ -721,7 +708,7 @@ handleMapNotify(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got map");
|
dputs("got map");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wwin = wWindowFor(event->xmap.event);
|
wwin = wWindowFor(event->xmap.event);
|
||||||
@@ -746,7 +733,7 @@ handleUnmapNotify(XEvent *event)
|
|||||||
Bool withdraw = False;
|
Bool withdraw = False;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got unmap");
|
dputs("got unmap");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* only process windows with StructureNotify selected
|
/* only process windows with StructureNotify selected
|
||||||
@@ -800,7 +787,7 @@ handleConfigureRequest(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got configure request");
|
dputs("got configure request");
|
||||||
#endif
|
#endif
|
||||||
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
||||||
/*
|
/*
|
||||||
@@ -824,7 +811,7 @@ handlePropertyNotify(XEvent *event)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got property notify");
|
dputs("got property notify");
|
||||||
#endif
|
#endif
|
||||||
if ((wwin=wWindowFor(event->xproperty.window))) {
|
if ((wwin=wWindowFor(event->xproperty.window))) {
|
||||||
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
||||||
@@ -854,7 +841,7 @@ handleClientMessage(XEvent *event)
|
|||||||
WObjDescriptor *desc;
|
WObjDescriptor *desc;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got client message");
|
dputs("got client message");
|
||||||
#endif
|
#endif
|
||||||
/* handle transition from Normal to Iconic state */
|
/* handle transition from Normal to Iconic state */
|
||||||
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
||||||
@@ -983,6 +970,7 @@ raiseWindow(WScreen *scr)
|
|||||||
static void
|
static void
|
||||||
handleEnterNotify(XEvent *event)
|
handleEnterNotify(XEvent *event)
|
||||||
{
|
{
|
||||||
|
WMenu *menu;
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WObjDescriptor *desc = NULL;
|
WObjDescriptor *desc = NULL;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@@ -990,7 +978,7 @@ handleEnterNotify(XEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got enter notify");
|
dputs("got enter notify");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (XCheckTypedWindowEvent(dpy, event->xcrossing.window, LeaveNotify,
|
if (XCheckTypedWindowEvent(dpy, event->xcrossing.window, LeaveNotify,
|
||||||
@@ -1003,6 +991,28 @@ handleEnterNotify(XEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* start my fix scrolled menus */
|
||||||
|
if (wPreferences.scrollable_menus) {
|
||||||
|
if (scr->flags.jump_back_pending ||
|
||||||
|
event->xcrossing.x_root <= 1 ||
|
||||||
|
event->xcrossing.x_root >= (scr->scr_width - 2) ||
|
||||||
|
event->xcrossing.y_root <= 1 ||
|
||||||
|
event->xcrossing.y_root >= (scr->scr_height - 2)) {
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug_puts("pointer at screen edge in EnterNotify event, fear");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
menu = wMenuUnderPointer(scr);
|
||||||
|
if (menu!=NULL) {
|
||||||
|
wMenuScroll(menu, event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* end fix scrolled menus */
|
||||||
|
|
||||||
|
|
||||||
if (XFindContext(dpy, event->xcrossing.window, wWinContext,
|
if (XFindContext(dpy, event->xcrossing.window, wWinContext,
|
||||||
(XPointer *)&desc)!=XCNOENT) {
|
(XPointer *)&desc)!=XCNOENT) {
|
||||||
if(desc->handle_enternotify)
|
if(desc->handle_enternotify)
|
||||||
@@ -1120,7 +1130,7 @@ handleShapeNotify(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("got shape notify");
|
dputs("got shape notify");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
||||||
@@ -1274,6 +1284,7 @@ windowUnderPointer(WScreen *scr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WEENDOZE_CYCLE
|
#ifdef WEENDOZE_CYCLE
|
||||||
|
|
||||||
static WWindow*
|
static WWindow*
|
||||||
@@ -1335,6 +1346,8 @@ nextToFocusBefore(WWindow *wwin)
|
|||||||
return wwin;
|
return wwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||||
{
|
{
|
||||||
@@ -1349,7 +1362,7 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
if (!wwin)
|
if (!wwin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* puts("IN");*/
|
/* dputs("IN");*/
|
||||||
keymap = XGetModifierMapping(dpy);
|
keymap = XGetModifierMapping(dpy);
|
||||||
|
|
||||||
|
|
||||||
@@ -1385,7 +1398,7 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
WMHandleEvent(&ev);
|
WMHandleEvent(&ev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*puts("EV");*/
|
/*dputs("EV");*/
|
||||||
/* ignore CapsLock */
|
/* ignore CapsLock */
|
||||||
modifiers = ev.xkey.state & ValidModMask;
|
modifiers = ev.xkey.state & ValidModMask;
|
||||||
|
|
||||||
@@ -1426,7 +1439,7 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*puts("OUT");*/
|
/*dputs("OUT");*/
|
||||||
XFree(keymap);
|
XFree(keymap);
|
||||||
|
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
@@ -1449,7 +1462,7 @@ handleKeyPress(XEvent *event)
|
|||||||
WWindow *wwin = scr->focused_window;
|
WWindow *wwin = scr->focused_window;
|
||||||
int i;
|
int i;
|
||||||
int modifiers;
|
int modifiers;
|
||||||
int command=-1;
|
int command=-1, index;
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
XkbStateRec staterec;
|
XkbStateRec staterec;
|
||||||
#endif /*KEEP_XKB_LOCK_STATUS*/
|
#endif /*KEEP_XKB_LOCK_STATUS*/
|
||||||
@@ -1684,36 +1697,44 @@ handleKeyPress(XEvent *event)
|
|||||||
case WKBD_WINDOW9:
|
case WKBD_WINDOW9:
|
||||||
case WKBD_WINDOW10:
|
case WKBD_WINDOW10:
|
||||||
#endif
|
#endif
|
||||||
if ( scr->shortcutSelectedWindows[command-WKBD_WINDOW1]) {
|
|
||||||
LinkedList *list = scr->shortcutSelectedWindows[command-WKBD_WINDOW1];
|
#define INITBAG(bag) if (bag) WMEmptyBag(bag); else bag = WMCreateBag(4)
|
||||||
|
|
||||||
|
index = command-WKBD_WINDOW1;
|
||||||
|
|
||||||
|
if (scr->shortcutSelectedWindows[index]) {
|
||||||
|
WMBag *list = scr->shortcutSelectedWindows[index];
|
||||||
int cw;
|
int cw;
|
||||||
|
int i;
|
||||||
|
|
||||||
wUnselectWindows(scr);
|
wUnselectWindows(scr);
|
||||||
if (scr->shortcutWindow[command-WKBD_WINDOW1])
|
if (scr->shortcutWindow[index])
|
||||||
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
|
wMakeWindowVisible(scr->shortcutWindow[index]);
|
||||||
cw = scr->current_workspace;
|
cw = scr->current_workspace;
|
||||||
while (list) {
|
for (i = 0; i < WMGetBagItemCount(list); i++) {
|
||||||
wWindowChangeWorkspace(list->head, cw);
|
WWindow *wwin = WMGetFromBag(list, i);
|
||||||
wMakeWindowVisible(list->head);
|
wWindowChangeWorkspace(wwin, cw);
|
||||||
wSelectWindow(list->head, True);
|
wMakeWindowVisible(wwin);
|
||||||
list = list->tail;
|
wSelectWindow(wwin, True);
|
||||||
}
|
}
|
||||||
} else if (scr->shortcutWindow[command-WKBD_WINDOW1]){
|
} else if (scr->shortcutWindow[index]){
|
||||||
|
|
||||||
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
|
wMakeWindowVisible(scr->shortcutWindow[index]);
|
||||||
|
|
||||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||||
|
|
||||||
scr->shortcutWindow[command-WKBD_WINDOW1] = wwin;
|
scr->shortcutWindow[index] = wwin;
|
||||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
LinkedList *sl;
|
WMBag *bag;
|
||||||
|
int i;
|
||||||
|
|
||||||
sl = scr->selected_windows;
|
bag = scr->selected_windows;
|
||||||
list_free(scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
INITBAG(scr->shortcutSelectedWindows[index]);
|
||||||
|
|
||||||
while (sl) {
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
scr->shortcutSelectedWindows[command-WKBD_WINDOW1] = list_cons(sl->head,scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
WWindow *tmp = WMGetFromBag(bag, i);
|
||||||
sl = sl->tail;
|
|
||||||
|
WMPutInBag(scr->shortcutSelectedWindows[index], tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
@@ -1722,20 +1743,23 @@ handleKeyPress(XEvent *event)
|
|||||||
wSelectWindow(wwin, !wwin->flags.selected);
|
wSelectWindow(wwin, !wwin->flags.selected);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
} else if (scr->selected_windows) {
|
} else if (WMGetBagItemCount(scr->selected_windows)) {
|
||||||
|
|
||||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
LinkedList *sl;
|
WMBag *bag;
|
||||||
|
int i;
|
||||||
|
|
||||||
sl = scr->selected_windows;
|
bag = scr->selected_windows;
|
||||||
list_free(scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
INITBAG(scr->shortcutSelectedWindows[index]);
|
||||||
|
|
||||||
while (sl) {
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
scr->shortcutSelectedWindows[command-WKBD_WINDOW1] = list_cons(sl->head,scr->shortcutSelectedWindows[command-WKBD_WINDOW1]);
|
WWindow *tmp = WMGetFromBag(bag, i);
|
||||||
sl = sl->tail;
|
|
||||||
|
WMPutInBag(scr->shortcutSelectedWindows[index], tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef INITBAG
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WKBD_NEXTWSLAYER:
|
case WKBD_NEXTWSLAYER:
|
||||||
@@ -1805,7 +1829,7 @@ handleMotionNotify(XEvent *event)
|
|||||||
event->xmotion.y_root >= (scr->scr_height - 2)) {
|
event->xmotion.y_root >= (scr->scr_height - 2)) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("pointer at screen edge");
|
dputs("pointer at screen edge");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
menu = wMenuUnderPointer(scr);
|
menu = wMenuUnderPointer(scr);
|
||||||
|
|||||||
@@ -158,4 +158,12 @@ void ExecExitScript();
|
|||||||
Bool wFetchName(Display *dpy, Window win, char **winname);
|
Bool wFetchName(Display *dpy, Window win, char **winname);
|
||||||
Bool wGetIconName(Display *dpy, Window win, char **iconname);
|
Bool wGetIconName(Display *dpy, Window win, char **iconname);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* debugging stuff */
|
||||||
|
|
||||||
|
void dprintf(char *, ...);
|
||||||
|
void dputs(char *);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
226
src/list.c
226
src/list.c
@@ -1,226 +0,0 @@
|
|||||||
/* Generic single linked list to keep various information
|
|
||||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
|
|
||||||
Author: Kresten Krab Thorup
|
|
||||||
|
|
||||||
Many modifications by Alfredo K. Kojima
|
|
||||||
Some fixes and additions by Dan Pascu
|
|
||||||
|
|
||||||
|
|
||||||
This file is part of GNU CC.
|
|
||||||
|
|
||||||
GNU CC 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, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/* As a special exception, if you link this library with files compiled with
|
|
||||||
GCC to produce an executable, this does not cause the resulting executable
|
|
||||||
to be covered by the GNU General Public License. This exception does not
|
|
||||||
however invalidate any other reasons why the executable file might be
|
|
||||||
covered by the GNU General Public License. */
|
|
||||||
|
|
||||||
#include <WUtil.h>
|
|
||||||
#include "list.h"
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define xrealloc(ptr, size) wrealloc(ptr, size)
|
|
||||||
|
|
||||||
/* Return a cons cell produced from (head . tail) */
|
|
||||||
|
|
||||||
INLINE LinkedList*
|
|
||||||
list_cons(void* head, LinkedList* tail)
|
|
||||||
{
|
|
||||||
LinkedList* cell;
|
|
||||||
|
|
||||||
cell = (LinkedList*)wmalloc(sizeof(LinkedList));
|
|
||||||
cell->head = head;
|
|
||||||
cell->tail = tail;
|
|
||||||
return cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Inserts "item" in list using "compare" function to make a sorted list */
|
|
||||||
|
|
||||||
INLINE void
|
|
||||||
list_insert_sorted(void* item, LinkedList** list, int (*compare)(void*, void*))
|
|
||||||
{
|
|
||||||
LinkedList *tmp, *cell;
|
|
||||||
|
|
||||||
cell = (LinkedList*)wmalloc(sizeof(LinkedList));
|
|
||||||
cell->head = item;
|
|
||||||
if ((*list == NULL) || ((*compare)((*list)->head, item) >= 0)) {
|
|
||||||
cell->tail = *list;
|
|
||||||
*list = cell;
|
|
||||||
} else {
|
|
||||||
tmp = *list;
|
|
||||||
while (tmp->tail) {
|
|
||||||
if ((*compare)(tmp->tail->head, item) >= 0)
|
|
||||||
break;
|
|
||||||
tmp = tmp->tail;
|
|
||||||
}
|
|
||||||
cell->tail = tmp->tail;
|
|
||||||
tmp->tail = cell;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the length of a list, list_length(NULL) returns zero */
|
|
||||||
|
|
||||||
INLINE int
|
|
||||||
list_length(LinkedList* list)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while(list)
|
|
||||||
{
|
|
||||||
i += 1;
|
|
||||||
list = list->tail;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the Nth element of LIST, where N count from zero. If N
|
|
||||||
larger than the list length, NULL is returned */
|
|
||||||
|
|
||||||
INLINE void*
|
|
||||||
list_nth(int index, LinkedList* list)
|
|
||||||
{
|
|
||||||
while(index-- != 0)
|
|
||||||
{
|
|
||||||
if(list->tail)
|
|
||||||
list = list->tail;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return list->head;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the element at the head by replacing it by its successor */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
INLINE void
|
|
||||||
list_remove_head(LinkedList** list)
|
|
||||||
{
|
|
||||||
if (!*list) return;
|
|
||||||
if ((*list)->tail)
|
|
||||||
{
|
|
||||||
LinkedList* tail = (*list)->tail; /* fetch next */
|
|
||||||
*(*list) = *tail; /* copy next to list head */
|
|
||||||
free(tail); /* free next */
|
|
||||||
}
|
|
||||||
else /* only one element in list */
|
|
||||||
{
|
|
||||||
free(*list);
|
|
||||||
(*list) = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alfredo, is there any reason for the function to be as above,
|
|
||||||
* instead of the more simple version below?
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* keep the pointer to the list unchanged, while the below would change
|
|
||||||
* it, but since the list is passed by reference that doesn't make any
|
|
||||||
* sense. -Alfredo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#else
|
|
||||||
INLINE void
|
|
||||||
list_remove_head(LinkedList** list)
|
|
||||||
{
|
|
||||||
if (!*list) return;
|
|
||||||
|
|
||||||
{
|
|
||||||
LinkedList* next = (*list)->tail; /* fetch next */
|
|
||||||
free(*list); /* free head */
|
|
||||||
*list = next; /* update list pointer */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Remove the element with `car' set to ELEMENT */
|
|
||||||
/*
|
|
||||||
INLINE void
|
|
||||||
list_remove_elem(LinkedList** list, void* elem)
|
|
||||||
{
|
|
||||||
while (*list)
|
|
||||||
{
|
|
||||||
if ((*list)->head == elem)
|
|
||||||
list_remove_head(list);
|
|
||||||
*list = (*list ? (*list)->tail : NULL);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
INLINE LinkedList *
|
|
||||||
list_remove_elem(LinkedList* list, void* elem)
|
|
||||||
{
|
|
||||||
LinkedList *tmp;
|
|
||||||
|
|
||||||
if (list) {
|
|
||||||
if (list->head == elem) {
|
|
||||||
tmp = list->tail;
|
|
||||||
free(list);
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
list->tail = list_remove_elem(list->tail, elem);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Return element that has ELEM as car */
|
|
||||||
|
|
||||||
INLINE LinkedList*
|
|
||||||
list_find(LinkedList* list, void* elem)
|
|
||||||
{
|
|
||||||
while(list)
|
|
||||||
{
|
|
||||||
if (list->head == elem)
|
|
||||||
return list;
|
|
||||||
list = list->tail;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free list (backwards recursive) */
|
|
||||||
|
|
||||||
INLINE void
|
|
||||||
list_free(LinkedList* list)
|
|
||||||
{
|
|
||||||
if(list)
|
|
||||||
{
|
|
||||||
list_free(list->tail);
|
|
||||||
free(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Map FUNCTION over all elements in LIST */
|
|
||||||
|
|
||||||
INLINE void
|
|
||||||
list_mapcar(LinkedList* list, void(*function)(void*))
|
|
||||||
{
|
|
||||||
while(list)
|
|
||||||
{
|
|
||||||
(*function)(list->head);
|
|
||||||
list = list->tail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
60
src/list.h
60
src/list.h
@@ -1,60 +0,0 @@
|
|||||||
/* Generic single linked list to keep various information
|
|
||||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Author: Kresten Krab Thorup
|
|
||||||
|
|
||||||
This file is part of GNU CC.
|
|
||||||
|
|
||||||
GNU CC 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, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/* As a special exception, if you link this library with files compiled with
|
|
||||||
GCC to produce an executable, this does not cause the resulting executable
|
|
||||||
to be covered by the GNU General Public License. This exception does not
|
|
||||||
however invalidate any other reasons why the executable file might be
|
|
||||||
covered by the GNU General Public License. */
|
|
||||||
|
|
||||||
#ifndef __LIST_H_
|
|
||||||
#define __LIST_H_
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wconfig.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct LinkedList {
|
|
||||||
void *head;
|
|
||||||
struct LinkedList *tail;
|
|
||||||
} LinkedList;
|
|
||||||
|
|
||||||
INLINE LinkedList* list_cons(void* head, LinkedList* tail);
|
|
||||||
|
|
||||||
INLINE void list_insert_sorted(void* item, LinkedList** list,
|
|
||||||
int (*compare)(void*, void*));
|
|
||||||
|
|
||||||
INLINE int list_length(LinkedList* list);
|
|
||||||
|
|
||||||
INLINE void* list_nth(int index, LinkedList* list);
|
|
||||||
|
|
||||||
INLINE void list_remove_head(LinkedList** list);
|
|
||||||
|
|
||||||
INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
|
|
||||||
|
|
||||||
INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
|
|
||||||
|
|
||||||
INLINE LinkedList*list_find(LinkedList* list, void* elem);
|
|
||||||
|
|
||||||
INLINE void list_free(LinkedList* list);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
48
src/main.c
48
src/main.c
@@ -262,9 +262,9 @@ print_help()
|
|||||||
#endif
|
#endif
|
||||||
puts(_(" --no-dock do not open the application Dock"));
|
puts(_(" --no-dock do not open the application Dock"));
|
||||||
puts(_(" --no-clip do not open the workspace Clip"));
|
puts(_(" --no-clip do not open the workspace Clip"));
|
||||||
/*
|
|
||||||
puts(_(" --locale locale locale to use"));
|
puts(_(" --locale locale locale to use"));
|
||||||
*/
|
|
||||||
puts(_(" --visual-id visualid visual id of visual to use"));
|
puts(_(" --visual-id visualid visual id of visual to use"));
|
||||||
puts(_(" --static do not update or save configurations"));
|
puts(_(" --static do not update or save configurations"));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -342,7 +342,43 @@ ExecExitScript()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
char*
|
||||||
|
getFullPath(char *path)
|
||||||
|
{
|
||||||
|
char buffer[1024];
|
||||||
|
char *tmp;
|
||||||
|
char *basep = (char*)buffer;
|
||||||
|
|
||||||
|
if (*path != '/' && getcwd(buffer, 1023)) {
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (strncmp(path, "../", 3)==0) {
|
||||||
|
path += 3;
|
||||||
|
basep = strchr(basep, '/');
|
||||||
|
if (!basep || *path==0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*path == '/' || strncmp(path, "./",2)==0) {
|
||||||
|
tmp =
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* path
|
||||||
|
* ./path
|
||||||
|
* ../path
|
||||||
|
* ../../path
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return wstrappend(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@@ -358,8 +394,14 @@ main(int argc, char **argv)
|
|||||||
wsetabort(wAbort);
|
wsetabort(wAbort);
|
||||||
|
|
||||||
/* for telling WPrefs what's the name of the wmaker binary being ran */
|
/* for telling WPrefs what's the name of the wmaker binary being ran */
|
||||||
|
{
|
||||||
|
/* char *tmp;
|
||||||
|
|
||||||
|
tmp = getFullPath(argv[0]);*/
|
||||||
str = wstrappend("WMAKER_BIN_NAME=", argv[0]);
|
str = wstrappend("WMAKER_BIN_NAME=", argv[0]);
|
||||||
|
/* free(tmp);*/
|
||||||
putenv(str);
|
putenv(str);
|
||||||
|
}
|
||||||
|
|
||||||
ArgCount = argc;
|
ArgCount = argc;
|
||||||
Arguments = argv;
|
Arguments = argv;
|
||||||
@@ -397,7 +439,7 @@ main(int argc, char **argv)
|
|||||||
printf("Window Maker %s\n", VERSION);
|
printf("Window Maker %s\n", VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (strcmp(argv[i], "--global_defaults_path")==0) {
|
} else if (strcmp(argv[i], "--global_defaults_path")==0) {
|
||||||
puts(SYSCONFDIR);
|
printf("%s/WindowMaker\n", SYSCONFDIR);
|
||||||
exit(0);
|
exit(0);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
} else if (strcmp(argv[i], "--synchronous")==0) {
|
} else if (strcmp(argv[i], "--synchronous")==0) {
|
||||||
|
|||||||
23
src/menu.c
23
src/menu.c
@@ -126,9 +126,6 @@ appearanceObserver(void *self, WMNotification *notif)
|
|||||||
menu->frame->flags.need_texture_remake = 1;
|
menu->frame->flags.need_texture_remake = 1;
|
||||||
}
|
}
|
||||||
if (flags & (WColorSettings|WTextureSettings)) {
|
if (flags & (WColorSettings|WTextureSettings)) {
|
||||||
#ifdef DRAWSTRING_PLUGIN
|
|
||||||
XClearWindow(dpy, menu->frame->titlebar->window);
|
|
||||||
#endif
|
|
||||||
wFrameWindowPaint(menu->frame);
|
wFrameWindowPaint(menu->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +286,7 @@ wMenuInsertCallback(WMenu *menu, int index, char *text,
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
printf("Passed NULL as menu parameter to wMenuAddCallback() \n");
|
dprintf("Passed NULL as menu parameter to wMenuAddCallback() \n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -302,7 +299,7 @@ wMenuInsertCallback(WMenu *menu, int index, char *text,
|
|||||||
if (menu->entry_no >= menu->alloced_entries) {
|
if (menu->entry_no >= menu->alloced_entries) {
|
||||||
void *tmp;
|
void *tmp;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("doing wrealloc()");
|
dputs("doing wrealloc()");
|
||||||
#endif
|
#endif
|
||||||
tmp = wrealloc(menu->entries,
|
tmp = wrealloc(menu->entries,
|
||||||
sizeof(WMenuEntry)*(menu->alloced_entries+5));
|
sizeof(WMenuEntry)*(menu->alloced_entries+5));
|
||||||
@@ -1782,7 +1779,7 @@ wMenuScroll(WMenu *menu, XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("Entering menu Scroll");
|
dputs("Entering menu Scroll");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (omenu->jump_back)
|
if (omenu->jump_back)
|
||||||
@@ -1808,7 +1805,12 @@ wMenuScroll(WMenu *menu, XEvent *event)
|
|||||||
WMNextEvent(dpy, &ev);
|
WMNextEvent(dpy, &ev);
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
|
/*
|
||||||
|
this um causes a nasty crash ugly ugh i dont see *why* we do this,
|
||||||
|
everything seems fine without it. ( swivel )
|
||||||
WMHandleEvent(&ev);
|
WMHandleEvent(&ev);
|
||||||
|
*/
|
||||||
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
x = (ev.type==MotionNotify) ? ev.xmotion.x_root : ev.xcrossing.x_root;
|
x = (ev.type==MotionNotify) ? ev.xmotion.x_root : ev.xcrossing.x_root;
|
||||||
y = (ev.type==MotionNotify) ? ev.xmotion.y_root : ev.xcrossing.y_root;
|
y = (ev.type==MotionNotify) ? ev.xmotion.y_root : ev.xcrossing.y_root;
|
||||||
@@ -1888,7 +1890,7 @@ wMenuScroll(WMenu *menu, XEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
puts("Leaving menu Scroll");
|
dputs("Leaving menu Scroll");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2233,7 +2235,7 @@ wMenuMove(WMenu *menu, int x, int y, int submenus)
|
|||||||
|
|
||||||
if (i>=0 && menu->cascades) {
|
if (i>=0 && menu->cascades) {
|
||||||
submenu = menu->cascades[i];
|
submenu = menu->cascades[i];
|
||||||
if (submenu->flags.mapped && !submenu->flags.buttoned)
|
if (submenu->flags.mapped && !submenu->flags.buttoned) {
|
||||||
if (wPreferences.align_menus) {
|
if (wPreferences.align_menus) {
|
||||||
wMenuMove(submenu, x + MENUW(menu), y, submenus);
|
wMenuMove(submenu, x + MENUW(menu), y, submenus);
|
||||||
} else {
|
} else {
|
||||||
@@ -2243,6 +2245,7 @@ wMenuMove(WMenu *menu, int x, int y, int submenus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (submenus<0 && menu->parent!=NULL && menu->parent->flags.mapped &&
|
if (submenus<0 && menu->parent!=NULL && menu->parent->flags.mapped &&
|
||||||
!menu->parent->flags.buttoned) {
|
!menu->parent->flags.buttoned) {
|
||||||
if (wPreferences.align_menus) {
|
if (wPreferences.align_menus) {
|
||||||
@@ -2311,7 +2314,7 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
|
|||||||
Bool started;
|
Bool started;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Moving menu\n");
|
dprintf("Moving menu\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* can't touch the menu copy */
|
/* can't touch the menu copy */
|
||||||
@@ -2398,7 +2401,7 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
|
|||||||
if (ev.xbutton.button != event->xbutton.button)
|
if (ev.xbutton.button != event->xbutton.button)
|
||||||
break;
|
break;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("End menu move\n");
|
dprintf("End menu move\n");
|
||||||
#endif
|
#endif
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
return;
|
return;
|
||||||
|
|||||||
77
src/misc.c
77
src/misc.c
@@ -28,6 +28,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
#include "xutil.h"
|
#include "xutil.h"
|
||||||
#include "xmodifier.h"
|
#include "xmodifier.h"
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
/**** global variables *****/
|
/**** global variables *****/
|
||||||
|
|
||||||
@@ -682,26 +682,26 @@ next_token(char *word, char **next)
|
|||||||
void
|
void
|
||||||
ParseCommand(char *command, char ***argv, int *argc)
|
ParseCommand(char *command, char ***argv, int *argc)
|
||||||
{
|
{
|
||||||
LinkedList *list = NULL;
|
WMBag *bag = WMCreateBag(4);
|
||||||
char *token, *line;
|
char *token, *line;
|
||||||
int count, i;
|
int count, j;
|
||||||
|
|
||||||
line = command;
|
line = command;
|
||||||
do {
|
do {
|
||||||
token = next_token(line, &line);
|
token = next_token(line, &line);
|
||||||
if (token) {
|
if (token) {
|
||||||
list = list_cons(token, list);
|
WMPutInBag(bag, token);
|
||||||
}
|
}
|
||||||
} while (token!=NULL && line!=NULL);
|
} while (token!=NULL && line!=NULL);
|
||||||
|
|
||||||
count = list_length(list);
|
count = WMGetBagItemCount(bag);
|
||||||
*argv = wmalloc(sizeof(char*)*count);
|
*argv = wmalloc(sizeof(char*)*count);
|
||||||
i = count;
|
for (j = 0; j < count; j++) {
|
||||||
while (list!=NULL) {
|
(*argv)[j] = WMGetFromBag(bag, j);
|
||||||
(*argv)[--i] = list->head;
|
|
||||||
list_remove_head(&list);
|
|
||||||
}
|
}
|
||||||
*argc = count;
|
*argc = count;
|
||||||
|
|
||||||
|
WMFreeBag(bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1387,6 +1387,34 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
WScreen *scr;
|
||||||
|
char *command;
|
||||||
|
} _tuple;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
shellCommandHandler(pid_t pid, unsigned char status, _tuple *data)
|
||||||
|
{
|
||||||
|
if (status == 127) {
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
|
buffer = wstrappend(_("Could not execute command: "), data->command);
|
||||||
|
|
||||||
|
wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
|
||||||
|
free(buffer);
|
||||||
|
} else if (status != 127) {
|
||||||
|
/*
|
||||||
|
printf("%s: %i\n", data->command, status);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
free(data->command);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ExecuteShellCommand(WScreen *scr, char *command)
|
ExecuteShellCommand(WScreen *scr, char *command)
|
||||||
{
|
{
|
||||||
@@ -1406,6 +1434,7 @@ ExecuteShellCommand(WScreen *scr, char *command)
|
|||||||
shell = "/bin/sh";
|
shell = "/bin/sh";
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
if (pid==0) {
|
if (pid==0) {
|
||||||
|
|
||||||
SetupEnvironment(scr);
|
SetupEnvironment(scr);
|
||||||
@@ -1418,5 +1447,35 @@ ExecuteShellCommand(WScreen *scr, char *command)
|
|||||||
Exit(-1);
|
Exit(-1);
|
||||||
} else if (pid < 0) {
|
} else if (pid < 0) {
|
||||||
wsyserror("cannot fork a new process");
|
wsyserror("cannot fork a new process");
|
||||||
|
} else {
|
||||||
|
_tuple *data = wmalloc(sizeof(_tuple));
|
||||||
|
|
||||||
|
data->scr = scr;
|
||||||
|
data->command = wstrdup(command);
|
||||||
|
|
||||||
|
wAddDeathHandler(pid, (WDeathHandler*)shellCommandHandler, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void dprintf(char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
vprintf(format, args);
|
||||||
|
fflush(stdout);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void dputs(char *text)
|
||||||
|
{
|
||||||
|
puts(text);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
#include "kwm.h"
|
#include "kwm.h"
|
||||||
@@ -327,7 +326,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
|
|
||||||
/* Display the width. */
|
/* Display the width. */
|
||||||
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
||||||
mx - fw/2 + 1, y - s + fh/2 + 1, num, strlen(num));
|
mx - fw/2 + 1, y - s - fh/2 + 1, num, strlen(num));
|
||||||
} else {
|
} else {
|
||||||
XClearArea(dpy, scr->geometry_display, 1, 1,
|
XClearArea(dpy, scr->geometry_display, 1, 1,
|
||||||
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
||||||
@@ -402,18 +401,19 @@ XUnmapWindow(dpy, (w)->screen_ptr->geometry_display);
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doWindowMove(WWindow *wwin, LinkedList *list, int dx, int dy)
|
doWindowMove(WWindow *wwin, WMBag *bag, int dx, int dy)
|
||||||
{
|
{
|
||||||
WWindow *tmpw;
|
WWindow *tmpw;
|
||||||
int x, y;
|
int x, y;
|
||||||
int scr_width = wwin->screen_ptr->scr_width;
|
int scr_width = wwin->screen_ptr->scr_width;
|
||||||
int scr_height = wwin->screen_ptr->scr_height;
|
int scr_height = wwin->screen_ptr->scr_height;
|
||||||
|
|
||||||
if (!list) {
|
if (!bag || !WMGetBagItemCount(bag)) {
|
||||||
wWindowMove(wwin, wwin->frame_x + dx, wwin->frame_y + dy);
|
wWindowMove(wwin, wwin->frame_x + dx, wwin->frame_y + dy);
|
||||||
} else {
|
} else {
|
||||||
while (list) {
|
int i;
|
||||||
tmpw = list->head;
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
|
tmpw = WMGetFromBag(bag, i);
|
||||||
x = tmpw->frame_x + dx;
|
x = tmpw->frame_x + dx;
|
||||||
y = tmpw->frame_y + dy;
|
y = tmpw->frame_y + dy;
|
||||||
|
|
||||||
@@ -430,7 +430,6 @@ doWindowMove(WWindow *wwin, LinkedList *list, int dx, int dy)
|
|||||||
y = scr_height - 20;
|
y = scr_height - 20;
|
||||||
|
|
||||||
wWindowMove(tmpw, x, y);
|
wWindowMove(tmpw, x, y);
|
||||||
list = list->tail;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -467,14 +466,14 @@ drawTransparentFrame(WWindow *wwin, int x, int y, int width, int height)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawFrames(WWindow *wwin, LinkedList *list, int dx, int dy)
|
drawFrames(WWindow *wwin, WMBag *bag, int dx, int dy)
|
||||||
{
|
{
|
||||||
WWindow *tmpw;
|
WWindow *tmpw;
|
||||||
int scr_width = wwin->screen_ptr->scr_width;
|
int scr_width = wwin->screen_ptr->scr_width;
|
||||||
int scr_height = wwin->screen_ptr->scr_height;
|
int scr_height = wwin->screen_ptr->scr_height;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (!list) {
|
if (!bag) {
|
||||||
|
|
||||||
x = wwin->frame_x + dx;
|
x = wwin->frame_x + dx;
|
||||||
y = wwin->frame_y + dy;
|
y = wwin->frame_y + dy;
|
||||||
@@ -484,8 +483,9 @@ drawFrames(WWindow *wwin, LinkedList *list, int dx, int dy)
|
|||||||
wwin->frame->core->height);
|
wwin->frame->core->height);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
while (list) {
|
int i;
|
||||||
tmpw = list->head;
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
|
tmpw = WMGetFromBag(bag, i);
|
||||||
x = tmpw->frame_x + dx;
|
x = tmpw->frame_x + dx;
|
||||||
y = tmpw->frame_y + dy;
|
y = tmpw->frame_y + dy;
|
||||||
|
|
||||||
@@ -503,8 +503,6 @@ drawFrames(WWindow *wwin, LinkedList *list, int dx, int dy)
|
|||||||
|
|
||||||
drawTransparentFrame(tmpw, x, y, tmpw->frame->core->width,
|
drawTransparentFrame(tmpw, x, y, tmpw->frame->core->width,
|
||||||
tmpw->frame->core->height);
|
tmpw->frame->core->height);
|
||||||
|
|
||||||
list = list->tail;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -957,8 +955,6 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
int t_edge, b_edge;
|
int t_edge, b_edge;
|
||||||
int edge_t, edge_b;
|
int edge_t, edge_b;
|
||||||
int resist;
|
int resist;
|
||||||
WWindow *rwin;
|
|
||||||
WWindow *rrwin;
|
|
||||||
|
|
||||||
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
||||||
attract = wPreferences.attract;
|
attract = wPreferences.attract;
|
||||||
@@ -979,7 +975,8 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
looprw = data->rightList[i];
|
looprw = data->rightList[i];
|
||||||
if (!(data->realY > WBOTTOM(looprw)
|
if (!(data->realY > WBOTTOM(looprw)
|
||||||
|| (data->realY + data->winHeight) < WTOP(looprw))) {
|
|| (data->realY + data->winHeight) < WTOP(looprw))) {
|
||||||
if (attract || (data->realX < (WRIGHT(looprw) + 2)) && dx < 0) {
|
if (attract
|
||||||
|
|| ((data->realX < (WRIGHT(looprw) + 2)) && dx < 0)) {
|
||||||
l_edge = WRIGHT(looprw) + 1;
|
l_edge = WRIGHT(looprw) + 1;
|
||||||
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
||||||
}
|
}
|
||||||
@@ -1007,7 +1004,8 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
looprw = data->leftList[i];
|
looprw = data->leftList[i];
|
||||||
if (!(data->realY > WBOTTOM(looprw)
|
if (!(data->realY > WBOTTOM(looprw)
|
||||||
|| (data->realY + data->winHeight) < WTOP(looprw))) {
|
|| (data->realY + data->winHeight) < WTOP(looprw))) {
|
||||||
if (attract || ((data->realX + data->winWidth) > (WLEFT(looprw) - 1)) && dx > 0) {
|
if (attract
|
||||||
|
|| (((data->realX + data->winWidth) > (WLEFT(looprw) - 1)) && dx > 0)) {
|
||||||
edge_r = WLEFT(looprw);
|
edge_r = WLEFT(looprw);
|
||||||
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
||||||
}
|
}
|
||||||
@@ -1040,8 +1038,7 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
hresist = True;
|
hresist = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (resist > 0 && attract && winL >= r_edge - resist && winL <= r_edge + resist) {
|
if (resist > 0 && attract && winL >= r_edge - resist && winL <= r_edge + resist) {
|
||||||
newX = r_edge;
|
newX = r_edge;
|
||||||
hresist = True;
|
hresist = True;
|
||||||
@@ -1053,8 +1050,7 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
newX = edge_l - data->winWidth;
|
newX = edge_l - data->winWidth;
|
||||||
hresist = True;
|
hresist = True;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (resist > 0) {
|
if (resist > 0) {
|
||||||
if ((attract && winR >= edge_r - resist && winR <= edge_r + resist)
|
if ((attract && winR >= edge_r - resist && winR <= edge_r + resist)
|
||||||
|| (dx > 0 && winR >= edge_r && winR <= edge_r + resist)) {
|
|| (dx > 0 && winR >= edge_r && winR <= edge_r + resist)) {
|
||||||
@@ -1077,7 +1073,8 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
looprw = data->bottomList[i];
|
looprw = data->bottomList[i];
|
||||||
if (!(data->realX > WRIGHT(looprw)
|
if (!(data->realX > WRIGHT(looprw)
|
||||||
|| (data->realX + data->winWidth) < WLEFT(looprw))) {
|
|| (data->realX + data->winWidth) < WLEFT(looprw))) {
|
||||||
if (attract || (data->realY < (WBOTTOM(looprw) + 2)) && dy < 0) {
|
if (attract
|
||||||
|
|| ((data->realY < (WBOTTOM(looprw) + 2)) && dy < 0)) {
|
||||||
t_edge = WBOTTOM(looprw) + 1;
|
t_edge = WBOTTOM(looprw) + 1;
|
||||||
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
||||||
}
|
}
|
||||||
@@ -1105,7 +1102,8 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
|||||||
looprw = data->topList[i];
|
looprw = data->topList[i];
|
||||||
if (!(data->realX > WRIGHT(looprw)
|
if (!(data->realX > WRIGHT(looprw)
|
||||||
|| (data->realX + data->winWidth) < WLEFT(looprw))) {
|
|| (data->realX + data->winWidth) < WLEFT(looprw))) {
|
||||||
if (attract || ((data->realY + data->winHeight) > (WTOP(looprw) - 1)) && dy > 0) {
|
if (attract
|
||||||
|
|| (((data->realY + data->winHeight) > (WTOP(looprw) - 1)) && dy > 0)) {
|
||||||
edge_b = WTOP(looprw);
|
edge_b = WTOP(looprw);
|
||||||
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
resist = WIN_RESISTANCE(wPreferences.edge_resistance);
|
||||||
}
|
}
|
||||||
@@ -1482,16 +1480,16 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
|
|
||||||
if(done==2) {
|
if(done==2) {
|
||||||
if (wwin->flags.shaded || scr->selected_windows) {
|
if (wwin->flags.shaded || scr->selected_windows) {
|
||||||
LinkedList *list;
|
WMBag *bag;
|
||||||
list=scr->selected_windows;
|
bag=scr->selected_windows;
|
||||||
if (!scr->selected_windows) {
|
if (!WMGetBagItemCount(scr->selected_windows)) {
|
||||||
wWindowMove(wwin, src_x+off_x, src_y+off_y);
|
wWindowMove(wwin, src_x+off_x, src_y+off_y);
|
||||||
wWindowSynthConfigureNotify(wwin);
|
wWindowSynthConfigureNotify(wwin);
|
||||||
} else {
|
} else {
|
||||||
|
int i;
|
||||||
doWindowMove(wwin,scr->selected_windows,off_x,off_y);
|
doWindowMove(wwin,scr->selected_windows,off_x,off_y);
|
||||||
while (list) {
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
wWindowSynthConfigureNotify(list->head);
|
wWindowSynthConfigureNotify(WMGetFromBag(bag, i));
|
||||||
list = list->tail;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2037,13 +2035,18 @@ wUnselectWindows(WScreen *scr)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
while (scr->selected_windows) {
|
if (!scr->selected_windows)
|
||||||
wwin = scr->selected_windows->head;
|
return;
|
||||||
|
|
||||||
|
while (WMGetBagItemCount(scr->selected_windows)) {
|
||||||
|
wwin = WMGetFromBag(scr->selected_windows, 0);
|
||||||
if (wwin->flags.miniaturized && wwin->icon && wwin->icon->selected)
|
if (wwin->flags.miniaturized && wwin->icon && wwin->icon->selected)
|
||||||
wIconSelect(wwin->icon);
|
wIconSelect(wwin->icon);
|
||||||
|
|
||||||
wSelectWindow(wwin, False);
|
wSelectWindow(wwin, False);
|
||||||
}
|
}
|
||||||
|
WMFreeBag(scr->selected_windows);
|
||||||
|
scr->selected_windows = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
|
|||||||
220
src/placement.c
220
src/placement.c
@@ -26,6 +26,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "wcore.h"
|
#include "wcore.h"
|
||||||
@@ -39,7 +40,6 @@
|
|||||||
#include "appicon.h"
|
#include "appicon.h"
|
||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
@@ -252,115 +252,163 @@ PlaceIcon(WScreen *scr, int *x_ret, int *y_ret)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
/*
|
||||||
|
* This function calculates the length of the intersection of two
|
||||||
|
* line sections. (Hey, is that english?)
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
calcIntersectionLength(int p1, int l1, int p2, int l2)
|
||||||
|
{
|
||||||
|
int isect;
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
if (p1 > p2) {
|
||||||
|
tmp = p1;
|
||||||
|
p1 = p2;
|
||||||
|
p2 = tmp;
|
||||||
|
tmp = l1;
|
||||||
|
l1 = l2;
|
||||||
|
l2 = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p1 + l1 < p2)
|
||||||
|
isect = 0;
|
||||||
|
else if (p2 + l2 < p1 + l1)
|
||||||
|
isect = l2;
|
||||||
|
else
|
||||||
|
isect = p1 + l1 - p2;
|
||||||
|
|
||||||
|
return isect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function calculates the area of the intersection of two rectangles.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
calcIntersectionArea(int x1, int y1, int w1, int h1,
|
||||||
|
int x2, int y2, int w2, int h2)
|
||||||
|
{
|
||||||
|
return calcIntersectionLength(x1, w1, x2, w2)
|
||||||
|
* calcIntersectionLength(y1, h1, y2, h2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
calcSumOfCoveredAreas(WWindow *wwin, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
int sum_isect = 0;
|
||||||
|
WWindow *test_window;
|
||||||
|
int tw,tx,ty,th;
|
||||||
|
|
||||||
|
test_window = wwin->screen_ptr->focused_window;
|
||||||
|
for(;test_window != NULL && test_window->prev != NULL;)
|
||||||
|
test_window = test_window->prev;
|
||||||
|
|
||||||
|
for(; test_window != NULL; test_window = test_window->next) {
|
||||||
|
if (test_window->frame->core->stacking->window_level
|
||||||
|
< WMNormalLevel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
tw = test_window->client.width;
|
||||||
|
if (test_window->flags.shaded)
|
||||||
|
th = test_window->frame->top_width;
|
||||||
|
else
|
||||||
|
th = test_window->client.height + extra_height;
|
||||||
|
#else
|
||||||
|
tw = test_window->frame->core->width;
|
||||||
|
th = test_window->frame->core->height;
|
||||||
|
#endif
|
||||||
|
tx = test_window->frame_x;
|
||||||
|
ty = test_window->frame_y;
|
||||||
|
|
||||||
|
if (test_window->flags.mapped ||
|
||||||
|
(test_window->flags.shaded &&
|
||||||
|
!(test_window->flags.miniaturized ||
|
||||||
|
test_window->flags.hidden))) {
|
||||||
|
sum_isect += calcIntersectionArea(tx, ty, tw, th, x, y, w, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum_isect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
||||||
unsigned int width, unsigned int height, int tryCount)
|
unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
int test_x = 0, test_y = Y_ORIGIN(scr);
|
int test_x = 0, test_y = Y_ORIGIN(scr);
|
||||||
int loc_ok = False, tw,tx,ty,th;
|
int from_x, to_x, from_y, to_y;
|
||||||
int swidth, sx;
|
int sx;
|
||||||
WWindow *test_window;
|
int min_isect, min_isect_x, min_isect_y;
|
||||||
|
int sum_isect;
|
||||||
int extra_height;
|
int extra_height;
|
||||||
WArea usableArea = scr->totalUsableArea;
|
WArea usableArea = scr->totalUsableArea;
|
||||||
|
|
||||||
if (wwin->frame)
|
if (wwin->frame)
|
||||||
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
|
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
|
||||||
else
|
else
|
||||||
extra_height = 24; /* random value */
|
extra_height = 24; /* random value */
|
||||||
|
|
||||||
swidth = usableArea.x2-usableArea.x1;
|
|
||||||
sx = X_ORIGIN(scr);
|
sx = X_ORIGIN(scr);
|
||||||
|
|
||||||
/* this was based on fvwm2's smart placement */
|
min_isect = INT_MAX;
|
||||||
|
min_isect_x = sx;
|
||||||
|
min_isect_y = test_y;
|
||||||
|
|
||||||
height += extra_height;
|
height += extra_height;
|
||||||
|
|
||||||
while (((test_y + height) < (scr->scr_height)) && (!loc_ok)) {
|
while (((test_y + height) < usableArea.y2)) {
|
||||||
|
|
||||||
test_x = sx;
|
test_x = sx;
|
||||||
|
|
||||||
while (((test_x + width) < swidth) && (!loc_ok)) {
|
while ((test_x + width) < usableArea.x2) {
|
||||||
|
|
||||||
loc_ok = True;
|
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
||||||
test_window = scr->focused_window;
|
width, height);
|
||||||
|
|
||||||
while ((test_window != NULL) && (loc_ok == True)) {
|
if ( sum_isect < min_isect ) {
|
||||||
|
min_isect = sum_isect;
|
||||||
if (test_window->frame->core->stacking->window_level
|
min_isect_x = test_x;
|
||||||
< WMNormalLevel && tryCount > 0) {
|
min_isect_y = test_y;
|
||||||
test_window = test_window->next;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
tw = test_window->client.width;
|
|
||||||
if (test_window->flags.shaded)
|
|
||||||
th = test_window->frame->top_width;
|
|
||||||
else
|
|
||||||
th = test_window->client.height + extra_height;
|
|
||||||
#else
|
|
||||||
tw = test_window->frame->core->width;
|
|
||||||
th = test_window->frame->core->height;
|
|
||||||
#endif
|
|
||||||
tx = test_window->frame_x;
|
|
||||||
ty = test_window->frame_y;
|
|
||||||
|
|
||||||
if ((tx < (test_x + width)) && ((tx + tw) > test_x) &&
|
|
||||||
(ty < (test_y + height)) && ((ty + th) > test_y) &&
|
|
||||||
(test_window->flags.mapped ||
|
|
||||||
(test_window->flags.shaded &&
|
|
||||||
!(test_window->flags.miniaturized ||
|
|
||||||
test_window->flags.hidden)))) {
|
|
||||||
|
|
||||||
loc_ok = False;
|
|
||||||
}
|
|
||||||
test_window = test_window->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test_window = scr->focused_window;
|
|
||||||
|
|
||||||
while ((test_window != NULL) && (loc_ok == True)) {
|
|
||||||
|
|
||||||
if (test_window->frame->core->stacking->window_level
|
|
||||||
< WMNormalLevel && tryCount > 0) {
|
|
||||||
test_window = test_window->prev;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
tw = test_window->client.width;
|
|
||||||
if (test_window->flags.shaded)
|
|
||||||
th = test_window->frame->top_width;
|
|
||||||
else
|
|
||||||
th = test_window->client.height + extra_height;
|
|
||||||
#else
|
|
||||||
tw = test_window->frame->core->width;
|
|
||||||
th = test_window->frame->core->height;
|
|
||||||
#endif
|
|
||||||
tx = test_window->frame_x;
|
|
||||||
ty = test_window->frame_y;
|
|
||||||
|
|
||||||
if ((tx < (test_x + width)) && ((tx + tw) > test_x) &&
|
|
||||||
(ty < (test_y + height)) && ((ty + th) > test_y) &&
|
|
||||||
(test_window->flags.mapped ||
|
|
||||||
(test_window->flags.shaded &&
|
|
||||||
!(test_window->flags.miniaturized ||
|
|
||||||
test_window->flags.hidden)))) {
|
|
||||||
|
|
||||||
loc_ok = False;
|
|
||||||
}
|
|
||||||
test_window = test_window->prev;
|
|
||||||
}
|
|
||||||
if (loc_ok == True) {
|
|
||||||
*x_ret = test_x;
|
|
||||||
*y_ret = test_y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
test_x += PLACETEST_HSTEP;
|
test_x += PLACETEST_HSTEP;
|
||||||
}
|
}
|
||||||
test_y += PLACETEST_VSTEP;
|
test_y += PLACETEST_VSTEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return loc_ok;
|
from_x = min_isect_x - PLACETEST_HSTEP + 1;
|
||||||
|
from_x = WMAX(from_x, X_ORIGIN(scr));
|
||||||
|
to_x = min_isect_x + PLACETEST_HSTEP;
|
||||||
|
if (to_x + width > usableArea.x2)
|
||||||
|
to_x = usableArea.x2 - width;
|
||||||
|
|
||||||
|
from_y = min_isect_y - PLACETEST_VSTEP + 1;
|
||||||
|
from_y = WMAX(from_y, Y_ORIGIN(scr));
|
||||||
|
to_y = min_isect_y + PLACETEST_VSTEP;
|
||||||
|
if (to_y + height > usableArea.y2)
|
||||||
|
to_y = usableArea.y2 - height;
|
||||||
|
|
||||||
|
for (test_x = from_x; test_x < to_x; test_x++) {
|
||||||
|
for (test_y = from_y; test_y < to_y; test_y++) {
|
||||||
|
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
||||||
|
width, height);
|
||||||
|
|
||||||
|
if ( sum_isect < min_isect ) {
|
||||||
|
min_isect = sum_isect;
|
||||||
|
min_isect_x = test_x;
|
||||||
|
min_isect_y = test_y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*x_ret = min_isect_x;
|
||||||
|
*y_ret = min_isect_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -401,14 +449,8 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WPM_SMART:
|
case WPM_SMART:
|
||||||
if (smartPlaceWindow(wwin, x_ret, y_ret, width, height, 0)) {
|
smartPlaceWindow(wwin, x_ret, y_ret, width, height);
|
||||||
break;
|
break;
|
||||||
} else if (smartPlaceWindow(wwin, x_ret, y_ret, width, height, 1)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* there isn't a break here, because if we fail, it should fall
|
|
||||||
through to cascade placement, as people who want tiling want
|
|
||||||
automagicness aren't going to want to place their window */
|
|
||||||
|
|
||||||
case WPM_CASCADE:
|
case WPM_CASCADE:
|
||||||
if (wPreferences.window_placement == WPM_SMART)
|
if (wPreferences.window_placement == WPM_SMART)
|
||||||
|
|||||||
24
src/plugin.c
24
src/plugin.c
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef TEXTURE_PLUGIN
|
#ifdef TEXTURE_PLUGIN
|
||||||
@@ -37,18 +39,20 @@
|
|||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
|
|
||||||
void** wPluginPackInitData(int members, ...) {
|
void**
|
||||||
|
wPluginPackInitData(int members, ...)
|
||||||
|
{
|
||||||
void **p;
|
void **p;
|
||||||
va_list vp;
|
va_list vp;
|
||||||
int i;
|
int i;
|
||||||
p = wmalloc(sizeof(void *) * (members + 1));
|
p = wmalloc(sizeof(void *) * (members + 1));
|
||||||
bzero(p, sizeof(void *) * (members + 1));
|
memset(p, 0, sizeof(void *) * (members + 1));
|
||||||
va_start(vp, members);
|
va_start(vp, members);
|
||||||
for(i=0;i<members;i++) {
|
for(i=0;i<members;i++) {
|
||||||
p[i] = va_arg(vp, void *);
|
p[i] = va_arg(vp, void *);
|
||||||
printf(" %d > %d\n",i,p[i]);
|
printf(" %d > %d\n",i,(int)p[i]);
|
||||||
}
|
}
|
||||||
printf(" s> %s\n",p[2]);
|
printf(" s> %s\n",(char*)p[2]);
|
||||||
va_end(vp);
|
va_end(vp);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -56,12 +60,13 @@ void** wPluginPackInitData(int members, ...) {
|
|||||||
WFunction *
|
WFunction *
|
||||||
wPluginCreateFunction(int type, char *library_name,
|
wPluginCreateFunction(int type, char *library_name,
|
||||||
char *init_proc_name, char *proc_name, char *free_data_proc_name,
|
char *init_proc_name, char *proc_name, char *free_data_proc_name,
|
||||||
proplist_t pl_arg, void *init_data) {
|
proplist_t pl_arg, void *init_data)
|
||||||
|
{
|
||||||
WFunction *function;
|
WFunction *function;
|
||||||
_DL_InitDataProc *initProc;
|
_DL_InitDataProc *initProc;
|
||||||
|
|
||||||
function = wmalloc(sizeof(WFunction));
|
function = wmalloc(sizeof(WFunction));
|
||||||
bzero(function, sizeof(WFunction));
|
memset(function, 0, sizeof(WFunction));
|
||||||
|
|
||||||
function->handle = dlopen(library_name, RTLD_LAZY);
|
function->handle = dlopen(library_name, RTLD_LAZY);
|
||||||
if (!function->handle) {
|
if (!function->handle) {
|
||||||
@@ -108,8 +113,11 @@ wPluginCreateFunction(int type, char *library_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wPluginDestroyFunction(WFunction *function) {
|
wPluginDestroyFunction(WFunction *function)
|
||||||
if (!function) return;
|
{
|
||||||
|
if (!function)
|
||||||
|
return;
|
||||||
|
|
||||||
if (function->data) {
|
if (function->data) {
|
||||||
if (function->freeData) {
|
if (function->freeData) {
|
||||||
function->freeData(&function->data);
|
function->freeData(&function->data);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
#include "xmodifier.h"
|
#include "xmodifier.h"
|
||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern char *Locale;
|
extern char *Locale;
|
||||||
@@ -603,7 +602,7 @@ static void
|
|||||||
separateCommand(char *line, char ***file, char **command)
|
separateCommand(char *line, char ***file, char **command)
|
||||||
{
|
{
|
||||||
char *token, *tmp = line;
|
char *token, *tmp = line;
|
||||||
LinkedList *list = NULL;
|
WMBag *bag = WMCreateBag(4);
|
||||||
int count, i;
|
int count, i;
|
||||||
|
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
@@ -618,20 +617,21 @@ separateCommand(char *line, char ***file, char **command)
|
|||||||
wwarning(_("%s: missing command"), line);
|
wwarning(_("%s: missing command"), line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
list = list_cons(token, list);
|
WMPutInBag(bag, token);
|
||||||
}
|
}
|
||||||
} while (token!=NULL && tmp!=NULL);
|
} while (token!=NULL && tmp!=NULL);
|
||||||
|
|
||||||
count = list_length(list);
|
count = WMGetBagItemCount(bag);
|
||||||
if (count>0) {
|
if (count>0) {
|
||||||
|
int j;
|
||||||
*file = wmalloc(sizeof(char*)*(count+1));
|
*file = wmalloc(sizeof(char*)*(count+1));
|
||||||
i = count;
|
i = count;
|
||||||
(*file)[count] = NULL;
|
(*file)[count] = NULL;
|
||||||
while (list!=NULL) {
|
for (j = 0; j < count; j++) {
|
||||||
(*file)[--i] = list->head;
|
(*file)[--i] = WMGetFromBag(bag, j);
|
||||||
list_remove_head(&list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WMFreeBag(bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1304,11 +1304,15 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
WMenu *menu=NULL;
|
WMenu *menu=NULL;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
LinkedList *dirs = NULL, *files = NULL;
|
WMBag *dirs = NULL, *files = NULL;
|
||||||
int length, i, have_space=0;
|
int length, i, have_space=0;
|
||||||
dir_data *data;
|
dir_data *data;
|
||||||
int stripExtension = 0;
|
int stripExtension = 0;
|
||||||
|
|
||||||
|
|
||||||
|
dirs = WMCreateBag(16);
|
||||||
|
files = WMCreateBag(16);
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
while (path[i]!=NULL) {
|
while (path[i]!=NULL) {
|
||||||
if (strcmp(path[i], "-noext")==0) {
|
if (strcmp(path[i], "-noext")==0) {
|
||||||
@@ -1361,7 +1365,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
data->name = wstrdup(dentry->d_name);
|
data->name = wstrdup(dentry->d_name);
|
||||||
data->index = i;
|
data->index = i;
|
||||||
|
|
||||||
list_insert_sorted(data, &dirs, (int(*)())myCompare);
|
WMPutInBag(dirs, data);
|
||||||
}
|
}
|
||||||
} else if (S_ISREG(stat_buf.st_mode) || isFilePack) {
|
} else if (S_ISREG(stat_buf.st_mode) || isFilePack) {
|
||||||
/* Hack because access always returns X_OK success for user root */
|
/* Hack because access always returns X_OK success for user root */
|
||||||
@@ -1374,7 +1378,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
data->name = wstrdup(dentry->d_name);
|
data->name = wstrdup(dentry->d_name);
|
||||||
data->index = i;
|
data->index = i;
|
||||||
|
|
||||||
list_insert_sorted(data, &files, (int(*)())myCompare);
|
WMPutInBag(files, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1385,16 +1389,22 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dirs && !files)
|
if (!WMGetBagItemCount(dirs) && !WMGetBagItemCount(files)) {
|
||||||
|
WMFreeBag(dirs);
|
||||||
|
WMFreeBag(files);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
WMSortBag(dirs, myCompare);
|
||||||
|
WMSortBag(files, myCompare);
|
||||||
|
|
||||||
menu = wMenuCreate(scr, title, False);
|
menu = wMenuCreate(scr, title, False);
|
||||||
menu->on_destroy = removeShortcutsForMenu;
|
menu->on_destroy = removeShortcutsForMenu;
|
||||||
|
|
||||||
while (dirs != NULL) {
|
for (i = 0; i < WMGetBagItemCount(dirs); i++) {
|
||||||
/* New directory. Use same OPEN_MENU command that was used
|
/* New directory. Use same OPEN_MENU command that was used
|
||||||
* for the current directory. */
|
* for the current directory. */
|
||||||
dir_data *d = (dir_data*)dirs->head;
|
dir_data *d = (dir_data*)WMGetFromBag(dirs, i);
|
||||||
|
|
||||||
length = strlen(path[d->index])+strlen(d->name)+6;
|
length = strlen(path[d->index])+strlen(d->name)+6;
|
||||||
if (command)
|
if (command)
|
||||||
@@ -1427,17 +1437,14 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
addMenuEntry(menu, d->name, NULL, "OPEN_MENU", buffer, path[d->index]);
|
addMenuEntry(menu, d->name, NULL, "OPEN_MENU", buffer, path[d->index]);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (dirs->head) {
|
|
||||||
if (d->name)
|
if (d->name)
|
||||||
free(d->name);
|
free(d->name);
|
||||||
free(dirs->head);
|
free(d);
|
||||||
}
|
|
||||||
list_remove_head(&dirs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (files != NULL) {
|
for (i = 0; i < WMGetBagItemCount(files); i++) {
|
||||||
/* executable: add as entry */
|
/* executable: add as entry */
|
||||||
dir_data *f = (dir_data*) files->head;;
|
dir_data *f = (dir_data*)WMGetFromBag(files, i);
|
||||||
|
|
||||||
length = strlen(path[f->index])+strlen(f->name)+6;
|
length = strlen(path[f->index])+strlen(f->name)+6;
|
||||||
if (command)
|
if (command)
|
||||||
@@ -1480,14 +1487,14 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
|||||||
addMenuEntry(menu, f->name, NULL, "SHEXEC", buffer, path[f->index]);
|
addMenuEntry(menu, f->name, NULL, "SHEXEC", buffer, path[f->index]);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (files->head) {
|
|
||||||
if (f->name)
|
if (f->name)
|
||||||
free(f->name);
|
free(f->name);
|
||||||
free(files->head);
|
free(f);
|
||||||
}
|
|
||||||
list_remove_head(&files);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WMFreeBag(files);
|
||||||
|
WMFreeBag(dirs);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/screen.c
13
src/screen.c
@@ -853,11 +853,6 @@ wScreenInit(int screen_number)
|
|||||||
|
|
||||||
wScreenUpdateUsableArea(scr);
|
wScreenUpdateUsableArea(scr);
|
||||||
|
|
||||||
#ifndef LITE
|
|
||||||
/* kluge to load menu configurations at startup */
|
|
||||||
OpenRootMenu(scr, -10000, -10000, False);
|
|
||||||
wMenuUnmap(scr->root_menu);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return scr;
|
return scr;
|
||||||
}
|
}
|
||||||
@@ -990,6 +985,12 @@ wScreenRestoreState(WScreen *scr)
|
|||||||
proplist_t state;
|
proplist_t state;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LITE
|
||||||
|
OpenRootMenu(scr, -10000, -10000, False);
|
||||||
|
wMenuUnmap(scr->root_menu);
|
||||||
|
#endif
|
||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
if (wScreenCount == 1)
|
if (wScreenCount == 1)
|
||||||
@@ -1068,7 +1069,7 @@ wScreenSaveState(WScreen *scr)
|
|||||||
|
|
||||||
/* save dock state to file */
|
/* save dock state to file */
|
||||||
if (!wPreferences.flags.nodock) {
|
if (!wPreferences.flags.nodock) {
|
||||||
wDockSaveState(scr);
|
wDockSaveState(scr, old_state);
|
||||||
} else {
|
} else {
|
||||||
if ((foo = PLGetDictionaryEntry(old_state, dDock))!=NULL) {
|
if ((foo = PLGetDictionaryEntry(old_state, dDock))!=NULL) {
|
||||||
PLInsertDictionaryEntry(scr->session_state, dDock, foo);
|
PLInsertDictionaryEntry(scr->session_state, dDock, foo);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ typedef struct _WScreen {
|
|||||||
* traverse the entire window list
|
* traverse the entire window list
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct LinkedList *selected_windows;
|
WMBag *selected_windows;
|
||||||
|
|
||||||
struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
|
struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ typedef struct _WScreen {
|
|||||||
|
|
||||||
/* for window shortcuts */
|
/* for window shortcuts */
|
||||||
struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
|
struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
|
||||||
struct LinkedList *shortcutSelectedWindows[MAX_WINDOW_SHORTCUTS];
|
WMBag *shortcutSelectedWindows[MAX_WINDOW_SHORTCUTS];
|
||||||
|
|
||||||
#ifdef XDND
|
#ifdef XDND
|
||||||
char *xdestring;
|
char *xdestring;
|
||||||
|
|||||||
@@ -91,7 +91,6 @@
|
|||||||
|
|
||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
@@ -281,7 +280,7 @@ wSessionSaveState(WScreen *scr)
|
|||||||
WWindow *wwin = scr->focused_window;
|
WWindow *wwin = scr->focused_window;
|
||||||
proplist_t win_info, wks;
|
proplist_t win_info, wks;
|
||||||
proplist_t list=NULL;
|
proplist_t list=NULL;
|
||||||
LinkedList *wapp_list=NULL;
|
WMBag *wapp_list=NULL;
|
||||||
|
|
||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
@@ -297,7 +296,7 @@ wSessionSaveState(WScreen *scr)
|
|||||||
while (wwin) {
|
while (wwin) {
|
||||||
WApplication *wapp=wApplicationOf(wwin->main_window);
|
WApplication *wapp=wApplicationOf(wwin->main_window);
|
||||||
|
|
||||||
if (wwin->transient_for==None && list_find(wapp_list, wapp)==NULL
|
if (wwin->transient_for==None && WMGetFirstInBag(wapp_list, wapp)<0
|
||||||
&& !WFLAGP(wwin, dont_save_session)) {
|
&& !WFLAGP(wwin, dont_save_session)) {
|
||||||
/* A entry for this application was not yet saved. Save one. */
|
/* A entry for this application was not yet saved. Save one. */
|
||||||
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
|
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
|
||||||
@@ -308,7 +307,7 @@ wSessionSaveState(WScreen *scr)
|
|||||||
* application list, so no multiple entries for the same
|
* application list, so no multiple entries for the same
|
||||||
* application are saved.
|
* application are saved.
|
||||||
*/
|
*/
|
||||||
wapp_list = list_cons(wapp, wapp_list);
|
WMPutInBag(wapp_list, wapp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wwin = wwin->prev;
|
wwin = wwin->prev;
|
||||||
@@ -321,7 +320,7 @@ wSessionSaveState(WScreen *scr)
|
|||||||
PLInsertDictionaryEntry(scr->session_state, sWorkspace, wks);
|
PLInsertDictionaryEntry(scr->session_state, sWorkspace, wks);
|
||||||
PLRelease(wks);
|
PLRelease(wks);
|
||||||
|
|
||||||
list_free(wapp_list);
|
WMFreeBag(wapp_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -455,6 +455,9 @@ DoWindowBirth(WWindow *wwin)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SILLYNESS
|
#ifdef SILLYNESS
|
||||||
static WMPixmap *data[12];
|
static WMPixmap *data[12];
|
||||||
|
|
||||||
@@ -582,6 +585,9 @@ InitGhostWindowMove(WWindow *wwin)
|
|||||||
{
|
{
|
||||||
_GhostWindowData *gdata;
|
_GhostWindowData *gdata;
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
unsigned short *ptr;
|
||||||
|
unsigned short mask;
|
||||||
|
int i;
|
||||||
|
|
||||||
gdata = wmalloc(sizeof(_GhostWindowData));
|
gdata = wmalloc(sizeof(_GhostWindowData));
|
||||||
|
|
||||||
@@ -598,27 +604,191 @@ InitGhostWindowMove(WWindow *wwin)
|
|||||||
XCreateSimpleWindow(dpy, scr->root_win, wwin->frame_x, wwin->frame_y,
|
XCreateSimpleWindow(dpy, scr->root_win, wwin->frame_x, wwin->frame_y,
|
||||||
gdata->width, gdata->height, 0, 0, 0);
|
gdata->width, gdata->height, 0, 0, 0);
|
||||||
|
|
||||||
gdata->winImage =
|
gdata->winImage = RGetXImage(scr->rcontext, wwin->frame->core->window,
|
||||||
RGetXImage(scr->rcontext, wwin->frame->core->window, 0, 0,
|
0, 0, gdata->width, gdata->height);
|
||||||
scr->frame->core->width, scr->frame->core->height);
|
|
||||||
|
|
||||||
gdata->backImage =
|
gdata->backImage = RCreateXImage(scr->rcontext, scr->w_depth,
|
||||||
RCreateXImage(scr->rcontext, scr->w_depth,
|
gdata->width, gdata->height);
|
||||||
scr->frame->core->width, scr->frame->core->height);
|
|
||||||
|
|
||||||
memcpy(gdata->backImage->image->data, gdata->winImage->image->data,
|
memcpy(gdata->backImage->image->data, gdata->winImage->image->data,
|
||||||
gdata->winImage->image->bytes_per_line * scr->frame->core->height);
|
gdata->winImage->image->bytes_per_line * gdata->height);
|
||||||
|
|
||||||
|
gdata->image = RCreateXImage(scr->rcontext, scr->w_depth,
|
||||||
|
gdata->width, gdata->height);
|
||||||
|
|
||||||
|
ptr = (unsigned short*)gdata->winImage->image->data;
|
||||||
|
|
||||||
|
mask = 0x7b00|0x3d0|0x1e;
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||||
|
i++, ptr++) {
|
||||||
|
|
||||||
|
*ptr &= mask;
|
||||||
|
}
|
||||||
|
|
||||||
return gdata;
|
return gdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
mergeGhostWindow(_GhostWindowData *gdata)
|
||||||
|
{
|
||||||
|
register unsigned short *ptrw, *ptrb, *ptr;
|
||||||
|
int count;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
ptr = (unsigned short*)gdata->image->image->data;
|
||||||
|
ptrw = (unsigned short*)gdata->winImage->image->data;
|
||||||
|
ptrb = (unsigned short*)gdata->backImage->image->data;
|
||||||
|
|
||||||
|
count = gdata->winImage->image->bytes_per_line * gdata->height;
|
||||||
|
|
||||||
|
while (count--) {
|
||||||
|
*ptr = (*ptrw + *ptrb) >> 1;
|
||||||
|
|
||||||
|
ptr++;
|
||||||
|
ptrw++;
|
||||||
|
ptrb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UpdateGhostWindowMove(void *data, int x, int y)
|
UpdateGhostWindowMove(void *data, int x, int y)
|
||||||
{
|
{
|
||||||
_GhostWindowData *gdata = (_GhostWindowData*)data;
|
_GhostWindowData *gdata = (_GhostWindowData*)data;
|
||||||
|
WScreen *scr = gdata->scr;
|
||||||
|
|
||||||
|
/* no intersection of new background with current */
|
||||||
|
if (x + gdata->width <= gdata->boxX
|
||||||
|
|| x >= gdata->boxX + gdata->width
|
||||||
|
|| y + gdata->height <= gdata->boxY
|
||||||
|
|| y >= gdata->boxY + gdata->height) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
RDestroyXImage(gdata->backImage);
|
||||||
|
|
||||||
|
gdata->backImage = RGetXImage(scr->rcontext, scr->root_win, x, y,
|
||||||
|
gdata->width, gdata->height);
|
||||||
|
|
||||||
|
ptr = (unsigned short*)gdata->backImage->image->data;
|
||||||
|
|
||||||
|
mask = 0x7b00|0x3d0|0x1e;
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < gdata->winImage->image->bytes_per_line * gdata->height;
|
||||||
|
i++, ptr++) {
|
||||||
|
|
||||||
|
*ptr &= mask;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int hx, hw, hy, hh;
|
||||||
|
int vx, vw, vy, vh;
|
||||||
|
int i, j;
|
||||||
|
unsigned char *backP = gdata->backImage->image->data;
|
||||||
|
unsigned char *winP = gdata->winImage->image->data;
|
||||||
|
int backLineLen = gdata->backImage->image->bytes_per_line;
|
||||||
|
int winLineLen = gdata->winImage->image->bytes_per_line;
|
||||||
|
|
||||||
|
/* 1st move the area of the current backImage that overlaps
|
||||||
|
* the new backImage to it's new position */
|
||||||
|
|
||||||
|
if (x < gdata->boxX) {
|
||||||
|
vx = x + gdata->width;
|
||||||
|
vw = gdata->width - vx;
|
||||||
|
} else if (x > gdata->boxX) {
|
||||||
|
vw = gdata->boxX + gdata->width - x;
|
||||||
|
vx = gdata->boxX - vw;
|
||||||
|
} else {
|
||||||
|
vx = 0;
|
||||||
|
vw = gdata->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y < gdata->boxY) {
|
||||||
|
vy = y + gdata->height;
|
||||||
|
vh = gdata->height - vy;
|
||||||
|
} else if (y > gdata->boxY) {
|
||||||
|
vh = gdata->boxY + gdata->height - y;
|
||||||
|
vy = gdata->boxY - vh;
|
||||||
|
} else {
|
||||||
|
vy = 0;
|
||||||
|
vh = gdata->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y < gdata->boxY) {
|
||||||
|
int dy = vy - gdata->boxY;
|
||||||
|
|
||||||
|
if (x < gdata->boxX) {
|
||||||
|
for (i = vh - 1; i >= 0; i--) {
|
||||||
|
memmove(&backP[(i + dy) * backLineLen + 2 * vx],
|
||||||
|
&backP[i * backLineLen], 2 * vw);
|
||||||
|
}
|
||||||
|
} else /* if (x > gdata->boxX) */ {
|
||||||
|
for (i = vh - 1; i >= 0; i--) {
|
||||||
|
memmove(&backP[(i + dy) * backLineLen],
|
||||||
|
&backP[i * backLineLen + 2 * vx], 2 * vw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else /*if (y > gdata->boxY) */ {
|
||||||
|
int dy = gdata->boxY - vy;
|
||||||
|
|
||||||
|
if (x < gdata->boxX) {
|
||||||
|
for (i = 0; i < vh - 1; i++) {
|
||||||
|
memmove(&backP[i * backLineLen + 2 * vx],
|
||||||
|
&backP[(i + dy) * backLineLen], 2 * vw);
|
||||||
|
}
|
||||||
|
} else /*if (x > gdata->boxX) */ {
|
||||||
|
for (i = 0; i < vh - 1; i++) {
|
||||||
|
memmove(&backP[i * backLineLen],
|
||||||
|
&backP[(i + dy) * backLineLen + 2 * vx], 2 * vw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2nd grab the background image from the screen and copy to the
|
||||||
|
* buffer. also maskout the lsb of rgb in each pixel of grabbed data */
|
||||||
|
|
||||||
|
if (y < gdata->boxY) {
|
||||||
|
vy = y;
|
||||||
|
vh = gdata->boxY - vy;
|
||||||
|
|
||||||
|
hy = y + vh;
|
||||||
|
hh = gdata->height - vh;
|
||||||
|
} else if (y > gdata->boxY) {
|
||||||
|
vy = gdata->boxY + gdata->height;
|
||||||
|
vh = vy - (y + gdata->height);
|
||||||
|
|
||||||
|
hy = y;
|
||||||
|
hh = y - gdata->boxY;
|
||||||
|
} else {
|
||||||
|
vy = vh = 0;
|
||||||
|
|
||||||
|
hy = y;
|
||||||
|
hh = gdata->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < gdata->boxX) {
|
||||||
|
hx = x;
|
||||||
|
hw = gdata->boxX - hx;
|
||||||
|
} else if (x > gdata->boxX) {
|
||||||
|
hx = gdata->boxX + gdata->width;
|
||||||
|
hw = hx - (x + gdata->width);
|
||||||
|
} else {
|
||||||
|
hx = hw = 0;
|
||||||
|
|
||||||
|
vx = x;
|
||||||
|
vw = gdata->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1st the top/bottom part */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 2nd the left/right part */
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeGhostWindow(gdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -134,12 +134,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* define EXTEND_WINDOWSHORTCUT if you have a great memory and want 10
|
* define EXTEND_WINDOWSHORTCUT if you want 10 window shortcuts instead of 4.
|
||||||
* window shortcuts instead of 4. You will also need to define the
|
|
||||||
* same thing in WPrefs.app/WPrefs.h to get the corresponding entries
|
|
||||||
* in WPrefs.
|
|
||||||
*/
|
*/
|
||||||
#undef EXTEND_WINDOWSHORTCUT
|
#define EXTEND_WINDOWSHORTCUT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +297,7 @@
|
|||||||
#define DEF_ICON_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
#define DEF_ICON_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
||||||
#define DEF_CLIP_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
#define DEF_CLIP_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
||||||
#define DEF_INFO_TEXT_FONT "\"-*-*-medium-r-normal--14-*\""
|
#define DEF_INFO_TEXT_FONT "\"-*-*-medium-r-normal--14-*\""
|
||||||
|
#define DEF_ADDITONAL_FONT "-*-*-medium-r-normal--12-*"
|
||||||
|
|
||||||
#define DEF_WORKSPACE_NAME_FONT "\"-*-*-medium-r-normal--24-*\""
|
#define DEF_WORKSPACE_NAME_FONT "\"-*-*-medium-r-normal--24-*\""
|
||||||
#else /* !I18N_MB */
|
#else /* !I18N_MB */
|
||||||
|
|||||||
@@ -197,12 +197,14 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
|||||||
proplist_t value;
|
proplist_t value;
|
||||||
proplist_t key1, key2, key3;
|
proplist_t key1, key2, key3;
|
||||||
proplist_t dw, dc, dn, da;
|
proplist_t dw, dc, dn, da;
|
||||||
char buffer[256];
|
|
||||||
|
|
||||||
|
|
||||||
if (class && instance)
|
if (class && instance) {
|
||||||
|
char *buffer = NULL;
|
||||||
|
buffer = wmalloc(strlen(class)+strlen(instance)+4);
|
||||||
key1 = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
|
key1 = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
|
||||||
else
|
free(buffer);
|
||||||
|
} else
|
||||||
key1 = NULL;
|
key1 = NULL;
|
||||||
|
|
||||||
if (instance)
|
if (instance)
|
||||||
@@ -326,17 +328,19 @@ get_generic_value(WScreen *scr, char *instance, char *class, proplist_t option,
|
|||||||
Bool noDefault)
|
Bool noDefault)
|
||||||
{
|
{
|
||||||
proplist_t value, key, dict;
|
proplist_t value, key, dict;
|
||||||
char buffer[256];
|
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
PLSetStringCmpHook(NULL);
|
||||||
|
|
||||||
if (class && instance) {
|
if (class && instance) {
|
||||||
|
char *buffer = NULL;
|
||||||
|
buffer = wmalloc(strlen(class)+strlen(instance)+4);
|
||||||
key = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
|
key = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
|
||||||
|
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
||||||
PLRelease(key);
|
PLRelease(key);
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = PLGetDictionaryEntry(dict, option);
|
||||||
@@ -348,7 +352,6 @@ get_generic_value(WScreen *scr, char *instance, char *class, proplist_t option,
|
|||||||
|
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
||||||
PLRelease(key);
|
PLRelease(key);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = PLGetDictionaryEntry(dict, option);
|
||||||
}
|
}
|
||||||
@@ -481,7 +484,6 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
|||||||
WDDomain *db = WDWindowAttributes;
|
WDDomain *db = WDWindowAttributes;
|
||||||
proplist_t icon_value=NULL, value, attr, key, def_win, def_icon=NULL;
|
proplist_t icon_value=NULL, value, attr, key, def_win, def_icon=NULL;
|
||||||
proplist_t dict = db->dictionary;
|
proplist_t dict = db->dictionary;
|
||||||
char *buffer;
|
|
||||||
int same = 0;
|
int same = 0;
|
||||||
|
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
@@ -499,6 +501,7 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
|||||||
PLSetStringCmpHook(NULL);
|
PLSetStringCmpHook(NULL);
|
||||||
|
|
||||||
if (instance && class) {
|
if (instance && class) {
|
||||||
|
char *buffer;
|
||||||
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
|
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
|
||||||
strcat(strcat(strcpy(buffer, instance), "."), class);
|
strcat(strcat(strcpy(buffer, instance), "."), class);
|
||||||
key = PLMakeString(buffer);
|
key = PLMakeString(buffer);
|
||||||
|
|||||||
77
src/window.c
77
src/window.c
@@ -51,7 +51,7 @@
|
|||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
#ifdef MWM_HINTS
|
#ifdef MWM_HINTS
|
||||||
# include "motif.h"
|
# include "motif.h"
|
||||||
@@ -212,14 +212,13 @@ wWindowDestroy(WWindow *wwin)
|
|||||||
wwin->flags.destroyed = 1;
|
wwin->flags.destroyed = 1;
|
||||||
|
|
||||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
wwin->screen_ptr->shortcutSelectedWindows[i] = list_remove_elem(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);
|
|
||||||
if (wwin->screen_ptr->shortcutWindow[i] == wwin) {
|
|
||||||
if (wwin->screen_ptr->shortcutSelectedWindows[i]) {
|
if (wwin->screen_ptr->shortcutSelectedWindows[i]) {
|
||||||
LinkedList *list = wwin->screen_ptr->shortcutSelectedWindows[i];
|
WMRemoveFromBag(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);
|
||||||
wwin->screen_ptr->shortcutWindow[i] =
|
|
||||||
list->head;
|
if (!WMGetBagItemCount(wwin->screen_ptr->shortcutSelectedWindows[i])) {
|
||||||
|
WMFreeBag(wwin->screen_ptr->shortcutSelectedWindows[i]);
|
||||||
|
wwin->screen_ptr->shortcutSelectedWindows[i] = NULL;
|
||||||
}
|
}
|
||||||
else wwin->screen_ptr->shortcutWindow[i] = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1469,6 +1468,8 @@ wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
|
|||||||
scr->focused_window->next = NULL;
|
scr->focused_window->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wPreferences.focus_mode==WKF_CLICK) {
|
||||||
|
|
||||||
/* if in click to focus mode and the window
|
/* if in click to focus mode and the window
|
||||||
* was a transient, focus the owner window
|
* was a transient, focus the owner window
|
||||||
*/
|
*/
|
||||||
@@ -1481,6 +1482,14 @@ wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
|
|||||||
}
|
}
|
||||||
/* otherwise, focus the next one in the focus list */
|
/* otherwise, focus the next one in the focus list */
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
|
tmp = scr->focused_window;
|
||||||
|
while (tmp) { /* look for one in the window list first */
|
||||||
|
if (!WFLAGP(tmp, no_focusable) && !WFLAGP(tmp, skip_window_list)
|
||||||
|
&& (tmp->flags.mapped || tmp->flags.shaded))
|
||||||
|
break;
|
||||||
|
tmp = tmp->prev;
|
||||||
|
}
|
||||||
|
if (!tmp) { /* if unsuccessful, choose any focusable window */
|
||||||
tmp = scr->focused_window;
|
tmp = scr->focused_window;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (!WFLAGP(tmp, no_focusable)
|
if (!WFLAGP(tmp, no_focusable)
|
||||||
@@ -1489,8 +1498,10 @@ wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
|
|||||||
tmp = tmp->prev;
|
tmp = tmp->prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wPreferences.focus_mode==WKF_CLICK) {
|
}
|
||||||
|
|
||||||
newFocusedWindow = tmp;
|
newFocusedWindow = tmp;
|
||||||
|
|
||||||
} else if (wPreferences.focus_mode==WKF_SLOPPY
|
} else if (wPreferences.focus_mode==WKF_SLOPPY
|
||||||
|| wPreferences.focus_mode==WKF_POINTER) {
|
|| wPreferences.focus_mode==WKF_POINTER) {
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
@@ -1794,8 +1805,10 @@ wWindowChangeWorkspace(WWindow *wwin, int workspace)
|
|||||||
wapp->last_workspace = workspace;
|
wapp->last_workspace = workspace;
|
||||||
}
|
}
|
||||||
if (wwin->flags.miniaturized) {
|
if (wwin->flags.miniaturized) {
|
||||||
|
if (wwin->icon) {
|
||||||
XUnmapWindow(dpy, wwin->icon->core->window);
|
XUnmapWindow(dpy, wwin->icon->core->window);
|
||||||
wwin->icon->mapped = 0;
|
wwin->icon->mapped = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
unmap = 1;
|
unmap = 1;
|
||||||
wSetFocusTo(scr, NULL);
|
wSetFocusTo(scr, NULL);
|
||||||
@@ -1804,8 +1817,10 @@ wWindowChangeWorkspace(WWindow *wwin, int workspace)
|
|||||||
} else {
|
} else {
|
||||||
/* brought to current workspace. Map window */
|
/* brought to current workspace. Map window */
|
||||||
if (wwin->flags.miniaturized && !wPreferences.sticky_icons) {
|
if (wwin->flags.miniaturized && !wPreferences.sticky_icons) {
|
||||||
|
if (wwin->icon) {
|
||||||
XMapWindow(dpy, wwin->icon->core->window);
|
XMapWindow(dpy, wwin->icon->core->window);
|
||||||
wwin->icon->mapped = 1;
|
wwin->icon->mapped = 1;
|
||||||
|
}
|
||||||
} else if (!wwin->flags.mapped &&
|
} else if (!wwin->flags.mapped &&
|
||||||
!(wwin->flags.miniaturized || wwin->flags.hidden)) {
|
!(wwin->flags.miniaturized || wwin->flags.hidden)) {
|
||||||
wWindowMap(wwin);
|
wWindowMap(wwin);
|
||||||
@@ -1990,7 +2005,6 @@ int req_x, req_y; /* new position of the frame */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWindowUpdateButtonImages(WWindow *wwin)
|
wWindowUpdateButtonImages(WWindow *wwin)
|
||||||
{
|
{
|
||||||
@@ -2036,28 +2050,31 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
|||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
if (!WFLAGP(wwin, no_language_button)) {
|
if (!WFLAGP(wwin, no_language_button)) {
|
||||||
if (fwin->languagebutton_image && !fwin->languagebutton_image->shared) {
|
if (fwin->languagebutton_image &&
|
||||||
|
!fwin->languagebutton_image->shared) {
|
||||||
wPixmapDestroy(fwin->languagebutton_image);
|
wPixmapDestroy(fwin->languagebutton_image);
|
||||||
}
|
}
|
||||||
fwin->languagebutton_image = scr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
fwin->languagebutton_image =
|
||||||
|
scr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* close button */
|
/* close button */
|
||||||
|
|
||||||
|
/* redefine WFLAGP to MGFLAGP to allow broken close operation */
|
||||||
|
#define MGFLAGP(wwin, FLAG) (wwin)->client_flags.FLAG
|
||||||
|
|
||||||
if (!WFLAGP(wwin, no_close_button)) {
|
if (!WFLAGP(wwin, no_close_button)) {
|
||||||
if (wwin->wm_gnustep_attr
|
if (wwin->wm_gnustep_attr
|
||||||
&& wwin->wm_gnustep_attr->flags & GSClosePixmapAttr) {
|
&& wwin->wm_gnustep_attr->flags & GSClosePixmapAttr) {
|
||||||
pixmap = wwin->wm_gnustep_attr->close_pixmap;
|
pixmap = wwin->wm_gnustep_attr->close_pixmap;
|
||||||
|
|
||||||
if (wwin->wm_gnustep_attr->flags&GSCloseMaskAttr) {
|
if (wwin->wm_gnustep_attr->flags&GSCloseMaskAttr)
|
||||||
mask = wwin->wm_gnustep_attr->close_mask;
|
mask = wwin->wm_gnustep_attr->close_mask;
|
||||||
} else {
|
else
|
||||||
mask = None;
|
mask = None;
|
||||||
}
|
|
||||||
|
|
||||||
if (fwin->rbutton_image
|
if (fwin->rbutton_image && (fwin->rbutton_image->image != pixmap
|
||||||
&& (fwin->rbutton_image->image != pixmap
|
|
||||||
|| fwin->rbutton_image->mask != mask)) {
|
|| fwin->rbutton_image->mask != mask)) {
|
||||||
wPixmapDestroy(fwin->rbutton_image);
|
wPixmapDestroy(fwin->rbutton_image);
|
||||||
fwin->rbutton_image = NULL;
|
fwin->rbutton_image = NULL;
|
||||||
@@ -2068,20 +2085,26 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
|||||||
fwin->rbutton_image->client_owned = 1;
|
fwin->rbutton_image->client_owned = 1;
|
||||||
fwin->rbutton_image->client_owned_mask = 1;
|
fwin->rbutton_image->client_owned_mask = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (WFLAGP(wwin, kill_close)) {
|
} else if (WFLAGP(wwin, kill_close)) {
|
||||||
if (fwin->rbutton_image && !fwin->rbutton_image->shared) {
|
|
||||||
|
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
|
||||||
wPixmapDestroy(fwin->rbutton_image);
|
wPixmapDestroy(fwin->rbutton_image);
|
||||||
}
|
|
||||||
fwin->rbutton_image = scr->b_pixmaps[WBUT_KILL];
|
fwin->rbutton_image = scr->b_pixmaps[WBUT_KILL];
|
||||||
} else if (WFLAGP(wwin, broken_close)) {
|
|
||||||
if (fwin->rbutton_image && !fwin->rbutton_image->shared) {
|
} else if (MGFLAGP(wwin, broken_close)) {
|
||||||
|
|
||||||
|
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
|
||||||
wPixmapDestroy(fwin->rbutton_image);
|
wPixmapDestroy(fwin->rbutton_image);
|
||||||
}
|
|
||||||
fwin->rbutton_image = scr->b_pixmaps[WBUT_BROKENCLOSE];
|
fwin->rbutton_image = scr->b_pixmaps[WBUT_BROKENCLOSE];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (fwin->rbutton_image && !fwin->rbutton_image->shared) {
|
|
||||||
|
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
|
||||||
wPixmapDestroy(fwin->rbutton_image);
|
wPixmapDestroy(fwin->rbutton_image);
|
||||||
}
|
|
||||||
fwin->rbutton_image = scr->b_pixmaps[WBUT_CLOSE];
|
fwin->rbutton_image = scr->b_pixmaps[WBUT_CLOSE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2422,17 +2445,13 @@ wWindowResetMouseGrabs(WWindow *wwin)
|
|||||||
void
|
void
|
||||||
wWindowUpdateGNUstepAttr(WWindow *wwin, GNUstepWMAttributes *attr)
|
wWindowUpdateGNUstepAttr(WWindow *wwin, GNUstepWMAttributes *attr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (attr->flags & GSExtraFlagsAttr) {
|
if (attr->flags & GSExtraFlagsAttr) {
|
||||||
if (WFLAGP(wwin, broken_close) !=
|
if (MGFLAGP(wwin, broken_close) !=
|
||||||
(attr->extra_flags & GSDocumentEditedFlag)) {
|
(attr->extra_flags & GSDocumentEditedFlag)) {
|
||||||
|
wwin->client_flags.broken_close = !MGFLAGP(wwin, broken_close);
|
||||||
wwin->client_flags.broken_close = !WFLAGP(wwin, broken_close);
|
|
||||||
|
|
||||||
wWindowUpdateButtonImages(wwin);
|
wWindowUpdateButtonImages(wwin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#include "list.h"
|
|
||||||
|
|
||||||
#define MC_MAXIMIZE 0
|
#define MC_MAXIMIZE 0
|
||||||
#define MC_MINIATURIZE 1
|
#define MC_MINIATURIZE 1
|
||||||
@@ -199,16 +199,23 @@ makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
|
||||||
scr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
|
scr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
|
||||||
list_free(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
|
||||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = NULL;
|
|
||||||
if (wwin->flags.selected /* && scr->selected_windows */ ) {
|
|
||||||
LinkedList *sl;
|
|
||||||
|
|
||||||
sl = scr->selected_windows;
|
if (scr->shortcutSelectedWindows[entry->order-WO_ENTRIES])
|
||||||
|
WMFreeBag(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
||||||
|
|
||||||
while (sl) {
|
if (wwin->flags.selected && scr->selected_windows) {
|
||||||
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = list_cons(sl->head,scr->shortcutSelectedWindows[entry->order-WO_ENTRIES]);
|
WMBag *bag;
|
||||||
sl = sl->tail;
|
int i;
|
||||||
|
|
||||||
|
scr->shortcutSelectedWindows[entry->order-WO_ENTRIES] = WMCreateBag(4);
|
||||||
|
|
||||||
|
bag = scr->selected_windows;
|
||||||
|
|
||||||
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
|
WWindow *tmp = WMGetFromBag(bag, i);
|
||||||
|
|
||||||
|
WMPutInBag(scr->shortcutSelectedWindows[entry->order-WO_ENTRIES],
|
||||||
|
tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -273,16 +280,17 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
|||||||
int shortcutNo = i-WO_ENTRIES;
|
int shortcutNo = i-WO_ENTRIES;
|
||||||
WWindow *twin = wwin->screen_ptr->shortcutWindow[shortcutNo];
|
WWindow *twin = wwin->screen_ptr->shortcutWindow[shortcutNo];
|
||||||
WMenuEntry *entry = smenu->entries[i];
|
WMenuEntry *entry = smenu->entries[i];
|
||||||
|
WMBag *shortSelWindows = wwin->screen_ptr->shortcutSelectedWindows[shortcutNo];
|
||||||
|
|
||||||
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
||||||
|
|
||||||
if (!twin && !wwin->screen_ptr->shortcutSelectedWindows[shortcutNo]) {
|
if (!twin && !shortSelWindows) {
|
||||||
entry->flags.indicator_on = 0;
|
entry->flags.indicator_on = 0;
|
||||||
} else {
|
} else {
|
||||||
entry->flags.indicator_on = 1;
|
entry->flags.indicator_on = 1;
|
||||||
if (twin == wwin)
|
if (twin == wwin)
|
||||||
entry->flags.indicator_type = MI_DIAMOND;
|
entry->flags.indicator_type = MI_DIAMOND;
|
||||||
else if (list_find(wwin->screen_ptr->shortcutSelectedWindows[shortcutNo], wwin))
|
else if (shortSelWindows && WMCountInBag(shortSelWindows, wwin))
|
||||||
entry->flags.indicator_type = MI_HIDDEN;
|
entry->flags.indicator_type = MI_HIDDEN;
|
||||||
else
|
else
|
||||||
entry->flags.indicator_type = MI_CHECK;
|
entry->flags.indicator_type = MI_CHECK;
|
||||||
|
|||||||
@@ -371,12 +371,13 @@ getBool(proplist_t value)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void
|
static int
|
||||||
insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
|
insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
|
||||||
proplist_t value, int *modified, int flags)
|
proplist_t value, int flags)
|
||||||
{
|
{
|
||||||
proplist_t def_win, def_value=NULL;
|
proplist_t def_win, def_value=NULL;
|
||||||
int update = 0;
|
int update = 0;
|
||||||
|
int modified = 0;
|
||||||
|
|
||||||
if (!(flags & UPDATE_DEFAULTS) && dict) {
|
if (!(flags & UPDATE_DEFAULTS) && dict) {
|
||||||
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
|
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
|
||||||
@@ -398,8 +399,10 @@ insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
|
|||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
PLInsertDictionaryEntry(window, attr, value);
|
PLInsertDictionaryEntry(window, attr, value);
|
||||||
*modified = 1;
|
modified = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -410,7 +413,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
WDDomain *db = WDWindowAttributes;
|
WDDomain *db = WDWindowAttributes;
|
||||||
proplist_t dict = db->dictionary;
|
proplist_t dict = db->dictionary;
|
||||||
proplist_t winDic, value, key;
|
proplist_t winDic, value, key;
|
||||||
char buffer[256], *icon_file;
|
char *icon_file;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int different = 0;
|
int different = 0;
|
||||||
|
|
||||||
@@ -422,14 +425,16 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
else if (WMGetButtonSelected(panel->clsRb) != 0)
|
else if (WMGetButtonSelected(panel->clsRb) != 0)
|
||||||
key = PLMakeString(wwin->wm_class);
|
key = PLMakeString(wwin->wm_class);
|
||||||
else if (WMGetButtonSelected(panel->bothRb) != 0) {
|
else if (WMGetButtonSelected(panel->bothRb) != 0) {
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
|
buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+4);
|
||||||
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class);
|
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class);
|
||||||
key = PLMakeString(buffer);
|
key = PLMakeString(buffer);
|
||||||
}
|
free(buffer);
|
||||||
else if (WMGetButtonSelected(panel->defaultRb) != 0) {
|
} else if (WMGetButtonSelected(panel->defaultRb) != 0) {
|
||||||
key = PLRetain(AnyWindow);
|
key = PLRetain(AnyWindow);
|
||||||
flags = UPDATE_DEFAULTS;
|
flags = UPDATE_DEFAULTS;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
key = NULL;
|
key = NULL;
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
@@ -462,7 +467,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
if (icon_file) {
|
if (icon_file) {
|
||||||
if (icon_file[0] != 0) {
|
if (icon_file[0] != 0) {
|
||||||
value = PLMakeString(icon_file);
|
value = PLMakeString(icon_file);
|
||||||
insertAttribute(dict, winDic, AIcon, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AIcon, value, flags);
|
||||||
PLRelease(value);
|
PLRelease(value);
|
||||||
}
|
}
|
||||||
free(icon_file);
|
free(icon_file);
|
||||||
@@ -475,7 +480,8 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
|
|
||||||
if (i>=0 && i < panel->frame->screen_ptr->workspace_count) {
|
if (i>=0 && i < panel->frame->screen_ptr->workspace_count) {
|
||||||
value = PLMakeString(panel->frame->screen_ptr->workspaces[i]->name);
|
value = PLMakeString(panel->frame->screen_ptr->workspaces[i]->name);
|
||||||
insertAttribute(dict, winDic, AStartWorkspace, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AStartWorkspace, value,
|
||||||
|
flags);
|
||||||
PLRelease(value);
|
PLRelease(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,66 +489,66 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
flags |= IS_BOOLEAN;
|
flags |= IS_BOOLEAN;
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->alwChk)!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->alwChk)!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AAlwaysUserIcon, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AAlwaysUserIcon, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[0])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[0])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoTitlebar, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoTitlebar, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[1])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[1])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoResizebar, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoResizebar, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[2])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[2])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoCloseButton, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoCloseButton, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[3])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[3])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoMiniaturizeButton, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoMiniaturizeButton, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[4])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[4])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AKeepOnTop, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AKeepOnTop, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[5])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[5])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AKeepOnBottom, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AKeepOnBottom, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[6])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[6])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AOmnipresent, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AOmnipresent, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[7])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[7])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AStartMiniaturized, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AStartMiniaturized, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[8])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[8])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AStartMaximized, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AStartMaximized, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->attrChk[9])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->attrChk[9])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ASkipWindowList, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ASkipWindowList, value, flags);
|
||||||
|
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[0])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[0])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoHideOthers, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoHideOthers, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[1])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[1])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoKeyBindings, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoKeyBindings, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[2])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[2])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoMouseBindings, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoMouseBindings, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[3])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[3])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AKeepInsideScreen, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AKeepInsideScreen,value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[4])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[4])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AUnfocusable, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AUnfocusable, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[5])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[5])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ADontSaveSession, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ADontSaveSession, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[6])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[6])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AEmulateAppIcon, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AEmulateAppIcon, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->moreChk[7])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[7])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AFullMaximize, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AFullMaximize, value, flags);
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
value = (WMGetButtonSelected(panel->moreChk[8])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->moreChk[8])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoLanguageButton, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoLanguageButton, value, flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* application wide settings for when */
|
/* application wide settings for when */
|
||||||
@@ -550,10 +556,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
if (panel->inspected->main_window == panel->inspected->client_win) {
|
if (panel->inspected->main_window == panel->inspected->client_win) {
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, AStartHidden, value, &different, flags);
|
different |= insertAttribute(dict, winDic, AStartHidden, value, flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, winDic, ANoAppIcon, value, &different, flags);
|
different |= insertAttribute(dict, winDic, ANoAppIcon, value, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(dict, key);
|
PLRemoveDictionaryEntry(dict, key);
|
||||||
@@ -575,15 +581,19 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
wapp = wApplicationOf(panel->inspected->main_window);
|
wapp = wApplicationOf(panel->inspected->main_window);
|
||||||
if (wapp) {
|
if (wapp) {
|
||||||
char *iconFile;
|
char *iconFile;
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
appDic = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
appDic = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||||
|
|
||||||
assert(wapp->main_window_desc->wm_instance!=NULL);
|
assert(wapp->main_window_desc->wm_instance!=NULL);
|
||||||
assert(wapp->main_window_desc->wm_class!=NULL);
|
assert(wapp->main_window_desc->wm_class!=NULL);
|
||||||
|
|
||||||
|
buffer = wmalloc(strlen(wapp->main_window_desc->wm_instance)
|
||||||
|
+strlen(wwin->wm_class)+4);
|
||||||
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
|
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
|
||||||
strcat(buffer, wwin->wm_class);
|
strcat(buffer, wwin->wm_class);
|
||||||
key = PLMakeString(buffer);
|
key = PLMakeString(buffer);
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
iconFile = wDefaultGetIconFile(wwin->screen_ptr,
|
iconFile = wDefaultGetIconFile(wwin->screen_ptr,
|
||||||
wapp->main_window_desc->wm_instance,
|
wapp->main_window_desc->wm_instance,
|
||||||
@@ -592,16 +602,18 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
|
|
||||||
if (iconFile && iconFile[0]!=0) {
|
if (iconFile && iconFile[0]!=0) {
|
||||||
value = PLMakeString(iconFile);
|
value = PLMakeString(iconFile);
|
||||||
insertAttribute(dict, appDic, AIcon, value, &different,
|
different |= insertAttribute(dict, appDic, AIcon, value,
|
||||||
flags&~IS_BOOLEAN);
|
flags&~IS_BOOLEAN);
|
||||||
PLRelease(value);
|
PLRelease(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, appDic, AStartHidden, value, &different, flags);
|
different |= insertAttribute(dict, appDic, AStartHidden, value,
|
||||||
|
flags);
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No;
|
||||||
insertAttribute(dict, appDic, ANoAppIcon, value, &different, flags);
|
different |= insertAttribute(dict, appDic, ANoAppIcon, value,
|
||||||
|
flags);
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(dict, key);
|
PLRemoveDictionaryEntry(dict, key);
|
||||||
if (different) {
|
if (different) {
|
||||||
@@ -1099,6 +1111,7 @@ createInspectorForWindow(WWindow *wwin)
|
|||||||
|
|
||||||
tmp = wstrappend(wwin->wm_instance, ".");
|
tmp = wstrappend(wwin->wm_instance, ".");
|
||||||
str = wstrappend(tmp, wwin->wm_class);
|
str = wstrappend(tmp, wwin->wm_class);
|
||||||
|
|
||||||
panel->bothRb = WMCreateRadioButton(panel->specFrm);
|
panel->bothRb = WMCreateRadioButton(panel->specFrm);
|
||||||
WMMoveWidget(panel->bothRb, 10, 18);
|
WMMoveWidget(panel->bothRb, 10, 18);
|
||||||
WMResizeWidget(panel->bothRb, frame_width - (2 * 10), 20);
|
WMResizeWidget(panel->bothRb, frame_width - (2 * 10), 20);
|
||||||
@@ -1507,6 +1520,8 @@ createInspectorForWindow(WWindow *wwin)
|
|||||||
if (!selectedBtn)
|
if (!selectedBtn)
|
||||||
selectedBtn = panel->defaultRb;
|
selectedBtn = panel->defaultRb;
|
||||||
|
|
||||||
|
WMSetButtonSelected(selectedBtn, True);
|
||||||
|
|
||||||
selectSpecification(selectedBtn, panel);
|
selectSpecification(selectedBtn, panel);
|
||||||
|
|
||||||
/* kluge to know who should get the key events */
|
/* kluge to know who should get the key events */
|
||||||
|
|||||||
@@ -498,8 +498,11 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||||
|
|
||||||
if ((tmp = scr->focused_window)!= NULL) {
|
if ((tmp = scr->focused_window)!= NULL) {
|
||||||
if (IS_OMNIPRESENT(tmp) || tmp->flags.changing_workspace)
|
if ((IS_OMNIPRESENT(tmp) && !WFLAGP(tmp, skip_window_list))
|
||||||
|
|| tmp->flags.changing_workspace) {
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
/* foc2 = tmp; will fix annoyance with gnome panel
|
/* foc2 = tmp; will fix annoyance with gnome panel
|
||||||
* but will create annoyance for every other application
|
* but will create annoyance for every other application
|
||||||
*/
|
*/
|
||||||
@@ -552,7 +555,7 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
if (!(tmp->flags.mapped || tmp->flags.miniaturized)) {
|
if (!(tmp->flags.mapped || tmp->flags.miniaturized)) {
|
||||||
/* remap windows that are on this workspace */
|
/* remap windows that are on this workspace */
|
||||||
wWindowMap(tmp);
|
wWindowMap(tmp);
|
||||||
if (!foc)
|
if (!foc && !WFLAGP(tmp, skip_window_list))
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
}
|
}
|
||||||
/* Also map miniwindow if not omnipresent */
|
/* Also map miniwindow if not omnipresent */
|
||||||
@@ -880,7 +883,7 @@ wWorkspaceRestoreState(WScreen *scr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wscount = scr->workspace_count;
|
wscount = scr->workspace_count;
|
||||||
for (i=0; i < PLGetNumberOfElements(parr); i++) {
|
for (i=0; i < WMIN(PLGetNumberOfElements(parr), MAX_WORKSPACES); i++) {
|
||||||
wks_state = PLGetArrayElement(parr, i);
|
wks_state = PLGetArrayElement(parr, i);
|
||||||
if (PLIsDictionary(wks_state))
|
if (PLIsDictionary(wks_state))
|
||||||
pstr = PLGetDictionaryEntry(wks_state, dName);
|
pstr = PLGetDictionaryEntry(wks_state, dName);
|
||||||
|
|||||||
Reference in New Issue
Block a user