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

Code update for Window Maker version 0.50.0

Read changes in ChangeLog and NEWS
This commit is contained in:
dan
1999-01-06 15:22:33 +00:00
parent 16698efd45
commit 0261c32636
232 changed files with 20628 additions and 8087 deletions
+13 -4
View File
@@ -35,18 +35,25 @@ wmaker_SOURCES = \
event.c \
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 \
@@ -69,6 +76,8 @@ wmaker_SOURCES = \
switchmenu.c \
texture.c \
texture.h \
xde.h \
xde.c \
xmodifier.h \
xmodifier.c \
xutil.c \
@@ -93,7 +102,7 @@ wmaker_SOURCES = \
CPPFLAGS = \
@CPPFLAGS@ \
@SHAPE@ @I18N@ @X_LOCALE@ \
@SHAPE@ @I18N@ @X_LOCALE@ @LITE@ \
@DFLAGS@ \
-DNLSDIR="\"$(nlsdir)\"" \
-DPKGDATADIR="\"$(pkgdatadir)\"" \
@@ -107,9 +116,9 @@ INCLUDES = \
wmaker_LDADD = \
-L$(top_builddir)/WINGs -lWINGs\
-L$(top_builddir)/wrlib -lwraster\
-L$(top_builddir)/libPropList -lPropList\
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la\
$(top_builddir)/libPropList/libPropList.la\
@GFXLFLAGS@ \
@XLFLAGS@ \
@GFXLIBS@ \
+64 -25
View File
@@ -69,6 +69,9 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LD = @LD@
LIBTOOL = @LIBTOOL@
LITE = @LITE@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -127,18 +130,25 @@ wmaker_SOURCES = \
event.c \
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 \
@@ -161,6 +171,8 @@ wmaker_SOURCES = \
switchmenu.c \
texture.c \
texture.h \
xde.h \
xde.c \
xmodifier.h \
xmodifier.c \
xutil.c \
@@ -184,7 +196,7 @@ wmaker_SOURCES = \
CPPFLAGS = \
@CPPFLAGS@ \
@SHAPE@ @I18N@ @X_LOCALE@ \
@SHAPE@ @I18N@ @X_LOCALE@ @LITE@ \
@DFLAGS@ \
-DNLSDIR="\"$(nlsdir)\"" \
-DPKGDATADIR="\"$(pkgdatadir)\"" \
@@ -196,9 +208,9 @@ INCLUDES = \
-I$(top_srcdir)/WINGs @XCFLAGS@
wmaker_LDADD = \
-L$(top_builddir)/WINGs -lWINGs\
-L$(top_builddir)/wrlib -lwraster\
-L$(top_builddir)/libPropList -lPropList\
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la\
$(top_builddir)/libPropList/libPropList.la\
@GFXLFLAGS@ \
@XLFLAGS@ \
@GFXLIBS@ \
@@ -220,16 +232,20 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
wmaker_OBJECTS = actions.o appicon.o application.o appmenu.o balloon.o \
client.o colormap.o defaults.o dialog.o dock.o dockedapp.o event.o \
framewin.o icon.o list.o main.o menu.o misc.o moveres.o pixmap.o \
placement.o properties.o proplist.o resources.o rootmenu.o screen.o \
session.o shutdown.o stacking.o startup.o superfluous.o switchmenu.o \
texture.o xmodifier.o xutil.o wcore.o wdefaults.o window.o winmenu.o \
winspector.o workspace.o wmsound.o text.o
wmaker_DEPENDENCIES =
framewin.o gnome.o icon.o kwm.o list.o main.o menu.o misc.o motif.o \
moveres.o openlook.o pixmap.o placement.o properties.o proplist.o \
resources.o rootmenu.o screen.o session.o shutdown.o stacking.o \
startup.o superfluous.o switchmenu.o texture.o xde.o xmodifier.o \
xutil.o wcore.o wdefaults.o window.o winmenu.o winspector.o workspace.o \
wmsound.o text.o
wmaker_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/libPropList/libPropList.la
wmaker_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in config.h.in stamp-h.in \
wconfig.h.in
@@ -244,7 +260,7 @@ OBJECTS = $(wmaker_OBJECTS)
all: Makefile $(PROGRAMS) config.h
.SUFFIXES:
.SUFFIXES: .S .c .o .s
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile
@@ -290,8 +306,8 @@ install-binPROGRAMS: $(bin_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
else :; fi; \
done
@@ -320,6 +336,25 @@ distclean-compile:
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
wmaker: $(wmaker_OBJECTS) $(wmaker_DEPENDENCIES)
@rm -f wmaker
$(LINK) $(wmaker_LDFLAGS) $(wmaker_OBJECTS) $(wmaker_LDADD) $(LIBS)
@@ -397,19 +432,22 @@ maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags \
mostlyclean-generic
mostlyclean-compile mostlyclean-libtool \
mostlyclean-tags mostlyclean-generic
clean: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
clean-generic mostlyclean
clean: clean-hdr clean-binPROGRAMS clean-compile clean-libtool \
clean-tags clean-generic mostlyclean
distclean: distclean-hdr distclean-binPROGRAMS distclean-compile \
distclean-tags distclean-generic clean
distclean-libtool distclean-tags distclean-generic \
clean
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
@@ -417,10 +455,11 @@ maintainer-clean: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info dvi installcheck \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
installcheck install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+20 -6
View File
@@ -62,9 +62,10 @@ enum {
WMFloatingLevel = 3,
WMDockLevel = 4,
WMSubmenuLevel = 5,
WMMainMenuLevel = 6
WMMainMenuLevel = 6,
WMOuterSpaceLevel = 7
};
#define MAX_WINDOW_LEVELS 7
#define MAX_WINDOW_LEVELS 8
/*
* WObjDescriptor will be used by the event dispatcher to
@@ -93,6 +94,15 @@ typedef struct WObjDescriptor {
} WObjDescriptor;
/* shutdown modes */
typedef enum {
WSExitMode,
WSLogoutMode,
WSKillMode,
WSRestartPreparationMode
} WShutdownMode;
/* internal buttons */
#define WBUT_CLOSE 0
#define WBUT_BROKENCLOSE 1
@@ -186,15 +196,19 @@ typedef struct WObjDescriptor {
#define WSTATE_RESTARTING 4
typedef struct {
int x1, y1;
int x2, y2;
} WArea;
typedef struct WCoord {
int x, y;
} WCoord;
typedef struct WPreferences {
char **pixmap_path; /* NULL terminated array of */
char *pixmap_path; /* : separate list of */
/* paths to find pixmaps */
char **icon_path; /* NULL terminated array of */
char *icon_path; /* : separated list of */
/* paths to find icons */
char size_display; /* display type for resize geometry */
@@ -248,7 +262,7 @@ typedef struct WPreferences {
char iconification_style; /* position to place icons */
char disable_root_mouse; /* disable mouse actions in root window */
char disable_root_mouse; /* disable button events in root window */
char auto_focus; /* focus window when it's mapped */
+142 -42
View File
@@ -19,8 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#define HACK
#include "wconfig.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdlib.h>
@@ -46,6 +50,13 @@
#include "list.h"
#include "workspace.h"
#ifdef GNOME_STUFF
# include "gnome.h"
#endif
#ifdef KWM_HINTS
# include "kwm.h"
#endif
#ifdef WMSOUND
#include "wmsound.h"
#endif
@@ -129,9 +140,11 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
int wasfocused;
LastFocusChange = timestamp;
#ifndef HACK
if (ignoreTimestamp)
timestamp=CurrentTime;
#endif
timestamp = CurrentTime;
if (focused)
oapp = wApplicationOf(focused->main_window);
@@ -147,6 +160,10 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
wApplicationDeactivate(oapp);
#endif
}
#ifdef KWM_HINTS
wKWMUpdateActiveWindowHint(scr);
wKWMSendEventMessage(NULL, WKWMFocusWindow);
#endif
return;
}
wasfocused = wwin->flags.focused;
@@ -156,7 +173,7 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
if (napp)
napp->last_workspace = wwin->screen_ptr->current_workspace;
if (wwin->window_flags.no_focusable)
if (WFLAGP(wwin, no_focusable))
return;
if (wwin->flags.mapped) {
@@ -241,6 +258,10 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
wApplicationActivate(napp);
#endif
}
#ifdef KWM_HINTS
wKWMUpdateActiveWindowHint(scr);
wKWMSendEventMessage(wwin, WKWMFocusWindow);
#endif
XFlush(dpy);
}
@@ -303,10 +324,22 @@ wShadeWindow(WWindow *wwin)
/* for the client it's just like iconification */
wFrameWindowResize(wwin->frame, wwin->frame->core->width,
wwin->frame->top_width-1);
wwin->client.y = wwin->frame_y - wwin->client.height
+ wwin->frame->top_width;
wWindowSynthConfigureNotify(wwin);
/*
wClientSetState(wwin, IconicState, None);
*/
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMIconifiedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
/* update window list to reflect shaded state */
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
@@ -368,11 +401,14 @@ wUnshadeWindow(WWindow *wwin)
}
#endif /* ANIMATIONS */
wwin->flags.skip_next_animation = 0;
wFrameWindowResize(wwin->frame, wwin->frame->core->width,
wwin->frame->top_width + wwin->client.height
+ wwin->frame->bottom_width);
wwin->client.y = wwin->frame_y + wwin->frame->top_width;
wWindowSynthConfigureNotify(wwin);
/*
wClientSetState(wwin, NormalState, None);
*/
@@ -381,8 +417,17 @@ wUnshadeWindow(WWindow *wwin)
if (wwin->flags.focused)
wSetFocusTo(wwin->screen_ptr, wwin);
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMIconifiedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
/* update window list to reflect unshaded state */
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
@@ -390,6 +435,7 @@ void
wMaximizeWindow(WWindow *wwin, int directions)
{
int new_width, new_height, new_x, new_y;
WArea usableArea = wwin->screen_ptr->totalUsableArea;
if (wwin->flags.shaded) {
wwin->flags.skip_next_animation = 1;
@@ -400,51 +446,47 @@ wMaximizeWindow(WWindow *wwin, int directions)
wwin->old_geometry.height = wwin->client.height;
wwin->old_geometry.x = wwin->frame_x;
wwin->old_geometry.y = wwin->frame_y;
#ifdef KWM_HINTS
wKWMUpdateClientGeometryRestore(wwin);
#endif
if (directions & MAX_HORIZONTAL) {
new_width = wwin->screen_ptr->scr_width-FRAME_BORDER_WIDTH*2;
new_x = 0;
if ((wPreferences.icon_yard & IY_VERT)
&& wPreferences.no_window_over_icons) {
new_width -= wPreferences.icon_size;
if (!(wPreferences.icon_yard & IY_RIGHT))
new_x += wPreferences.icon_size;
}
new_width = (usableArea.x2-usableArea.x1)-FRAME_BORDER_WIDTH*2;
new_x = usableArea.x1;
if (wwin->screen_ptr->dock
&& (!wwin->screen_ptr->dock->lowered
|| wPreferences.no_window_over_dock)) {
new_width -= wPreferences.icon_size + DOCK_EXTRA_SPACE;
if (!wwin->screen_ptr->dock->on_right_side)
new_x += wPreferences.icon_size + DOCK_EXTRA_SPACE;
}
} else {
new_x = wwin->frame_x;
new_width = wwin->frame->core->width;
}
if (directions & MAX_VERTICAL) {
new_height = wwin->screen_ptr->scr_height-FRAME_BORDER_WIDTH*2;
new_y = 0;
if (!(wPreferences.icon_yard & IY_VERT)
&& wPreferences.no_window_over_icons) {
new_height -= wPreferences.icon_size;
if (wPreferences.icon_yard & IY_TOP)
new_y += wPreferences.icon_size;
}
new_height = (usableArea.y2-usableArea.y1)-FRAME_BORDER_WIDTH*2;
new_y = usableArea.y1;
} else {
new_y = wwin->frame_y;
new_height = wwin->frame->core->height;
}
new_height -= wwin->frame->top_width+wwin->frame->bottom_width;
wWindowConstrainSize(wwin, &new_width, &new_height);
wWindowConfigure(wwin, new_x, new_y, new_width, new_height);
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMMaximizedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
#ifdef WMSOUND
wSoundPlay(WMSOUND_MAXIMIZE);
#endif
@@ -456,6 +498,9 @@ wUnmaximizeWindow(WWindow *wwin)
{
int restore_x, restore_y;
if (!wwin->flags.maximized)
return;
if (wwin->flags.shaded) {
wwin->flags.skip_next_animation = 1;
wUnshadeWindow(wwin);
@@ -468,6 +513,14 @@ wUnmaximizeWindow(WWindow *wwin)
wWindowConfigure(wwin, restore_x, restore_y,
wwin->old_geometry.width, wwin->old_geometry.height);
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMMaximizedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
#ifdef WMSOUND
wSoundPlay(WMSOUND_UNMAXIMIZE);
#endif
@@ -737,7 +790,14 @@ unmapTransientsFor(WWindow *wwin)
XUnmapWindow(dpy, tmp->frame->core->window);
if (!tmp->flags.shaded)
wClientSetState(tmp, IconicState, None);
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(tmp, KWMIconifiedFlag);
wKWMSendEventMessage(tmp, WKWMRemoveWindow);
tmp->flags.kwm_hidden_for_modules = 1;
#endif
UpdateSwitchMenu(wwin->screen_ptr, tmp, ACTION_CHANGE_STATE);
}
tmp = tmp->prev;
}
@@ -765,7 +825,16 @@ mapTransientsFor(WWindow *wwin)
tmp->flags.semi_focused = 0;
if (!tmp->flags.shaded)
wClientSetState(tmp, NormalState, None);
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(tmp, KWMIconifiedFlag);
if (tmp->flags.kwm_hidden_for_modules) {
wKWMSendEventMessage(tmp, WKWMAddWindow);
tmp->flags.kwm_hidden_for_modules = 0;
}
#endif
UpdateSwitchMenu(wwin->screen_ptr, tmp, ACTION_CHANGE_STATE);
}
tmp = tmp->prev;
}
@@ -897,7 +966,8 @@ wIconifyWindow(WWindow *wwin)
wwin->flags.skip_next_animation = 0;
if (wwin->screen_ptr->current_workspace==wwin->frame->workspace ||
wwin->window_flags.omnipresent || wPreferences.sticky_icons)
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
XMapWindow(dpy, wwin->icon->core->window);
AddToStackList(wwin->icon->core);
@@ -913,7 +983,7 @@ wIconifyWindow(WWindow *wwin)
tmp = wwin->prev;
while (tmp) {
if (!tmp->window_flags.no_focusable
if (!WFLAGP(tmp, no_focusable)
&& !(tmp->flags.hidden||tmp->flags.miniaturized))
break;
tmp = tmp->prev;
@@ -941,9 +1011,16 @@ wIconifyWindow(WWindow *wwin)
if (wwin->flags.selected)
wIconSelect(wwin->icon);
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMIconifiedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
@@ -1024,8 +1101,15 @@ wDeiconifyWindow(WWindow *wwin)
wArrangeIcons(wwin->screen_ptr, True);
}
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
#ifdef KWM_HINTS
wKWMUpdateClientStateHint(wwin, KWMIconifiedFlag);
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
@@ -1040,7 +1124,12 @@ hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
XUnmapWindow(dpy, wwin->icon->core->window);
wwin->flags.hidden = 1;
wwin->icon->mapped = 0;
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
return;
}
@@ -1088,7 +1177,12 @@ hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
#endif
wwin->flags.skip_next_animation = 0;
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
@@ -1118,7 +1212,7 @@ wHideOtherApplications(WWindow *awin)
&& !(wwin->flags.miniaturized||wwin->flags.hidden)
&& !wwin->flags.internal_window
&& (!wwin->flags.inspector_open || wwin->inspector->frame!=awin)
&& !wwin->window_flags.no_hide_others) {
&& !WFLAGP(wwin, no_hide_others)) {
#ifdef REDUCE_APPICONS
match = 0;
@@ -1133,8 +1227,8 @@ wHideOtherApplications(WWindow *awin)
}
#endif
if (wwin->main_window==None || wwin->window_flags.no_appicon) {
if (!wwin->window_flags.no_miniaturizable) {
if (wwin->main_window==None || WFLAGP(wwin, no_appicon)) {
if (!WFLAGP(wwin, no_miniaturizable)) {
wwin->flags.skip_next_animation = 1;
wIconifyWindow(wwin);
}
@@ -1149,7 +1243,7 @@ wHideOtherApplications(WWindow *awin)
tapp->flags.skip_next_animation = 1;
wHideApplication(tapp);
} else {
if (!wwin->window_flags.no_miniaturizable) {
if (!WFLAGP(wwin, no_miniaturizable)) {
wwin->flags.skip_next_animation = 1;
wIconifyWindow(wwin);
}
@@ -1250,7 +1344,7 @@ wHideApplication(WApplication *wapp)
if (wPreferences.focus_mode==WKF_CLICK) {
wlist = scr->focused_window;
while (wlist) {
if (!wlist->window_flags.no_focusable && !wlist->flags.hidden
if (!WFLAGP(wlist, no_focusable) && !wlist->flags.hidden
&& (wlist->flags.mapped || wlist->flags.shaded))
break;
wlist = wlist->prev;
@@ -1309,7 +1403,12 @@ unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate,
wClientSetState(pwin, NormalState, None);
}
#ifdef GNOME_STUFF
wGNOMEUpdateClientStateHint(wwin, False);
#endif
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
@@ -1378,7 +1477,9 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS)
wlist->icon->mapped = 1;
}
wlist->flags.hidden = 0;
UpdateSwitchMenu(scr, wlist, ACTION_CHANGE_STATE);
if (wlist->frame->workspace != scr->current_workspace)
wWindowChangeWorkspace(wlist, scr->current_workspace);
}
@@ -1426,7 +1527,7 @@ wShowAllWindows(WScreen *scr)
while (wwin) {
if (!wwin->flags.internal_window &&
(scr->current_workspace == wwin->frame->workspace
|| wwin->window_flags.omnipresent)) {
|| IS_OMNIPRESENT(wwin))) {
if (wwin->flags.miniaturized) {
wwin->flags.skip_next_animation = 1;
wDeiconifyWindow(wwin);
@@ -1569,8 +1670,7 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
while (wwin) {
if (wwin->icon && wwin->flags.miniaturized && !wwin->flags.hidden &&
(wwin->frame->workspace==scr->current_workspace ||
wwin->window_flags.omnipresent ||
wPreferences.sticky_icons)) {
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)) {
if (arrangeAll || !wwin->flags.icon_moved) {
if (wwin->icon_x != X || wwin->icon_y != Y) {
+4
View File
@@ -31,6 +31,7 @@
void wSetFocusTo(WScreen *scr, WWindow *wwin);
int wMouseMoveWindow(WWindow *wwin, XEvent *ev);
int wKeyboardMoveResizeWindow(WWindow *wwin);
void wMouseResizeWindow(WWindow *wwin, XEvent *ev);
@@ -40,7 +41,10 @@ void wUnshadeWindow(WWindow *wwin);
void wIconifyWindow(WWindow *wwin);
void wDeiconifyWindow(WWindow *wwin);
#ifndef LITE
void wSelectWindows(WScreen *scr, XEvent *ev);
#endif
void wSelectWindow(WWindow *wwin, Bool flag);
void wUnselectWindows(WScreen *scr);
+25 -5
View File
@@ -546,10 +546,10 @@ createApplicationMenu(WScreen *scr)
menu = wMenuCreate(scr, NULL, False);
wMenuAddCallback(menu, _("Unhide Here"), unhideHereCallback, NULL);
wMenuAddCallback(menu, _("(Un)Hide"), hideCallback, NULL);
wMenuAddCallback(menu, _("Hide"), hideCallback, NULL);
wMenuAddCallback(menu, _("Set Icon..."), setIconCallback, NULL);
wMenuAddCallback(menu, _("Kill"), killCallback, NULL);
return menu;
}
@@ -563,12 +563,20 @@ openApplicationMenu(WApplication *wapp, int x, int y)
if (!scr->icon_menu) {
scr->icon_menu = createApplicationMenu(scr);
free(scr->window_menu->entries[1]->text);
}
menu = scr->icon_menu;
if (!menu->flags.realized)
wMenuRealize(menu);
if (wapp->flags.hidden) {
menu->entries[1]->text = _("Unhide");
} else {
menu->entries[1]->text = _("Hide");
}
menu->flags.realized = 0;
wMenuRealize(menu);
x -= menu->frame->core->width/2;
if (x + menu->frame->core->width > scr->scr_width)
x = scr->scr_width - menu->frame->core->width;
@@ -741,6 +749,9 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
wDockShowIcons(scr->dock);
}
if (scr->dock->auto_raise_lower)
wDockRaise(scr->dock);
scr->last_dock = scr->dock;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
@@ -778,6 +789,9 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
wDockShowIcons(workspace->clip);
}
if (workspace->clip->auto_raise_lower)
wDockRaise(workspace->clip);
scr->last_dock = workspace->clip;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
@@ -825,6 +839,10 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
if (scr->last_dock->auto_collapse) {
collapsed = 0;
}
if (workspace->clip &&
workspace->clip != scr->last_dock &&
workspace->clip->auto_raise_lower)
wDockLower(workspace->clip);
if (!docked) {
/* If icon could not be docked, slide it back to the old
@@ -836,6 +854,8 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
XMoveWindow(dpy, icon->core->window, x, y);
aicon->x_pos = x;
aicon->y_pos = y;
if (workspace->clip && workspace->clip->auto_raise_lower)
wDockLower(workspace->clip);
}
if (collapsed) {
scr->last_dock->collapsed = 1;
+7 -6
View File
@@ -64,7 +64,6 @@ makeMainWindow(WScreen *scr, Window window)
WWindow *wwin;
XWindowAttributes attr;
if (!XGetWindowAttributes(dpy, window, &attr)) {
return NULL;
}
@@ -80,8 +79,9 @@ makeMainWindow(WScreen *scr, Window window)
*/
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
wDefaultFillAttributes(scr, wwin->wm_instance, wwin->wm_class,
&wwin->window_flags, True);
&wwin->user_flags, &wwin->defined_user_flags, True);
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask
| StructureNotifyMask );
@@ -296,20 +296,21 @@ wApplicationCreate(WScreen *scr, Window main_window)
/*
* Set application wide attributes from the leader.
*/
wapp->flags.hidden = wapp->main_window_desc->window_flags.start_hidden;
wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
wapp->flags.emulated = wapp->main_window_desc->window_flags.emulate_appicon;
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
/* application descriptor */
XSaveContext(dpy, main_window, wAppWinContext, (XPointer)wapp);
if (!wapp->main_window_desc->window_flags.no_appicon) {
if (!WFLAGP(wapp->main_window_desc, no_appicon)) {
wapp->app_icon = NULL;
if (scr->last_dock)
wapp->app_icon = findDockIconFor(scr->last_dock, main_window);
/* check main dock if we did not find it in last dock */
if (!wapp->app_icon && scr->dock)
if (!wapp->app_icon && scr->dock) {
wapp->app_icon = findDockIconFor(scr->dock, main_window);
}
/* finally check clips */
if (!wapp->app_icon) {
int i;
+41 -13
View File
@@ -43,6 +43,9 @@
#include "stacking.h"
#include "appicon.h"
#include "appmenu.h"
#ifdef KWM_HINTS
#include "kwm.h"
#endif
/****** Global Variables ******/
@@ -317,10 +320,16 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
if (!wFetchName(dpy, wwin->client_win, &tmp)) {
/* the hint was removed */
tmp = wstrdup(DEF_WINDOW_TITLE);
#ifdef KWM_HINTS
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
}
if (wFrameWindowChangeTitle(wwin->frame, tmp)) {
/* only update the menu if the title has actually changed */
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);
#ifdef KWM_HINTS
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
}
if (tmp)
free(tmp);
@@ -328,6 +337,9 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
break;
case XA_WM_ICON_NAME:
#ifdef KWM_HINTS
wKWMSendEventMessage(wwin, WKWMChangedClient);
#endif
if (!wwin->icon)
break;
else {
@@ -486,6 +498,9 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
if (wapp && wapp->app_icon) {
wIconUpdate(wapp->app_icon->icon);
}
#ifdef KWM_HINTS
wKWMSendEventMessage(wwin, WKWMIconChange);
#endif
}
if (wwin->wm_hints->flags & UrgencyHint)
@@ -544,15 +559,15 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
}
wwin->transient_for = new_owner;
if (new_owner==None) {
if (wwin->window_flags.no_miniaturizable) {
wwin->window_flags.no_miniaturizable = 0;
wwin->window_flags.no_miniaturize_button = 0;
if (WFLAGP(wwin, no_miniaturizable)) {
WSETUFLAG(wwin, no_miniaturizable, 0);
WSETUFLAG(wwin, no_miniaturize_button, 0);
if (wwin->frame)
wWindowConfigureBorders(wwin);
}
} else if (!wwin->window_flags.no_miniaturizable) {
wwin->window_flags.no_miniaturizable = 1;
wwin->window_flags.no_miniaturize_button = 1;
} else if (!WFLAGP(wwin, no_miniaturizable)) {
WSETUFLAG(wwin, no_miniaturizable, 1);
WSETUFLAG(wwin, no_miniaturize_button, 1);
if (wwin->frame)
wWindowConfigureBorders(wwin);
}
@@ -562,12 +577,11 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
default:
if (event->atom==_XA_WM_PROTOCOLS) {
PropGetProtocols(wwin->client_win, &wwin->protocols);
if (wwin->protocols.DELETE_WINDOW) {
wwin->window_flags.kill_close = 0;
} else {
wwin->window_flags.kill_close = 1;
}
WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
if (wwin->frame)
wWindowUpdateButtonImages(wwin);
@@ -600,6 +614,12 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
wWindowUpdateGNUstepAttr(wwin, attr);
XFree(attr);
} else {
#ifdef KWM_HINTS
Bool done;
done = wKWMCheckClientHintChange(wwin, event);
#endif /* KWM_HINTS */
}
}
}
@@ -651,7 +671,14 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
wwin->normal_hints->max_width = wwin->screen_ptr->scr_width*2;
wwin->normal_hints->max_height = wwin->screen_ptr->scr_height*2;
}
/* some buggy apps set weird hints.. */
if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
wwin->normal_hints->max_width = wwin->normal_hints->min_width;
if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
wwin->normal_hints->max_height = wwin->normal_hints->min_height;
if (!(wwin->normal_hints->flags & PResizeInc)) {
wwin->normal_hints->width_inc = 1;
wwin->normal_hints->height_inc = 1;
@@ -715,7 +742,8 @@ GetColormapWindows(WWindow *wwin)
wwin->cmap_window_no = 0;
if (XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows),
&(wwin->cmap_window_no))!=Success) {
&(wwin->cmap_window_no))!=Success
|| !wwin->cmap_windows) {
wwin->cmap_window_no = 0;
wwin->cmap_windows = NULL;
}
+10 -1
View File
@@ -66,7 +66,13 @@
#define PACKAGE "WindowMaker"
/* package version */
#define VERSION "0.20.3"
#define VERSION "0.50.0"
/* define if you want GNOME stuff support */
/* #undef GNOME_STUFF */
/* define if you want KDE hint support */
/* #undef KWM_HINTS */
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
@@ -98,6 +104,9 @@
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <poll.h> header file. */
/* #undef HAVE_POLL_H */
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
+9
View File
@@ -67,6 +67,12 @@
/* package version */
#undef VERSION
/* define if you want GNOME stuff support */
#undef GNOME_STUFF
/* define if you want KDE hint support */
#undef KWM_HINTS
/* Define if you have the gethostname function. */
#undef HAVE_GETHOSTNAME
@@ -97,6 +103,9 @@
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
+324 -570
View File
File diff suppressed because it is too large Load Diff
+5 -3
View File
@@ -51,13 +51,15 @@ void wSaveDefaults(WScreen *scr);
char *wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
Bool noDefault);
RImage*wDefaultGetImage(WScreen *scr, char *winstance, char *wclass);
RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass);
void wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
WWindowAttributes *attr, Bool useGlobalDefault);
void wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
WWindowAttributes *attr, WWindowAttributes *mask,
Bool useGlobalDefault);
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
#endif /* WMDEFAULTS_H_ */
+317 -40
View File
@@ -48,6 +48,7 @@
#include "framewin.h"
#include "window.h"
#include "actions.h"
#include "defaults.h"
extern WPreferences wPreferences;
@@ -322,17 +323,25 @@ listCallback(void *self, void *data)
static void
listIconPaths(WMList *lPtr)
{
int i;
for (i=0; wPreferences.icon_path[i]!=NULL; i++) {
char *paths;
char *path;
paths = wstrdup(wPreferences.icon_path);
path = strtok(paths, ":");
do {
char *tmp;
tmp = wexpandpath(wPreferences.icon_path[i]);
tmp = wexpandpath(path);
/* do not sort, because the order implies the order of
* directories searched */
if (access(tmp, X_OK)==0)
WMAddListItem(lPtr, wPreferences.icon_path[i]);
WMAddListItem(lPtr, tmp);
free(tmp);
}
} while ((path=strtok(NULL, ":"))!=NULL);
free(paths);
}
@@ -552,6 +561,14 @@ typedef struct {
WMLabel *infoL;
WMLabel *copyrL;
#ifdef SILLYNESS
WMHandlerID timer;
int cycle;
RImage *icon;
RImage *pic;
WMPixmap *oldPix;
#endif
} InfoPanel;
@@ -567,6 +584,20 @@ static InfoPanel *thePanel = NULL;
static void
destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
{
#ifdef SILLYNESS
if (thePanel->timer) {
WMDeleteTimerHandler(thePanel->timer);
}
if (thePanel->oldPix) {
WMReleasePixmap(thePanel->oldPix);
}
if (thePanel->icon) {
RDestroyImage(thePanel->icon);
}
if (thePanel->pic) {
RDestroyImage(thePanel->pic);
}
#endif /* SILLYNESS */
WMUnmapWidget(thePanel);
WMDestroyWidget(thePanel->win);
@@ -574,7 +605,7 @@ destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
wUnmanageWindow(thePanel->wwin, False);
free(thePanel);
thePanel = NULL;
}
@@ -583,7 +614,6 @@ WMPixmap*
renderText(WMScreen *scr, char *text, char *font, RColor *from, RColor *to)
{
WMPixmap *wpix = NULL;
RImage *gradient = NULL;
Pixmap grad = None;
Pixmap mask = None;
RContext *rc = WMScreenRContext(scr);
@@ -598,43 +628,254 @@ renderText(WMScreen *scr, char *text, char *font, RColor *from, RColor *to)
w = XTextWidth(f, text, strlen(text));
h = f->ascent+f->descent;
gradient = RRenderGradient(w, h, from, to, RVerticalGradient);
if (!gradient) {
wwarning("error doing image processing:%s",
RMessageForError(RErrorCode));
goto bye;
}
if (!RConvertImage(rc, gradient, &grad)) {
wwarning("error doing image processing:%s",
RMessageForError(RErrorCode));
goto bye;
}
mask = XCreatePixmap(dpy, rc->drawable, w, h, 1);
gc = XCreateGC(dpy, mask, 0, NULL);
XSetForeground(dpy, gc, rc->black);
XSetForeground(dpy, gc, 0);
XSetFont(dpy, gc, f->fid);
XFillRectangle(dpy, mask, gc, 0, 0, w, h);
XSetForeground(dpy, gc, rc->white);
XSetForeground(dpy, gc, 1);
XDrawString(dpy, mask, gc, 0, f->ascent, text, strlen(text));
XSetLineAttributes(dpy, gc, 3, LineSolid, CapRound, JoinMiter);
XDrawLine(dpy, mask, gc, 0, h-2, w, h-2);
grad = XCreatePixmap(dpy, rc->drawable, w, h, rc->depth);
{
WMColor *color;
color = WMBlackColor(scr);
XFillRectangle(dpy, grad, WMColorGC(color), 0, 0, w, h);
WMReleaseColor(color);
}
wpix = WMCreatePixmapFromXPixmaps(scr, grad, mask, w, h, rc->depth);
bye:
if (gc)
XFreeGC(dpy, gc);
XFreeFont(dpy, f);
if (gradient)
RDestroyImage(gradient);
return wpix;
}
#ifdef SILLYNESS
static void
logoPushCallback(void *data)
{
InfoPanel *panel = (InfoPanel*)data;
char buffer[512];
int i;
if (panel->cycle < 30) {
RImage *image;
WMPixmap *pix;
image = RCloneImage(panel->icon);
RCombineImagesWithOpaqueness(image, panel->pic, panel->cycle*255/30);
pix = WMCreatePixmapFromRImage(panel->scr->wmscreen, image, 128);
RDestroyImage(image);
WMSetLabelImage(panel->logoL, pix);
WMReleasePixmap(pix);
}
i = panel->cycle%150;
strncpy(buffer, "Sloppy focus is a *?#@", i<22 ? i : 22);
if (i >= 22)
memset(&buffer[22], ' ', i-22);
buffer[i]=0;
WMSetLabelText(panel->versionL, buffer);
panel->timer = WMAddTimerHandler(50, logoPushCallback, panel);
panel->cycle++;
}
static void
handleLogoPush(XEvent *event, void *data)
{
InfoPanel *panel = (InfoPanel*)data;
static int broken = 0;
static int clicks = 0;
static char *pic_data[] = {
"45 45 57 1",
" c None",
". c #000000",
"X c #383C00",
"o c #515500",
"O c #616100",
"+ c #616900",
"@ c #696D00",
"# c #697100",
"$ c #495100",
"% c #202800",
"& c #969600",
"* c #CFCF00",
"= c #D7DB00",
"- c #D7D700",
"; c #C7CB00",
": c #A6AA00",
"> c #494900",
", c #8E8E00",
"< c #DFE700",
"1 c #F7FF00",
"2 c #FFFF00",
"3 c #E7EB00",
"4 c #B6B600",
"5 c #595900",
"6 c #717500",
"7 c #AEB200",
"8 c #CFD300",
"9 c #E7EF00",
"0 c #EFF300",
"q c #9EA200",
"w c #F7FB00",
"e c #F7F700",
"r c #BEBE00",
"t c #8E9200",
"y c #EFF700",
"u c #969A00",
"i c #414500",
"p c #595D00",
"a c #E7E700",
"s c #C7C700",
"d c #797D00",
"f c #BEC300",
"g c #DFE300",
"h c #868600",
"j c #EFEF00",
"k c #9E9E00",
"l c #616500",
"z c #DFDF00",
"x c #868A00",
"c c #969200",
"v c #B6BA00",
"b c #A6A600",
"n c #8E8A00",
"m c #717100",
"M c #AEAE00",
"N c #AEAA00",
"B c #868200",
" ............... ",
" ....XoO+@##+O$%.... ",
" ...%X&*========-;;:o... ",
" ...>.>,<122222222222134@... ",
" ..>5678912222222222222220q%.. ",
" ..$.&-w2222222222222222222er>.. ",
" ..O.t31222222222222222222222y4>.. ",
" ...O5u3222222222222222222222222yri... ",
" ..>p&a22222222222222222222222222wso.. ",
" ..ids91222222222222222222222222222wfi.. ",
" ..X.7w222222wgs-w2222222213=g0222222<hi.. ",
" ..Xuj2222222<@X5=222222229k@l:022222y4i.. ",
" .Xdz22222222*X%.s22222222axo%$-222222<c>.. ",
" ..o7y22222222v...r222222223hX.i82222221si.. ",
"..io*222222222&...u22222222yt..%*22222220:%. ",
"..>k02222222227...f222222222v..X=222222229t. ",
"..dz12222222220ui:y2222222223d%qw222222221g. ",
".%vw222222222221y2222222222219*y2222222222wd.",
".X;2222222222222222222222222222222222222222b.",
".i*2222222222222222222222222222222222222222v.",
".i*2222222222222222222222222222222222222222;.",
".i*22222222222222222222222222222222222222228.",
".>*2222222222222222222222222222222222222222=.",
".i*22222222222222222222222222222222222222228.",
".i*2222222222222222222222222222222222222222;.",
".X*222222222222222222222222222222we12222222r.",
".Xs12222222w3aw22222222222222222y8s0222222wk.",
".Xq02222222a,na22222222222222222zm6zwy2222gi.",
"..>*22222y<:Xcj22222222222222222-o$k;;02228..",
"..i7y2220rhX.:y22222222222222222jtiXd,a220,..",
" .X@z222a,do%kj2222222222222222wMX5q;gw228%..",
" ..58222wagsh6ry222222222222221;>Of0w222y:...",
" ...:e2222218mdz22222222222222a&$vw222220@...",
" ...O-122222y:.u02222222222229q$uj222221r... ",
" ..%&a1222223&573w2222222219NOxz122221z>... ",
" ...t3222221-l$nr8ay1222yzbo,=12222w-5... ",
" ..X:022222w-k+>o,7s**s7xOn=12221<f5... ",
" ..o:9222221j8:&Bl>>>>ihv<12221=dX... ",
" ..Xb9122222109g-****;<y22221zn%... ",
" ..X&801222222222222222222w-h.... ",
" ...o:=022222222222222221=lX... ",
" ..X@:;3w2222222222210fO... ",
" ...XX&v8<30000003-N@... ",
" .....XmnbN:q&Bo.... ",
" ............ "};
clicks++;
if (!panel->timer && !broken && clicks > 2) {
char *file;
char *path;
clicks = 0;
if (!panel->icon) {
file = wDefaultGetIconFile(panel->scr, "Logo", "WMPanel", False);
if (!file) {
broken = 1;
return;
}
path = FindImage(wPreferences.icon_path, file);
if (!path) {
broken = 1;
return;
}
panel->icon = RLoadImage(panel->scr->rcontext, path, 0);
free(path);
if (!panel->icon) {
broken = 1;
return;
}
}
if (!panel->pic) {
panel->pic = RGetImageFromXPMData(panel->scr->rcontext, pic_data);
if (!panel->pic || panel->icon->width!=panel->pic->width
|| panel->icon->height!=panel->pic->height) {
broken = 1;
RDestroyImage(panel->icon);
panel->icon = NULL;
if (panel->pic) {
RDestroyImage(panel->pic);
panel->pic = NULL;
}
return;
}
{
RColor color;
color.red = 0xae;
color.green = 0xaa;
color.blue = 0xae;
color.alpha = 255;
RCombineImageWithColor(panel->icon, &color);
RCombineImageWithColor(panel->pic, &color);
}
}
panel->timer = WMAddTimerHandler(50, logoPushCallback, panel);
panel->cycle = 0;
panel->oldPix = WMRetainPixmap(WMGetLabelImage(panel->logoL));
} else if (panel->timer) {
char version[20];
clicks = 0;
WMSetLabelImage(panel->logoL, panel->oldPix);
WMReleasePixmap(panel->oldPix);
panel->oldPix = NULL;
WMDeleteTimerHandler(panel->timer);
panel->timer = NULL;
sprintf(version, "Version %s", VERSION);
WMSetLabelText(panel->versionL, version);
}
{
XEvent ev;
while (XCheckTypedWindowEvent(dpy, WMWidgetXID(panel->versionL),
ButtonPress, &ev));
}
}
#endif /* SILLYNESS */
void
wShowInfoPanel(WScreen *scr)
@@ -666,6 +907,7 @@ wShowInfoPanel(WScreen *scr)
}
panel = wmalloc(sizeof(InfoPanel));
memset(panel, 0, sizeof(InfoPanel));
panel->scr = scr;
@@ -680,6 +922,10 @@ wShowInfoPanel(WScreen *scr)
WMMoveWidget(panel->logoL, 30, 20);
WMSetLabelImagePosition(panel->logoL, WIPImageOnly);
WMSetLabelImage(panel->logoL, logo);
#ifdef SILLYNESS
WMCreateEventHandler(WMWidgetView(panel->logoL), ButtonPressMask,
handleLogoPush, panel);
#endif
}
panel->name1L = WMCreateLabel(panel->win);
@@ -690,7 +936,7 @@ wShowInfoPanel(WScreen *scr)
color1.blue = 0;
color2.red = 0x50;
color2.green = 0x50;
color2.blue = 0x60;
color2.blue = 0x70;
logo = renderText(scr->wmscreen, " Window Maker ",
"-*-times-bold-r-*-*-24-*", &color1, &color2);
if (logo) {
@@ -720,11 +966,11 @@ wShowInfoPanel(WScreen *scr)
sprintf(version, "Version %s", VERSION);
panel->versionL = WMCreateLabel(panel->win);
WMResizeWidget(panel->versionL, 150, 16);
WMMoveWidget(panel->versionL, 190, 95);
WMResizeWidget(panel->versionL, 310, 16);
WMMoveWidget(panel->versionL, 30, 95);
WMSetLabelTextAlignment(panel->versionL, WARight);
WMSetLabelText(panel->versionL, version);
WMSetLabelWraps(panel->versionL, False);
panel->copyrL = WMCreateLabel(panel->win);
WMResizeWidget(panel->copyrL, 340, 40);
@@ -763,11 +1009,42 @@ wShowInfoPanel(WScreen *scr)
strcat(buffer, strl[i]);
strcat(buffer, " ");
}
#ifdef WMSOUND
strcat(buffer, "\nSound support compiled in");
#else
strcat(buffer, "\nSound support not available");
strcat(buffer, "\nAdditional Support For: ");
{
char *list[8];
char buf[80];
int j = 0;
#ifdef MWM_HINTS
list[j++] = "MWM";
#endif
#ifdef KWM_HINTS
list[j++] = "KDE";
#endif
#ifdef GNOME_STUFF
list[j++] = "GNOME";
#endif
#ifdef OLWM_HINTS
list[j++] = "OLWM";
#endif
#ifdef WMSOUND
list[j++] = "Sound";
#endif
buf[0] = 0;
for (i = 0; i < j; i++) {
if (i > 0) {
if (i == j - 1)
strcat(buf, " and ");
else
strcat(buf, ", ");
}
strcat(buf, list[i]);
}
strcat(buffer, buf);
}
panel->infoL = WMCreateLabel(panel->win);
WMResizeWidget(panel->infoL, 350, 75);
@@ -792,8 +1069,8 @@ wShowInfoPanel(WScreen *scr)
(scr->scr_width - 382)/2,
(scr->scr_height - 230)/2, 382, 230);
wwin->window_flags.no_closable = 0;
wwin->window_flags.no_close_button = 0;
WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_close_button, 0);
wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
wwin->frame->on_click_right = destroyInfoPanel;
@@ -895,8 +1172,8 @@ wShowLegalPanel(WScreen *scr)
(scr->scr_width - 420)/2,
(scr->scr_height - 250)/2, 420, 250);
wwin->window_flags.no_closable = 0;
wwin->window_flags.no_close_button = 0;
WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_close_button, 0);
wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
wwin->frame->on_click_right = destroyLegalPanel;
+199 -53
View File
@@ -111,6 +111,8 @@ static proplist_t dAutoAttractIcons, dKeepAttracted;
static proplist_t dPosition, dApplications, dLowered, dCollapsed, dAutoCollapse;
static proplist_t dAutoRaiseLower;
static void dockIconPaint(WAppIcon *btn);
static void iconMouseDown(WObjDescriptor *desc, XEvent *event);
@@ -125,8 +127,6 @@ static void toggleLowered(WDock *dock);
static void toggleCollapsed(WDock *dock);
static void toggleAutoCollapse(WDock *dock);
static void clipIconExpose(WObjDescriptor *desc, XEvent *event);
static void clipLeave(WDock *dock);
@@ -140,6 +140,9 @@ static void clipLeaveNotify(WObjDescriptor *desc, XEvent *event);
static void clipAutoCollapse(void *cdata);
static void launchDockedApplication(WAppIcon *btn);
static void clipAutoLower(void *cdata);
static void clipAutoRaise(void *cdata);
static void showClipBalloon(WDock *dock, int workspace);
#ifdef OFFIX_DND
@@ -183,6 +186,7 @@ make_keys()
dLowered = PLMakeString("Lowered");
dCollapsed = PLMakeString("Collapsed");
dAutoCollapse = PLMakeString("AutoCollapse");
dAutoRaiseLower = PLMakeString("AutoRaiseLower");
dAutoAttractIcons = PLMakeString("AutoAttractIcons");
dKeepAttracted = PLMakeString("KeepAttracted");
@@ -659,9 +663,16 @@ toggleCollapsedCallback(WMenu *menu, WMenuEntry *entry)
static void
toggleAutoCollapseCallback(WMenu *menu, WMenuEntry *entry)
{
WDock *dock;
assert(entry->clientdata!=NULL);
toggleAutoCollapse(entry->clientdata);
dock = (WDock*) entry->clientdata;
dock->auto_collapse = !dock->auto_collapse;
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
}
entry->flags.indicator_on = ((WDock*)entry->clientdata)->auto_collapse;
@@ -669,6 +680,22 @@ toggleAutoCollapseCallback(WMenu *menu, WMenuEntry *entry)
}
static void
toggleAutoRaiseLowerCallback(WMenu *menu, WMenuEntry *entry)
{
WDock *dock;
assert(entry->clientdata!=NULL);
dock = (WDock*) entry->clientdata;
dock->auto_raise_lower = !dock->auto_raise_lower;
entry->flags.indicator_on = ((WDock*)entry->clientdata)->auto_raise_lower;
wMenuPaint(menu);
}
static void
launchCallback(WMenu *menu, WMenuEntry *entry)
{
@@ -805,8 +832,8 @@ launchDockedApplication(WAppIcon *btn)
if (btn->wm_instance || btn->wm_class) {
WWindowAttributes attr;
memset(&attr, 0, sizeof(WWindowAttributes));
wDefaultFillAttributes(scr, btn->wm_instance, btn->wm_class, &attr,
True);
wDefaultFillAttributes(scr, btn->wm_instance, btn->wm_class,
&attr, NULL, True);
if (!attr.no_appicon && !btn->buggy_app)
btn->launching = 1;
@@ -917,6 +944,11 @@ updateClipOptionsMenu(WMenu *menu, WDock *dock)
entry->flags.indicator_on = dock->auto_collapse;
entry->clientdata = dock;
/* auto-raise/lower */
entry = menu->entries[++index];
entry->flags.indicator_on = dock->auto_raise_lower;
entry->clientdata = dock;
/* attract icons */
entry = menu->entries[++index];
entry->flags.indicator_on = dock->attract_icons;
@@ -962,6 +994,12 @@ makeClipOptionsMenu(WScreen *scr)
entry->flags.indicator_on = 1;
entry->flags.indicator_type = MI_CHECK;
entry = wMenuAddCallback(menu, _("AutoRaiseLower"),
toggleAutoRaiseLowerCallback, NULL);
entry->flags.indicator = 1;
entry->flags.indicator_on = 1;
entry->flags.indicator_type = MI_CHECK;
entry = wMenuAddCallback(menu, _("AutoAttract Icons"),
toggleAutoAttractCallback, NULL);
entry->flags.indicator = 1;
@@ -1074,6 +1112,9 @@ wDockCreate(WScreen *scr, int type)
dock->collapsed = 0;
dock->auto_collapse = 0;
dock->auto_collapse_magic = NULL;
dock->auto_raise_lower = 0;
dock->auto_lower_magic = NULL;
dock->auto_raise_magic = NULL;
dock->attract_icons = 0;
dock->keep_attracted = 0;
dock->lowered = 1;
@@ -1289,6 +1330,9 @@ dockSaveState(WDock *dock)
value = (dock->auto_collapse ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoCollapse, value);
value = (dock->auto_raise_lower ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoRaiseLower, value);
value = (dock->attract_icons ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoAttractIcons, value);
@@ -1626,6 +1670,21 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
}
/* restore auto-raise/lower state */
value = PLGetDictionaryEntry(dock_state, dAutoRaiseLower);
if (value) {
if (!PLIsString(value))
COMPLAIN("AutoRaiseLower");
else {
if (strcasecmp(PLGetString(value), "YES")==0) {
dock->auto_raise_lower = 1;
}
}
}
/* restore attract icons state */
dock->attract_icons = 0;
@@ -1656,10 +1715,10 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
dock->keep_attracted = 1;
}
}
/* application list */
apps = PLGetDictionaryEntry(dock_state, dApplications);
if (!apps) {
@@ -1732,11 +1791,11 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
scr->clip_icon = dock->icon_array[0];
wAppIconDestroy(old_top);
}
finish:
if (dock_state)
PLRelease(dock_state);
return dock;
}
@@ -1867,7 +1926,7 @@ wDockReceiveDNDDrop(WScreen *scr, XEvent *event)
memset(&attr, 0, sizeof(WWindowAttributes));
wDefaultFillAttributes(btn->icon->core->screen_ptr,
btn->wm_instance,
btn->wm_class, &attr, True);
btn->wm_class, &attr, NULL, True);
if (!attr.no_appicon)
btn->launching = 1;
@@ -2107,7 +2166,7 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
}
}
if (src->auto_collapse)
if (src->auto_collapse || src->auto_raise_lower)
clipLeave(src);
icon->yindex = y;
@@ -2125,6 +2184,7 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
return True;
}
void
wDockDetach(WDock *dock, WAppIcon *icon)
{
@@ -2190,7 +2250,7 @@ wDockDetach(WDock *dock, WAppIcon *icon)
wArrangeIcons(dock->screen_ptr, True);
}
}
if (dock->auto_collapse)
if (dock->auto_collapse || dock->auto_raise_lower)
clipLeave(dock);
}
@@ -2638,6 +2698,8 @@ swapDock(WDock *dock)
XMoveWindow(dpy, btn->icon->core->window, btn->x_pos, btn->y_pos);
}
}
wScreenUpdateUsableArea(scr);
}
@@ -2676,8 +2738,6 @@ execCommand(WAppIcon *btn, char *command, WSavedState *state)
SetupEnvironment(scr);
CloseDescriptors();
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
@@ -2846,22 +2906,39 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
#endif
char *wm_class, *wm_instance;
int i;
Bool firstPass = True;
Bool found = False;
char *command = NULL;
{
int argc;
char **argv;
if (XGetCommand(dpy, window, &argv, &argc)) {
if (argc > 0 && argv != NULL)
command = FlattenStringList(argv,argc);
if (argv) {
XFreeStringList(argv);
}
}
}
if (!PropGetWMClass(window, &wm_class, &wm_instance) ||
(!wm_class && !wm_instance))
return;
retry:
for (i=0; i<dock->max_icons; i++) {
icon = dock->icon_array[i];
if (!icon)
continue;
/* kluge. If this does not exist, some windows attach themselves
* to more than one icon. Find out why */
/* app is already attached to icon */
if (icon->main_window == window) {
found = True;
break;
}
if ((icon->wm_instance || icon->wm_class)
&& (icon->launching
|| (dock->screen_ptr->flags.startup && !icon->running))) {
@@ -2874,6 +2951,9 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
strcmp(icon->wm_class, wm_class)!=0) {
continue;
}
if (firstPass && command && strcmp(icon->command, command)!=0) {
continue;
}
if (!icon->relaunching) {
WApplication *wapp;
@@ -2888,6 +2968,7 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
}
if (!icon->forced_dock)
icon->main_window = window;
#ifdef REDUCE_APPICONS
tapplist = wmalloc(sizeof(WAppIconAppList));
memset(tapplist, 0, sizeof(WAppIconAppList));
@@ -2899,11 +2980,20 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
icon->num_apps++;
#endif
}
found = True;
wDockFinishLaunch(dock, icon);
break;
}
}
if (firstPass && !found) {
firstPass = False;
goto retry;
}
if (command)
free(command);
if (wm_class)
XFree(wm_class);
if (wm_instance)
@@ -2921,7 +3011,9 @@ wClipUpdateForWorkspaceChange(WScreen *scr, int workspace)
WDock *old_clip = scr->workspaces[scr->current_workspace]->clip;
wDockHideIcons(old_clip);
if (old_clip->auto_collapse && !old_clip->collapsed)
if (old_clip->auto_raise_lower)
wDockLower(old_clip);
if (old_clip->auto_collapse && !old_clip->collapsed)
old_clip->collapsed = 1;
wDockShowIcons(scr->workspaces[workspace]->clip);
}
@@ -2993,6 +3085,9 @@ toggleLowered(WDock *dock)
if (dock->lowered)
wLowerFrame(tmp->icon->core);
}
if (dock->type == WM_DOCK)
wScreenUpdateUsableArea(dock->screen_ptr);
}
@@ -3010,17 +3105,6 @@ toggleCollapsed(WDock *dock)
}
static void
toggleAutoCollapse(WDock *dock)
{
dock->auto_collapse = !dock->auto_collapse;
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
}
}
static void
openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
{
@@ -3373,7 +3457,7 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
WScreen *scr = dock->screen_ptr;
Window wins[2];
WIcon *icon = aicon->icon;
WDock *dock2 = NULL, *last_dock = dock;
WDock *dock2 = NULL, *last_dock = dock, *clip = NULL;
int ondock, grabbed = 0, change_dock = 0, collapsed = 0;
XEvent ev;
int x = aicon->x_pos, y = aicon->y_pos;
@@ -3398,8 +3482,11 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
wRaiseFrame(icon->core);
if (!wPreferences.flags.noclip)
clip = scr->workspaces[scr->current_workspace]->clip;
if (dock == scr->dock && !wPreferences.flags.noclip)
dock2 = scr->workspaces[scr->current_workspace]->clip;
dock2 = clip;
else if (dock != scr->dock && !wPreferences.flags.nodock)
dock2 = scr->dock;
@@ -3418,7 +3505,7 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
XClearWindow(dpy, scr->dock_shadow);
}
XMapWindow(dpy, scr->dock_shadow);
ondock = 1;
@@ -3457,6 +3544,8 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
dock->collapsed = 0;
wDockShowIcons(dock);
}
if (dock->auto_raise_lower)
wDockRaise(dock);
last_dock = dock;
}
else if (dock2) {
@@ -3472,6 +3561,8 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
dock2->collapsed = 0;
wDockShowIcons(dock2);
}
if (dock2->auto_raise_lower)
wDockRaise(dock2);
last_dock = dock2;
}
}
@@ -3520,9 +3611,11 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
if (ondock) {
SlideWindow(icon->core->window, x, y, shad_x, shad_y);
XUnmapWindow(dpy, scr->dock_shadow);
if (!change_dock)
if (!change_dock) {
reattachIcon(dock, aicon, ix, iy);
else {
if (clip && dock!=clip && clip->auto_raise_lower)
wDockLower(clip);
} else {
docked = moveIconBetweenDocks(dock, dock2, aicon, ix, iy);
if (!docked) {
/* Slide it back if dock rejected it */
@@ -3547,6 +3640,8 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
DoKaboom(scr,aicon->icon->core->window, x, y);
}
}
if (clip && clip->auto_raise_lower)
wDockLower(clip);
wDockDetach(dock, aicon);
}
if (collapsed) {
@@ -3763,7 +3858,7 @@ showClipBalloon(WDock *dock, int workspace)
wDrawString(scr->clip_balloon, scr->clip_title_font, scr->clip_title_gc,
0, scr->clip_title_font->y, text, strlen(text));
}
static void
clipEnterNotify(WObjDescriptor *desc, XEvent *event)
@@ -3780,6 +3875,16 @@ clipEnterNotify(WObjDescriptor *desc, XEvent *event)
if (!dock || dock->type!=WM_CLIP)
return;
if (dock->auto_lower_magic) {
WMDeleteTimerHandler(dock->auto_lower_magic);
dock->auto_lower_magic = NULL;
}
if (dock->auto_raise_lower) {
dock->auto_raise_magic = WMAddTimerHandler(AUTO_RAISE_DELAY,
clipAutoRaise,
(void *)dock);
}
if (btn->xindex == 0 && btn->yindex == 0)
showClipBalloon(dock, dock->screen_ptr->current_workspace);
else {
@@ -3788,33 +3893,44 @@ clipEnterNotify(WObjDescriptor *desc, XEvent *event)
dock->screen_ptr->flags.clip_balloon_mapped = 0;
}
}
if (!dock->auto_collapse)
return;
if (dock->auto_collapse) {
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
}
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
if (dock->collapsed)
toggleCollapsed(dock);
}
if (dock->collapsed)
toggleCollapsed(dock);
}
static void
clipLeave(WDock *dock)
{
if (!dock || dock->type!=WM_CLIP || !dock->auto_collapse)
if (!dock || dock->type!=WM_CLIP)
return;
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
if (dock->auto_raise_magic) {
WMDeleteTimerHandler(dock->auto_raise_magic);
dock->auto_raise_magic = NULL;
}
if (!dock->collapsed) {
dock->auto_collapse_magic = WMAddTimerHandler(AUTO_COLLAPSE_DELAY,
clipAutoCollapse,
(void *)dock);
if (dock->auto_raise_lower) {
dock->auto_lower_magic = WMAddTimerHandler(AUTO_LOWER_DELAY,
clipAutoLower,
(void *)dock);
}
if (dock->auto_collapse) {
if (dock->auto_collapse_magic) {
WMDeleteTimerHandler(dock->auto_collapse_magic);
dock->auto_collapse_magic = NULL;
}
if (!dock->collapsed) {
dock->auto_collapse_magic = WMAddTimerHandler(AUTO_COLLAPSE_DELAY,
clipAutoCollapse,
(void *)dock);
}
}
}
@@ -3847,3 +3963,33 @@ clipAutoCollapse(void *cdata)
dock->auto_collapse_magic = NULL;
}
static void
clipAutoLower(void *cdata)
{
WDock *dock = (WDock *)cdata;
if (dock->type!=WM_CLIP)
return;
if (dock->auto_raise_lower)
wDockLower(dock);
dock->auto_lower_magic = NULL;
}
static void
clipAutoRaise(void *cdata)
{
WDock *dock = (WDock *)cdata;
if (dock->type!=WM_CLIP)
return;
if (dock->auto_raise_lower)
wDockRaise(dock);
dock->auto_raise_magic = NULL;
}
+4
View File
@@ -44,7 +44,11 @@ typedef struct WDock {
int type;
WMagicNumber auto_collapse_magic;
WMagicNumber auto_raise_magic;
WMagicNumber auto_lower_magic;
unsigned int auto_collapse:1; /* if clip auto-collapse itself */
unsigned int auto_raise_lower:1; /* if clip should raise/lower when
* entered/leaved */
unsigned int on_right_side:1;
unsigned int collapsed:1;
unsigned int mapped:1;
+86 -147
View File
@@ -35,8 +35,7 @@
#include <X11/extensions/shape.h>
#endif
#ifdef XDE_DND
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#include "xde.h"
#endif
#ifdef KEEP_XKB_LOCK_STATUS
@@ -57,7 +56,12 @@
#include "framewin.h"
#include "properties.h"
#include "balloon.h"
#ifdef GNOME_STUFF
# include "gnome.h"
#endif
#ifdef KWM_HINTS
# include "kwm.h"
#endif
/******** Global Variables **********/
extern XContext wWinContext;
@@ -83,14 +87,6 @@ extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
#ifdef OFFIX_DND
extern Atom _XA_DND_PROTOCOL;
#endif
#ifdef XDE_DND
extern Atom _XA_XDE_REQUEST;
extern Atom _XA_XDE_ENTER;
extern Atom _XA_XDE_LEAVE;
extern Atom _XA_XDE_DATA_AVAILABLE;
extern Atom _XDE_FILETYPE;
extern Atom _XDE_URLTYPE;
#endif
#ifdef SHAPE
@@ -204,41 +200,23 @@ wDeleteDeathHandler(WMagicNumber id)
void
DispatchEvent(XEvent *event)
{
int i;
if (deathHandler)
handleDeadProcess(NULL);
if (WProgramState==WSTATE_NEED_EXIT) {
WProgramState = WSTATE_EXITING;
/* received SIGTERM */
/*
* WMHandleEvent() can't be called from anything
* executed inside here, or we can get in a infinite
* recursive loop.
*/
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr) {
wScreenSaveState(scr);
}
}
RestoreDesktop(NULL);
ExecExitScript();
/* received SIGTERM */
Exit(0);
Shutdown(WSExitMode);
} else if (WProgramState == WSTATE_NEED_RESTART) {
WProgramState = WSTATE_RESTARTING;
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr) {
wScreenSaveState(scr);
}
}
RestoreDesktop(NULL);
Shutdown(WSRestartPreparationMode);
/* received SIGHUP */
Restart(NULL);
}
@@ -267,7 +245,7 @@ DispatchEvent(XEvent *event)
break;
case DestroyNotify:
handleDestroyNotify(event->xdestroywindow.window);
handleDestroyNotify(event);
break;
case MapNotify:
@@ -464,6 +442,7 @@ handleExtensions(XEvent *event)
#endif
}
static void
handleMapRequest(XEvent *ev)
{
@@ -477,6 +456,9 @@ handleMapRequest(XEvent *ev)
if ((wwin=wWindowFor(window))) {
/* deiconify window */
if (wwin->flags.maximized) {
wMaximizeWindow(wwin, wwin->flags.maximized);
}
if (wwin->flags.shaded)
wUnshadeWindow(wwin);
if (wwin->flags.miniaturized) {
@@ -514,6 +496,7 @@ handleMapRequest(XEvent *ev)
wDockTrackWindowLaunch(scr->last_dock, window);
}
if (wwin) {
int state;
@@ -558,10 +541,12 @@ handleMapRequest(XEvent *ev)
static void
handleDestroyNotify(Window window)
handleDestroyNotify(XEvent *event)
{
WWindow *wwin;
WApplication *app;
Window window = event->xdestroywindow.window;
#ifdef DEBUG
puts("got destroy notify");
#endif
@@ -585,6 +570,10 @@ handleDestroyNotify(Window window)
}
wApplicationDestroy(app);
}
#ifdef KWM_HINTS
wKWMCheckDestroy(&event->xdestroywindow);
#endif
}
@@ -629,6 +618,7 @@ handleButtonPress(XEvent *event)
wBalloonHide(scr);
#endif
#ifndef LITE
if (event->xbutton.window==scr->root_win) {
if (event->xbutton.button==wPreferences.menu_button) {
OpenRootMenu(scr, event->xbutton.x_root,
@@ -641,7 +631,6 @@ handleButtonPress(XEvent *event)
event->xbutton.window = scr->root_menu->frame->core->window;
}
} else if (event->xbutton.button==wPreferences.windowl_button) {
OpenSwitchMenu(scr, event->xbutton.x_root,
event->xbutton.y_root, False);
if (scr->switch_menu) {
@@ -651,24 +640,23 @@ handleButtonPress(XEvent *event)
event->xbutton.window = scr->switch_menu->frame->core->window;
}
} else if (event->xbutton.button==wPreferences.select_button) {
wUnselectWindows(scr);
wSelectWindows(scr, event);
}
#ifdef MOUSE_WS_SWITCH
else if (event->xbutton.button==Button4) {
if (scr->current_workspace > 0)
wWorkspaceChange(scr, scr->current_workspace-1);
wWorkspaceRelativeChange(scr, -1);
} else if (event->xbutton.button==Button5) {
if (scr->current_workspace < scr->workspace_count-1)
wWorkspaceChange(scr, scr->current_workspace+1);
wWorkspaceRelativeChange(scr, 1);
}
#endif /* MOUSE_WS_SWITCH */
}
#endif /* !LITE */
if (XFindContext(dpy, event->xbutton.subwindow, wWinContext,
(XPointer *)&desc)==XCNOENT) {
@@ -820,6 +808,7 @@ handlePropertyNotify(XEvent *event)
Window jr;
int ji;
unsigned int ju;
WScreen *scr;
#ifdef DEBUG
puts("got property notify");
@@ -835,6 +824,13 @@ handlePropertyNotify(XEvent *event)
if (wapp) {
wClientCheckProperty(wapp->main_window_desc, &event->xproperty);
}
scr = wScreenForRootWindow(event->xproperty.window);
if (scr) {
#ifdef KWM_HINTS
wKWMCheckRootHintChange(scr, &event->xproperty);
#endif
}
}
@@ -899,83 +895,17 @@ handleClientMessage(XEvent *event)
}
}
}
#ifdef GNOME_STUFF
} else if (wGNOMEProcessClientMessage(&event->xclient)) {
/* do nothing */
#endif /* GNOME_STUFF */
#ifdef KWM_HINTS
} else if (wKWMProcessClientMessage(&event->xclient)) {
/* do nothing */
#endif /* KWM_HINTS */
#ifdef XDE_DND
} else if (event->xclient.message_type==_XA_XDE_DATA_AVAILABLE) {
GdkEvent gdkev;
WScreen *scr = wScreenForWindow(event->xclient.window);
Atom tmpatom;
int datalenght;
long tmplong;
char * tmpstr, * runstr, * freestr, * tofreestr;
printf("x\n");
gdkev.dropdataavailable.u.allflags = event->xclient.data.l[1];
gdkev.dropdataavailable.timestamp = event->xclient.data.l[4];
if(gdkev.dropdataavailable.u.flags.isdrop){
gdkev.dropdataavailable.type = GDK_DROP_DATA_AVAIL;
gdkev.dropdataavailable.requestor = event->xclient.data.l[0];
XGetWindowProperty(dpy,gdkev.dropdataavailable.requestor,
event->xclient.data.l[2],
0, LONG_MAX -1,
0, XA_PRIMARY, &tmpatom,
&datalenght,
&gdkev.dropdataavailable.data_numbytes,
&tmplong,
&tmpstr);
datalenght=gdkev.dropdataavailable.data_numbytes-1;
tofreestr=tmpstr;
runstr=NULL;
for(;datalenght>0;datalenght-=(strlen(tmpstr)+1),tmpstr=&tmpstr[strlen(tmpstr)+1]){
freestr=runstr;runstr=wstrappend(runstr,tmpstr);free(freestr);
freestr=runstr;runstr=wstrappend(runstr," ");free(freestr);
}
free(tofreestr);
scr->xdestring=runstr;
/* no need to redirect ? */
wDockReceiveDNDDrop(scr,event);
free(runstr);
scr->xdestring=NULL;
}
} else if (event->xclient.message_type==_XA_XDE_LEAVE) {
printf("leave\n");
} else if (event->xclient.message_type==_XA_XDE_ENTER) {
GdkEvent gdkev;
XEvent replyev;
gdkev.dropenter.u.allflags=event->xclient.data.l[1];
printf("from win %x\n",event->xclient.data.l[0]);
printf("to win %x\n",event->xclient.window);
printf("enter %x\n",event->xclient.data.l[1]);
printf("v %x ",event->xclient.data.l[2]);
printf("%x ",event->xclient.data.l[3]);
printf("%x\n",event->xclient.data.l[4]);
if(event->xclient.data.l[2]==_XDE_FILETYPE ||
event->xclient.data.l[3]==_XDE_FILETYPE ||
event->xclient.data.l[4]==_XDE_FILETYPE ||
event->xclient.data.l[2]==_XDE_URLTYPE ||
event->xclient.data.l[3]==_XDE_URLTYPE ||
event->xclient.data.l[4]==_XDE_URLTYPE)
if(gdkev.dropenter.u.flags.sendreply){
/*reply*/
replyev.xclient.type = ClientMessage;
replyev.xclient.window = event->xclient.data.l[0];
replyev.xclient.format = 32;
replyev.xclient.message_type = _XA_XDE_REQUEST;
replyev.xclient.data.l[0] = event->xclient.window;
gdkev.dragrequest.u.allflags = 0;
gdkev.dragrequest.u.flags.protocol_version = 0;
gdkev.dragrequest.u.flags.willaccept = 1;
gdkev.dragrequest.u.flags.delete_data = 0;
replyev.xclient.data.l[1] = gdkev.dragrequest.u.allflags;
replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
replyev.xclient.data.l[4] = event->xclient.data.l[2];
XSendEvent(dpy, replyev.xclient.window, 0, NoEventMask, &replyev);
XSync(dpy, 0);
}
} else if (wXDEProcessClientMessage(&event->xclient)) {
/* do nothing */
#endif /* XDE_DND */
#ifdef OFFIX_DND
} else if (event->xclient.message_type==_XA_DND_PROTOCOL) {
@@ -1090,7 +1020,7 @@ handleEnterNotify(XEvent *event)
WMDeleteTimerHandler(scr->autoRaiseTimer);
scr->autoRaiseTimer = NULL;
if (wPreferences.raise_delay && !wwin->window_flags.no_focusable) {
if (wPreferences.raise_delay && !WFLAGP(wwin, no_focusable)) {
scr->autoRaiseWindow = wwin->frame->core->window;
scr->autoRaiseTimer
= WMAddTimerHandler(wPreferences.raise_delay,
@@ -1321,7 +1251,14 @@ handleKeyPress(XEvent *event)
}
if (command < 0) {
#ifdef LITE
{
#if 0
}
#endif
#else
if (!wRootMenuPerformShortcut(event)) {
#endif
static int dontLoop = 0;
if (dontLoop > 10) {
@@ -1346,27 +1283,29 @@ handleKeyPress(XEvent *event)
#define ISFOCUSED(w) ((w) && (w)->flags.focused)
switch (command) {
#ifndef LITE
case WKBD_ROOTMENU:
OpenRootMenu(scr, event->xkey.x_root, event->xkey.y_root, True);
break;
case WKBD_WINDOWLIST:
OpenSwitchMenu(scr, event->xkey.x_root, event->xkey.y_root, True);
break;
#endif /* !LITE */
case WKBD_WINDOWMENU:
if (ISMAPPED(wwin) && ISFOCUSED(wwin))
OpenWindowMenu(wwin, wwin->frame_x,
wwin->frame_y+wwin->frame->top_width, True);
break;
case WKBD_WINDOWLIST:
OpenSwitchMenu(scr, event->xkey.x_root, event->xkey.y_root, True);
break;
case WKBD_MINIATURIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !WFLAGP(wwin, no_miniaturizable)) {
CloseWindowMenu(scr);
if (wwin->protocols.MINIATURIZE_WINDOW)
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
event->xbutton.time);
else {
if (!wwin->window_flags.no_miniaturizable)
wIconifyWindow(wwin);
wIconifyWindow(wwin);
}
}
break;
@@ -1375,14 +1314,13 @@ handleKeyPress(XEvent *event)
WApplication *wapp = wApplicationOf(wwin->main_window);
CloseWindowMenu(scr);
if (wapp && !wapp->main_window_desc->window_flags.no_appicon) {
if (wapp && !WFLAGP(wapp->main_window_desc, no_appicon)) {
wHideApplication(wapp);
}
}
break;
case WKBD_MAXIMIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !wwin->window_flags.no_resizable) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_resizable)) {
CloseWindowMenu(scr);
if (wwin->flags.maximized) {
@@ -1393,8 +1331,7 @@ handleKeyPress(XEvent *event)
}
break;
case WKBD_VMAXIMIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !wwin->window_flags.no_resizable) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_resizable)) {
CloseWindowMenu(scr);
if (wwin->flags.maximized) {
@@ -1427,17 +1364,22 @@ handleKeyPress(XEvent *event)
wRaiseLowerFrame(wwin->frame->core);
break;
case WKBD_SHADE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !wwin->window_flags.no_shadeable) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_shadeable)) {
if (wwin->flags.shaded)
wUnshadeWindow(wwin);
else
wShadeWindow(wwin);
}
break;
case WKBD_MOVERESIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
CloseWindowMenu(scr);
wKeyboardMoveResizeWindow(wwin);
}
break;
case WKBD_CLOSE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !wwin->window_flags.no_closable) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_closable)) {
CloseWindowMenu(scr);
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW,
@@ -1490,26 +1432,23 @@ handleKeyPress(XEvent *event)
GOTOWORKS(10);
#undef GOTOWORKS
case WKBD_NEXTWORKSPACE:
if (scr->current_workspace < scr->workspace_count-1)
wWorkspaceChange(scr, scr->current_workspace+1);
else if (scr->current_workspace == scr->workspace_count-1) {
if (wPreferences.ws_advance &&
scr->current_workspace < MAX_WORKSPACES-1)
wWorkspaceChange(scr, scr->current_workspace+1);
else if (wPreferences.ws_cycle)
wWorkspaceChange(scr, 0);
}
wWorkspaceRelativeChange(scr, 1);
break;
case WKBD_PREVWORKSPACE:
if (scr->current_workspace > 0)
wWorkspaceChange(scr, scr->current_workspace-1);
else if (scr->current_workspace==0 && wPreferences.ws_cycle)
wWorkspaceChange(scr, scr->workspace_count-1);
wWorkspaceRelativeChange(scr, -1);
break;
case WKBD_WINDOW1:
case WKBD_WINDOW2:
case WKBD_WINDOW3:
case WKBD_WINDOW4:
#ifdef EXTEND_WINDOWSHORTCUT
case WKBD_WINDOW5:
case WKBD_WINDOW6:
case WKBD_WINDOW7:
case WKBD_WINDOW8:
case WKBD_WINDOW9:
case WKBD_WINDOW10:
#endif
if (scr->shortcutWindow[command-WKBD_WINDOW1]) {
wMakeWindowVisible(scr->shortcutWindow[command-WKBD_WINDOW1]);
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
+21 -55
View File
@@ -70,7 +70,6 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
memset(fwin, 0, sizeof(WFrameWindow));
fwin->screen_ptr = scr;
fwin->window_level = wlevel;
fwin->flags.single_texture = (flags & WFF_SINGLE_STATE) ? 1 : 0;
@@ -287,7 +286,7 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
if (height + fwin->top_width + fwin->bottom_width != fwin->core->height) {
wFrameWindowResize(fwin, width,
height + fwin->top_width + fwin->bottom_width);
height + fwin->top_width + fwin->bottom_width);
}
/* setup object descriptors */
@@ -475,53 +474,13 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
{
RImage *img;
RImage *limg, *rimg, *mimg;
RColor color1, color2;
int i, x, w;
int x, w;
*title = None;
*lbutton = None;
*rbutton = None;
switch (texture->any.type) {
case WTEX_DGRADIENT:
case WTEX_VGRADIENT:
case WTEX_HGRADIENT:
case WTEX_MHGRADIENT:
case WTEX_MVGRADIENT:
case WTEX_MDGRADIENT:
if (texture->any.type==WTEX_DGRADIENT
|| texture->any.type==WTEX_MDGRADIENT)
i = RGRD_DIAGONAL;
else if (texture->any.type==WTEX_HGRADIENT
|| texture->any.type==WTEX_MHGRADIENT)
i = RGRD_HORIZONTAL;
else
i = RGRD_VERTICAL;
if (texture->any.type==WTEX_MHGRADIENT
|| texture->any.type==WTEX_MDGRADIENT
|| texture->any.type==WTEX_MVGRADIENT)
img = RRenderMultiGradient(width, height,
&(texture->mgradient.colors[1]), i);
else {
color1.red = texture->gradient.color1.red >> 8;
color1.green = texture->gradient.color1.green >> 8;
color1.blue = texture->gradient.color1.blue >> 8;
color2.red = texture->gradient.color2.red >> 8;
color2.green = texture->gradient.color2.green >> 8;
color2.blue = texture->gradient.color2.blue >> 8;
img = RRenderGradient(width, height, &color1, &color2, i);
}
break;
case WTEX_PIXMAP:
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
break;
default:
img = NULL;
}
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
if (!img) {
wwarning(_("could not render gradient: %s"), RMessageForError(RErrorCode));
return;
@@ -722,8 +681,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
WREL_RAISED);
}
if (fwin->resizebar
&& !fwin->flags.repaint_only_titlebar) {
if (fwin->resizebar && !fwin->flags.repaint_only_titlebar) {
Window win;
int w, h;
int cw;
@@ -756,8 +714,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
}
if (fwin->title && fwin->titlebar
&& !fwin->flags.repaint_only_resizebar) {
if (fwin->title && fwin->titlebar && !fwin->flags.repaint_only_resizebar) {
int x, w;
int lofs = 6, rofs = 6;
int titlelen;
@@ -813,13 +770,18 @@ wFrameWindowPaint(WFrameWindow *fwin)
}
void
wFrameWindowResize(WFrameWindow *fwin, int width, int height)
static void
reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
Bool dontMove)
{
int k = (wPreferences.new_style ? 4 : 3);
int resizedHorizontally = 0;
XResizeWindow(dpy, fwin->core->window, width, height);
if (dontMove)
XResizeWindow(dpy, fwin->core->window, width, height);
else
XMoveResizeWindow(dpy, fwin->core->window, x, y, width, height);
/*
if (fwin->core->height != height && fwin->resizebar)
XMoveWindow(dpy, fwin->resizebar->window, 0,
@@ -895,12 +857,16 @@ wFrameWindowResize(WFrameWindow *fwin, int width, int height)
}
}
void
wFrameWindowConfigure(WFrameWindow *fwin, int x, int y, int width, int height)
{
reconfigure(fwin, x, y, width, height, False);
}
void
wFrameWindowResizeInternal(WFrameWindow *fwin, int iwidth, int iheight)
wFrameWindowResize(WFrameWindow *fwin, int width, int height)
{
wFrameWindowResize(fwin, iwidth,
iheight + fwin->top_width + fwin->bottom_width);
reconfigure(fwin, 0, 0, width, height, True);
}
+7 -7
View File
@@ -39,8 +39,6 @@
typedef struct WFrameWindow {
WScreen *screen_ptr; /* pointer to the screen structure */
short window_level;
short workspace; /* workspace that the window occupies */
WCoreWindow *core;
@@ -48,9 +46,13 @@ typedef struct WFrameWindow {
WCoreWindow *left_button; /* miniaturize button */
WCoreWindow *right_button; /* close button */
short workspace; /* workspace that the window occupies */
short top_width;
short bottom_width;
short resizebar_corner_width;
WCoreWindow *resizebar; /* bottom resizebar */
Pixmap title_back[3]; /* focused, unfocused, pfocused */
@@ -66,8 +68,6 @@ typedef struct WFrameWindow {
GC *title_gc;
WFont **font;
short resizebar_corner_width;
char *title; /* window name (title) */
/* thing that uses this frame. passed as data to callbacks */
@@ -127,9 +127,9 @@ void wFrameWindowChangeState(WFrameWindow *fwin, int state);
void wFrameWindowPaint(WFrameWindow *fwin);
void wFrameWindowResize(WFrameWindow *fwin, int width, int height);
void wFrameWindowConfigure(WFrameWindow *fwin, int x, int y, int width, int height);
void wFrameWindowResizeInternal(WFrameWindow *fwin, int iwidth, int iheight);
void wFrameWindowResize(WFrameWindow *fwin, int width, int height);
void wFrameWindowShowButton(WFrameWindow *fwin, int flags);
+22 -2
View File
@@ -31,6 +31,8 @@ typedef void (WCallBack)(void *cdata);
typedef void (WDeathHandler)(pid_t pid, unsigned int status, void *cdata);
void Shutdown(WShutdownMode mode);
void RestoreDesktop(WScreen *scr);
void Exit(int status);
@@ -41,7 +43,7 @@ void SetupEnvironment(WScreen *scr);
void DispatchEvent(XEvent *event);
void WipeDesktop(WScreen *scr);
#ifndef LITE
Bool wRootMenuPerformShortcut(XEvent *event);
@@ -51,16 +53,30 @@ void OpenRootMenu(WScreen *scr, int x, int y, int keyboard);
void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
#endif /* !LITE */
void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard);
void OpenMiniwindowMenu(WWindow *wwin, int x, int y);
void OpenWorkspaceMenu(WScreen *scr, int x, int y);
void CloseWindowMenu(WScreen *scr);
#ifdef LITE
#define UpdateSwitchMenu(a, b, c)
#define UpdateSwitchMenuWorkspace(a, b)
#else /*! LITE */
void UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action);
void UpdateSwitchMenuWorkspace(WScreen *scr, int workspace);
#endif /* !LITE */
WMagicNumber wAddDeathHandler(pid_t pid, WDeathHandler *callback, void *cdata);
void wColormapInstallForWindow(WScreen *scr, WWindow *wwin);
@@ -84,6 +100,8 @@ char *MakeCPPArgs(char *path);
char *ExpandOptions(WScreen *scr, char *cmdline);
void ExecuteShellCommand(WScreen *scr, char *command);
Bool IsDoubleClick(WScreen *scr, XEvent *event);
WWindow *NextFocusWindow(WScreen *scr);
@@ -93,7 +111,7 @@ void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
char *ShrinkString(WFont *font, char *string, int width);
char *FindImage(char **paths, char *file);
char *FindImage(char *paths, char *file);
RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
@@ -106,6 +124,8 @@ char *FlattenStringList(char **list, int count);
void ParseWindowName(proplist_t value, char **winstance, char **wclass,
char *where);
void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
char *GetShortcutString(char *text);
char *EscapeWM_CLASS(char *name, char *class);
+558
View File
@@ -0,0 +1,558 @@
/* gnome.c-- support for the GNOME Hints
*
* Window Maker window manager
*
* Copyright (c) 1998, 1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
/*
* According to the author of this thing, it should not be taken seriously.
* IMHO, there are lot's of weirdnesses and it's quite unelegant. I'd
* rather not support it, but here it goes anyway.
*/
#include "wconfig.h"
#ifdef GNOME_STUFF
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "WindowMaker.h"
#include "screen.h"
#include "wcore.h"
#include "framewin.h"
#include "window.h"
#include "workspace.h"
#include "funcs.h"
#include "actions.h"
#include "stacking.h"
#include "gnome.h"
#define WIN_HINTS_SKIP_FOCUS (1<<0) /*"alt-tab" skips this win*/
#define WIN_HINTS_SKIP_WINLIST (1<<1) /*do not show in window list*/
#define WIN_HINTS_SKIP_TASKBAR (1<<2) /*do not show on taskbar*/
#define WIN_HINTS_GROUP_TRANSIENT (1<<3) /*Reserved - definition is unclear*/
#define WIN_HINTS_FOCUS_ON_CLICK (1<<4) /*app only accepts focus if clicked*/
#define WIN_STATE_STICKY (1<<0) /*everyone knows sticky*/
#define WIN_STATE_MINIMIZED (1<<1) /*Reserved - definition is unclear*/
#define WIN_STATE_MAXIMIZED_VERT (1<<2) /*window in maximized V state*/
#define WIN_STATE_MAXIMIZED_HORIZ (1<<3) /*window in maximized H state*/
#define WIN_STATE_HIDDEN (1<<4) /*not on taskbar but window visible*/
#define WIN_STATE_SHADED (1<<5) /*shaded (MacOS / Afterstep style)*/
/* these are bogus states defined in "the spec" */
#define WIN_STATE_HID_WORKSPACE (1<<6) /*not on current desktop*/
#define WIN_STATE_HID_TRANSIENT (1<<7) /*owner of transient is hidden*/
#define WIN_STATE_FIXED_POSITION (1<<8) /*window is fixed in position even*/
#define WIN_STATE_ARRANGE_IGNORE (1<<9) /*ignore for auto arranging*/
#define WIN_LAYER_DESKTOP 0
#define WIN_LAYER_BELOW 2
#define WIN_LAYER_NORMAL 4
#define WIN_LAYER_ONTOP 6
#define WIN_LAYER_DOCK 8
#define WIN_LAYER_ABOVE_DOCK 10
#define WIN_LAYER_MENU 12
static Atom _XA_WIN_SUPPORTING_WM_CHECK = 0;
static Atom _XA_WIN_PROTOCOLS;
static Atom _XA_WIN_LAYER;
static Atom _XA_WIN_STATE;
static Atom _XA_WIN_HINTS;
static Atom _XA_WIN_APP_STATE;
static Atom _XA_WIN_EXPANDED_SIZE;
static Atom _XA_WIN_ICONS;
static Atom _XA_WIN_WORKSPACE;
static Atom _XA_WIN_WORKSPACE_COUNT;
static Atom _XA_WIN_WORKSPACE_NAMES;
static Atom _XA_WIN_CLIENT_LIST;
void
wGNOMEInitStuff(WScreen *scr)
{
Atom supportedStuff[10];
int count;
if (!_XA_WIN_SUPPORTING_WM_CHECK) {
_XA_WIN_SUPPORTING_WM_CHECK =
XInternAtom(dpy, "_WIN_SUPPORTING_WM_CHECK", False);
_XA_WIN_PROTOCOLS = XInternAtom(dpy, "_WIN_PROTOCOLS", False);
_XA_WIN_LAYER = XInternAtom(dpy, "_WIN_LAYER", False);
_XA_WIN_STATE = XInternAtom(dpy, "_WIN_STATE", False);
_XA_WIN_HINTS = XInternAtom(dpy, "_WIN_HINTS", False);
_XA_WIN_APP_STATE = XInternAtom(dpy, "_WIN_APP_STATE", False);
_XA_WIN_EXPANDED_SIZE = XInternAtom(dpy, "_WIN_EXPANDED_SIZE", False);
_XA_WIN_ICONS = XInternAtom(dpy, "_WIN_ICONS", False);
_XA_WIN_WORKSPACE = XInternAtom(dpy, "_WIN_WORKSPACE", False);
_XA_WIN_WORKSPACE_COUNT =
XInternAtom(dpy, "_WIN_WORKSPACE_COUNT", False);
_XA_WIN_WORKSPACE_NAMES =
XInternAtom(dpy, "_WIN_WORKSPACE_NAMES", False);
_XA_WIN_CLIENT_LIST = XInternAtom(dpy, "_WIN_CLIENT_LIST", False);
}
/* I'd rather use the ICCCM 2.0 mechanisms, but
* since some people prefer to reinvent the wheel instead of
* conforming to standards... */
/* setup the "We're compliant, you idiot!" hint */
/* why XA_CARDINAL instead of XA_WINDOW? Only God knows.... */
XChangeProperty(dpy, scr->root_win, _XA_WIN_SUPPORTING_WM_CHECK,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char*)&scr->no_focus_win, 1);
XChangeProperty(dpy, scr->no_focus_win, _XA_WIN_SUPPORTING_WM_CHECK,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char*)&scr->no_focus_win, 1);
/* setup the list of supported protocols */
count = 0;
supportedStuff[count++] = _XA_WIN_LAYER;
supportedStuff[count++] = _XA_WIN_STATE;
supportedStuff[count++] = _XA_WIN_HINTS;
supportedStuff[count++] = _XA_WIN_APP_STATE;
supportedStuff[count++] = _XA_WIN_EXPANDED_SIZE;
supportedStuff[count++] = _XA_WIN_ICONS;
supportedStuff[count++] = _XA_WIN_WORKSPACE;
supportedStuff[count++] = _XA_WIN_WORKSPACE_COUNT;
supportedStuff[count++] = _XA_WIN_WORKSPACE_NAMES;
supportedStuff[count++] = _XA_WIN_CLIENT_LIST;
XChangeProperty(dpy, scr->root_win, _XA_WIN_PROTOCOLS, XA_ATOM, 32,
PropModeReplace, (unsigned char*)supportedStuff, count);
XFlush(dpy);
}
void
wGNOMEUpdateClientListHint(WScreen *scr)
{
WWindow *wwin;
Window *windows;
int count;
windows = malloc(sizeof(Window)*scr->window_count);
if (!windows) {
wwarning(_("out of memory while updating GNOME hints"));
return;
}
count = 0;
wwin = scr->focused_window;
while (wwin) {
if (!wwin->flags.internal_window) {
windows[count++] = wwin->client_win;
}
wwin = wwin->prev;
}
XChangeProperty(dpy, scr->root_win, _XA_WIN_CLIENT_LIST, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)windows, count);
free(windows);
XFlush(dpy);
}
void
wGNOMEUpdateWorkspaceHints(WScreen *scr)
{
long val;
val = scr->workspace_count;
XChangeProperty(dpy, scr->root_win, _XA_WIN_WORKSPACE_COUNT, XA_CARDINAL,
32, PropModeReplace, (unsigned char*)&val, 1);
wGNOMEUpdateWorkspaceNamesHint(scr);
}
void
wGNOMEUpdateWorkspaceNamesHint(WScreen *scr)
{
char *wsNames[MAX_WORKSPACES];
XTextProperty textProp;
int i;
for (i = 0; i < scr->workspace_count; i++) {
wsNames[i] = scr->workspaces[i]->name;
}
if (XStringListToTextProperty(wsNames, scr->workspace_count, &textProp)) {
XSetTextProperty(dpy, scr->root_win, &textProp,
_XA_WIN_WORKSPACE_NAMES);
XFree(textProp.value);
}
}
void
wGNOMEUpdateCurrentWorkspaceHint(WScreen *scr)
{
long val;
val = scr->current_workspace;
XChangeProperty(dpy, scr->root_win, _XA_WIN_WORKSPACE, XA_CARDINAL,
32, PropModeReplace, (unsigned char*)&val, 1);
}
static int
getWindowLevel(int layer)
{
int level;
if (layer <= WIN_LAYER_DESKTOP)
level = WMDesktopLevel;
else if (layer <= WIN_LAYER_BELOW)
level = WMSunkenLevel;
else if (layer <= WIN_LAYER_NORMAL)
level = WMNormalLevel;
else if (layer <= WIN_LAYER_ONTOP)
level = WMFloatingLevel;
else if (layer <= WIN_LAYER_DOCK)
level = WMDockLevel;
else if (layer <= WIN_LAYER_ABOVE_DOCK)
level = WMSubmenuLevel;
else if (layer <= WIN_LAYER_MENU)
level = WMMainMenuLevel;
else
level = WMOuterSpaceLevel;
return level;
}
void
wGNOMECheckClientHints(WWindow *wwin, int *layer, int *workspace)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
long flags, val, *data = 0;
/* hints */
if (XGetWindowProperty(dpy, wwin->client_win, _XA_WIN_HINTS, 0, 1, False,
/* should be XA_INTEGER, but spec is broken */
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret,
(unsigned char**)&data)==Success && data) {
flags = *data;
XFree(data);
if (flags & (WIN_HINTS_SKIP_FOCUS|WIN_HINTS_SKIP_WINLIST)) {
wwin->client_flags.skip_window_list = 1;
}
}
/* layer */
if (XGetWindowProperty(dpy, wwin->client_win, _XA_WIN_LAYER, 0, 1, False,
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret,
(unsigned char**)&data)==Success && data) {
val = *data;
XFree(data);
*layer = getWindowLevel(val);
}
/* workspace */
if (XGetWindowProperty(dpy, wwin->client_win, _XA_WIN_WORKSPACE, 0, 1,
False, XA_CARDINAL, &type_ret, &fmt_ret,
&nitems_ret, &bytes_after_ret,
(unsigned char**)&data)==Success && data) {
val = *data;
XFree(data);
*workspace = val;
}
/* reserved area */
if (XGetWindowProperty(dpy, wwin->client_win, _XA_WIN_EXPANDED_SIZE, 0, 1,
False, XA_CARDINAL, &type_ret, &fmt_ret,
&nitems_ret, &bytes_after_ret,
(unsigned char**)&data)==Success && data) {
WReservedArea *area;
area = malloc(sizeof(WReservedArea));
if (!area) {
wwarning(_("out of memory while updating GNOME hints"));
} else {
area->area.x1 = data[0];
area->area.y1 = data[1];
area->area.x2 = data[2] - data[0];
area->area.y2 = data[3] - data[1];
XFree(data);
area->window = wwin->client_win;
}
area->next = wwin->screen_ptr->reservedAreas;
wwin->screen_ptr->reservedAreas = area;
wScreenUpdateUsableArea(wwin->screen_ptr);
}
}
void
wGNOMECheckInitialClientState(WWindow *wwin)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
long flags, *data = 0;
if (XGetWindowProperty(dpy, wwin->client_win, _XA_WIN_STATE, 0, 1, False,
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret,
(unsigned char**)&data)!=Success || !data)
return;
flags = *data;
XFree(data);
if (flags & WIN_STATE_STICKY)
wwin->client_flags.omnipresent = 1;
if (flags & (WIN_STATE_MAXIMIZED_VERT|WIN_STATE_MAXIMIZED_HORIZ)) {
if (flags & WIN_STATE_MAXIMIZED_VERT)
wwin->flags.maximized |= MAX_VERTICAL;
if (flags & WIN_STATE_MAXIMIZED_HORIZ)
wwin->flags.maximized |= MAX_HORIZONTAL;
}
if (flags & WIN_STATE_SHADED)
wwin->flags.shaded = 1;
}
void
wGNOMEUpdateClientStateHint(WWindow *wwin, Bool changedWorkspace)
{
long val;
long flags = 0;
if (changedWorkspace) {
val = wwin->frame->workspace;
XChangeProperty(dpy, wwin->client_win, _XA_WIN_WORKSPACE, XA_CARDINAL,
32, PropModeReplace, (unsigned char*)&val, 1);
if (val != wwin->screen_ptr->current_workspace)
flags |= WIN_STATE_HID_WORKSPACE;
}
if (IS_OMNIPRESENT(wwin))
flags |= WIN_STATE_STICKY;
if (wwin->flags.miniaturized)
flags |= WIN_STATE_MINIMIZED;
if (wwin->flags.maximized & MAX_VERTICAL)
flags |= WIN_STATE_MAXIMIZED_VERT;
if (wwin->flags.maximized & MAX_HORIZONTAL)
flags |= WIN_STATE_MAXIMIZED_HORIZ;
if (wwin->flags.shaded)
flags |= WIN_STATE_SHADED;
if (wwin->transient_for != None) {
WWindow *owner = wWindowFor(wwin->transient_for);
if (owner && !owner->flags.mapped)
flags |= WIN_STATE_HID_TRANSIENT;
}
/* ? */
if (wwin->flags.hidden)
flags |= WIN_STATE_HIDDEN;
XChangeProperty(dpy, wwin->client_win, _XA_WIN_STATE, XA_CARDINAL,
32, PropModeReplace, (unsigned char*)&flags, 1);
}
Bool
wGNOMEProcessClientMessage(XClientMessageEvent *event)
{
WWindow *wwin;
Bool done = True;
wwin = wWindowFor(event->window);
if (!wwin)
return False;
if (event->message_type == _XA_WIN_LAYER) {
int level = getWindowLevel(event->data.l[0]);
if (WINDOW_LEVEL(wwin) != level) {
ChangeStackingLevel(wwin->frame->core, level);
}
} else if (event->message_type == _XA_WIN_STATE) {
int flags, mask;
Bool updateWindowList = False;
int maximize = 0;
mask = event->data.l[0];
flags = event->data.l[1];
if (mask & WIN_STATE_STICKY) {
if ((flags & WIN_STATE_STICKY) != WFLAGP(wwin, omnipresent)) {
wwin->client_flags.omnipresent = 1;
updateWindowList = True;
}
}
if (mask & WIN_STATE_MAXIMIZED_VERT) {
if (flags & WIN_STATE_MAXIMIZED_VERT)
maximize = MAX_VERTICAL;
else
maximize = 0;
} else {
maximize = wwin->flags.maximized & MAX_VERTICAL;
}
if (mask & WIN_STATE_MAXIMIZED_HORIZ) {
if (flags & WIN_STATE_MAXIMIZED_HORIZ)
maximize |= MAX_HORIZONTAL;
else
maximize |= 0;
} else {
maximize |= wwin->flags.maximized & MAX_HORIZONTAL;
}
if (maximize != wwin->flags.maximized) {
#define both (MAX_HORIZONTAL|MAX_VERTICAL)
if (!(maximize & both) && (wwin->flags.maximized & both)) {
wUnmaximizeWindow(wwin);
}
if ((maximize & both) && !(wwin->flags.maximized & both)) {
wMaximizeWindow(wwin, maximize);
}
updateWindowList = False;
#undef both
}
if (mask & WIN_STATE_SHADED) {
if ((flags & WIN_STATE_SHADED) != wwin->flags.shaded) {
if (wwin->flags.shaded)
wUnshadeWindow(wwin);
else
wShadeWindow(wwin);
updateWindowList = False;
}
}
if (updateWindowList) {
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
}
} else if (event->message_type == _XA_WIN_WORKSPACE) {
if (event->data.l[0] != wwin->frame->workspace) {
wWindowChangeWorkspace(wwin, event->data.l[0]);
}
} else {
done = False;
}
return done;
}
void
wGNOMERemoveClient(WWindow *wwin)
{
int flag = 0;
WReservedArea *area;
wGNOMEUpdateClientListHint(wwin->screen_ptr);
area = wwin->screen_ptr->reservedAreas;
if (area) {
if (area->window == wwin->client_win) {
wwin->screen_ptr->reservedAreas = area->next;
free(area);
flag = 1;
} else {
while (area->next && area->next->window != wwin->client_win)
area = area->next;
if (area->next) {
WReservedArea *next;
next = area->next->next;
free(area->next);
area->next = next;
flag = 1;
}
}
}
if (flag) {
wScreenUpdateUsableArea(wwin->screen_ptr);
}
}
#endif /* GNOME_STUFF */
+49
View File
@@ -0,0 +1,49 @@
/* gnome.h-- stuff for support for gnome hints
*
* Window Maker window manager
*
* Copyright (c) 1998, 1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef _GNOME_H_
#define _GNOME_H_
void wGNOMEInitStuff(WScreen *scr);
void wGNOMEUpdateClientListHint(WScreen *scr);
void wGNOMEUpdateWorkspaceHints(WScreen *scr);
void wGNOMEUpdateCurrentWorkspaceHint(WScreen *scr);
void wGNOMEUpdateWorkspaceNamesHint(WScreen *scr);
void wGNOMECheckClientHints(WWindow *wwin, int *layer, int *workspace);
void wGNOMEUpdateClientStateHint(WWindow *wwin, Bool changedWorkspace);
Bool wGNOMEProcessClientMessage(XClientMessageEvent *event);
void wGNOMERemoveClient(WWindow *wwin);
void wGNOMECheckInitialClientState(WWindow *wwin);
#endif
+18 -4
View File
@@ -564,7 +564,7 @@ wIconUpdate(WIcon *icon)
icon->pixmap = None;
if (wwin && wwin->window_flags.always_user_icon)
if (wwin && WFLAGP(wwin, always_user_icon))
goto user_icon;
/* use client specified icon window */
@@ -754,9 +754,9 @@ wIconPaint(WIcon *icon)
wIconUpdate(icon);
return;
}
XClearWindow(dpy, icon->core->window);
/* draw the icon title */
if (icon->show_title && icon->icon_name!=NULL) {
int l;
@@ -831,8 +831,22 @@ miniwindowMouseDown(WObjDescriptor *desc, XEvent *event)
wIconSelect(icon);
wSelectWindow(icon->owner, !wwin->flags.selected);
}
}
}
#if 0
else if (event->xbutton.button==Button3) {
WObjDescriptor *desc;
OpenMiniwindowMenu(wwin, event->xbutton.x_root,
event->xbutton.y_root);
/* allow drag select of menu */
desc = &wwin->screen_ptr->window_menu->menu->descriptor;
event->xbutton.send_event = True;
(*desc->handle_mousedown)(desc, event);
return;
}
#endif
if (XGrabPointer(dpy, icon->core->window, False, ButtonMotionMask
|ButtonReleaseMask|ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, None, CurrentTime) !=GrabSuccess) {
+29 -14
View File
@@ -19,6 +19,8 @@
* USA.
*/
/* anywhere */
#define WKBD_ROOTMENU 0
#define WKBD_WINDOWMENU 1
@@ -33,17 +35,17 @@
#define WKBD_CLIPLOWER 8
#define WKBD_CLIPRAISE 9
#define WKBD_CLIPRAISELOWER 10
/* window, menu */
/* window */
#define WKBD_RAISE 11
#define WKBD_LOWER 12
#define WKBD_RAISELOWER 13
/* window */
#define WKBD_SHADE 14
#define WKBD_MOVERESIZE 14
#define WKBD_SHADE 15
/* window, menu */
#define WKBD_CLOSE 15
#define WKBD_CLOSE 16
/* window */
#define WKBD_FOCUSNEXT 16
#define WKBD_FOCUSPREV 17
#define WKBD_FOCUSNEXT 17
#define WKBD_FOCUSPREV 18
#define WKBD_WORKSPACE1 20
#define WKBD_WORKSPACE2 21
@@ -65,14 +67,27 @@
#define WKBD_WINDOW2 35
#define WKBD_WINDOW3 36
#define WKBD_WINDOW4 37
#ifdef KEEP_XKB_LOCK_STATUS
# define WKBD_TOGGLE 38
# define WKBD_LAST 39
#else
# define WKBD_LAST 38
#endif /* KEEP_XKB_LOCK_STATUS */
#ifdef EXTEND_WINDOWSHORTCUT
# define WKBD_WINDOW5 38
# define WKBD_WINDOW6 39
# define WKBD_WINDOW7 40
# define WKBD_WINDOW8 41
# define WKBD_WINDOW9 42
# define WKBD_WINDOW10 43
# ifdef KEEP_XKB_LOCK_STATUS
# define WKBD_TOGGLE 44
# define WKBD_LAST 45
# else
# define WKBD_LAST 44
# endif /* KEEP_XKB_LOCK_STATUS */
#else /* !EXTEND_WINDOWSHORTCUT */
# ifdef KEEP_XKB_LOCK_STATUS
# define WKBD_TOGGLE 38
# define WKBD_LAST 39
# else
# define WKBD_LAST 38
# endif /* KEEP_XKB_LOCK_STATUS */
#endif /* !EXTEND_WINDOWSHORTCUT */
typedef struct WShortKey {
+1519
View File
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
/* kde.h-- stuff for support for kde hints
*
* Window Maker window manager
*
* Copyright (c) 1998, 1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef _KWM_H_
#define _KWM_H_
typedef enum {
KWMStickyFlag = (1<<0),
KWMMaximizedFlag = (1<<1),
KWMIconifiedFlag = (1<<2),
KWMAllFlags = 7
} WKWMStateFlag;
typedef enum {
WKWMAddWindow,
WKWMRemoveWindow,
WKWMFocusWindow,
WKWMRaiseWindow,
WKWMLowerWindow,
WKWMChangedClient,
WKWMIconChange
} WKWMEventMessage;
void wKWMInitStuff(WScreen *scr);
Bool wKWMGetUsableArea(WScreen *scr, WArea *area);
void wKWMCheckClientHints(WWindow *wwin, long *workspace);
Bool wKWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
Bool wKWMCheckRootHintChange(WScreen *scr, XPropertyEvent *event);
void wKWMUpdateWorkspaceCountHint(WScreen *scr);
void wKWMUpdateWorkspaceNameHint(WScreen *scr, int workspace);
void wKWMUpdateCurrentWorkspaceHint(WScreen *scr);
Bool wKWMProcessClientMessage(XClientMessageEvent *event);
void wKWMUpdateClientGeometryRestore(WWindow *wwin);
void wKWMUpdateClientWorkspace(WWindow *wwin);
void wKWMUpdateClientState(WWindow *wwin, WKWMStateFlag flags);
Bool wKWMManageableClient(WScreen *scr, Window win, char *title);
void wKWMCheckClientInitialState(WWindow *wwin);
void wKWMSetUsableAreaHint(WScreen *scr, int workspace);
void wKWMSetInitializedHint(WScreen *scr);
void wKWMShutdown(WScreen *scr);
void wKWMCheckModule(WScreen *scr, Window window);
void wKWMSendWindowCreateMessage(WWindow *wwin, Bool create);
void wKWMSendEventMessage(WWindow *wwin, WKWMEventMessage message);
void wKWMCheckDestroy(XDestroyWindowEvent *event);
void wKWMUpdateActiveWindowHint(WScreen *scr);
void wKWMSendStacking(WScreen *scr, Window module);
char *wKWMGetWorkspaceName(WScreen *scr, int workspace);
#endif
+5 -9
View File
@@ -101,11 +101,6 @@ Atom _XA_GNUSTEP_WM_ATTR;
Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
Atom _XA_GNUSTEP_WM_RESIZEBAR;
#ifdef MWM_HINTS
/* MWM support */
Atom _XA_MOTIF_WM_HINTS;
#endif
Atom _XA_WINDOWMAKER_MENU;
Atom _XA_WINDOWMAKER_WM_PROTOCOLS;
Atom _XA_WINDOWMAKER_STATE;
@@ -298,8 +293,6 @@ execInitScript()
file = wfindfile(DEF_CONFIG_PATHS, DEF_INIT_SCRIPT);
if (file) {
if (fork()==0) {
CloseDescriptors();
execl("/bin/sh", "/bin/sh", "-c", file, NULL);
wsyserror(_("%s:could not execute initialization script"), file);
exit(1);
@@ -317,8 +310,6 @@ ExecExitScript()
file = wfindfile(DEF_CONFIG_PATHS, DEF_EXIT_SCRIPT);
if (file) {
if (fork()==0) {
CloseDescriptors();
execl("/bin/sh", "/bin/sh", "-c", file, NULL);
wsyserror(_("%s:could not execute exit script"), file);
exit(1);
@@ -474,6 +465,11 @@ main(int argc, char **argv)
exit(1);
}
if (fcntl(ConnectionNumber(dpy), F_SETFD, FD_CLOEXEC) < 0) {
wsyserror("error setting close-on-exec flag for X connection");
exit(1);
}
/* check if the user specified a complete display name (with screen).
* If so, only manage the specified screen */
if (DisplayName)
+47 -37
View File
@@ -214,9 +214,9 @@ insertEntry(WMenu *menu, WMenuEntry *entry, int index)
{
int i;
for (i=menu->entry_no; i>index; i--) {
for (i = menu->entry_no-1; i >= index; i--) {
menu->entries[i]->order++;
menu->entries[i+1]=menu->entries[i];
menu->entries[i+1] = menu->entries[i];
}
menu->entries[index] = entry;
}
@@ -496,24 +496,19 @@ wMenuRealize(WMenu *menu)
wCoreConfigure(menu->menu, 0, theight, mwidth, menu->entry_no*eheight -1);
wFrameWindowResizeInternal(menu->frame, mwidth, menu->entry_no*eheight -1);
wFrameWindowResize(menu->frame, mwidth, menu->entry_no*eheight-1
+ menu->frame->top_width + menu->frame->bottom_width);
/* setup background texture */
switch (scr->menu_item_texture->any.type) {
case WTEX_DGRADIENT:
case WTEX_VGRADIENT:
case WTEX_HGRADIENT:
case WTEX_MHGRADIENT:
case WTEX_MVGRADIENT:
case WTEX_MDGRADIENT:
case WTEX_PIXMAP:
if (scr->menu_item_texture->any.type != WTEX_SOLID) {
if (!menu->flags.brother) {
FREE_PIXMAP(menu->menu_texture_data);
wTextureRender(scr, scr->menu_item_texture,
&menu->menu_texture_data, menu->menu->width,
menu->entry_height, WREL_MENUENTRY);
XSetWindowBackgroundPixmap(dpy, menu->menu->window,
menu->menu_texture_data);
XClearWindow(dpy, menu->menu->window);
@@ -522,9 +517,7 @@ wMenuRealize(WMenu *menu)
menu->menu_texture_data);
XClearWindow(dpy, menu->brother->menu->window);
}
break;
default:
} else {
XSetWindowBackground(dpy, menu->menu->window,
scr->menu_item_texture->any.color.pixel);
XClearWindow(dpy, menu->menu->window);
@@ -782,7 +775,7 @@ makeVisible(WMenu *menu)
new_x = scr->scr_width - MENUW(menu) - 1;
move = 1;
}
if (y1 < 0) {
new_y = 0;
move = 1;
@@ -790,11 +783,10 @@ makeVisible(WMenu *menu)
new_y = scr->scr_height - menu->entry_height - 1;
move = 1;
}
new_y = new_y - menu->frame->top_width
- menu->selected_entry*menu->entry_height;
move_menus(menu, new_x, new_y);
}
@@ -1531,7 +1523,7 @@ getScrollAmount(WMenu *menu, int *hamount, int *vamount)
} else if (yroot >= screenH-2 && menuY2 > screenH-1) {
/* scroll up */
*vamount = MIN(MENU_SCROLL_STEP, abs(menuY2-screenH-1));
*vamount = MIN(MENU_SCROLL_STEP, abs(menuY2-screenH-2));
*vamount = -*vamount;
}
@@ -1862,10 +1854,13 @@ menuMouseDown(WObjDescriptor *desc, XEvent *event)
prevy = bev->y_root;
while (!done) {
int x, y;
XAllowEvents(dpy, SyncPointer, CurrentTime);
WMMaskEvent(dpy, ExposureMask|ButtonMotionMask|ButtonReleaseMask
|ButtonPressMask, &ev);
switch (ev.type) {
case MotionNotify:
case MotionNotify:
smenu = findMenu(scr, &x, &y);
if (smenu == NULL) {
@@ -2156,15 +2151,16 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
int x=menu->frame_x, y=menu->frame_y;
int dx=event->xbutton.x_root, dy=event->xbutton.y_root;
int i, lower;
Bool started;
#ifdef DEBUG
printf("Moving menu\n");
#endif
/* can't touch the menu copy */
if (menu->flags.brother)
return;
if (event->xbutton.button != Button1 && event->xbutton.button != Button2)
return;
if (XGrabPointer(dpy, menu->frame->titlebar->window, False,
@@ -2176,6 +2172,7 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
#endif
return;
}
if (event->xbutton.state & MOD_MASK) {
wLowerFrame(menu->frame->core);
lower = 1;
@@ -2184,10 +2181,11 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
lower = 0;
}
tmp = menu;
/* lower/raise all submenus */
while (1) {
if (tmp->selected_entry>=0 && tmp->cascades) {
if (tmp->selected_entry>=0 && tmp->cascades
&& tmp->entries[tmp->selected_entry]->cascade>=0) {
tmp = tmp->cascades[tmp->entries[tmp->selected_entry]->cascade];
if (!tmp || !tmp->flags.mapped)
break;
@@ -2199,6 +2197,7 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
break;
}
}
/* tear off the menu if it's a root menu or a cascade
application menu */
if (!menu->flags.buttoned && !menu->flags.brother
@@ -2218,17 +2217,24 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
}
}
}
started = False;
while(1) {
WMMaskEvent(dpy, ButtonMotionMask|ButtonReleaseMask|ButtonPressMask
|ExposureMask, &ev);
switch (ev.type) {
case MotionNotify:
x += ev.xmotion.x_root - dx;
y += ev.xmotion.y_root - dy;
dx = ev.xmotion.x_root;
dy = ev.xmotion.y_root;
wMenuMove(menu, x, y, True);
if (started) {
x += ev.xmotion.x_root - dx;
y += ev.xmotion.y_root - dy;
dx = ev.xmotion.x_root;
dy = ev.xmotion.y_root;
wMenuMove(menu, x, y, True);
} else {
if (abs(ev.xmotion.x_root - dx) > MOVE_THRESHOLD
|| abs(ev.xmotion.y_root - dy) > MOVE_THRESHOLD)
started = True;
}
break;
case ButtonPress:
@@ -2242,9 +2248,10 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
#endif
XUngrabPointer(dpy, CurrentTime);
return;
default:
WMHandleEvent(&ev);
break;
}
}
}
@@ -2291,6 +2298,7 @@ wMenuSaveState(WScreen *scr)
menus = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
#ifndef LITE
if (scr->root_menu && scr->root_menu->flags.buttoned) {
sprintf(buffer, "%i,%i", scr->root_menu->frame_x,
scr->root_menu->frame_y);
@@ -2312,7 +2320,7 @@ wMenuSaveState(WScreen *scr)
PLRelease(value);
save_menus = 1;
}
#endif /* !LITE */
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
sprintf(buffer, "%i,%i", scr->workspace_menu->frame_x,
scr->workspace_menu->frame_y);
@@ -2353,15 +2361,16 @@ restoreMenu(WScreen *scr, proplist_t menu, int which)
if (sscanf(PLGetString(menu), "%i,%i", &x, &y)!=2)
COMPLAIN("Position");
#ifndef LITE
if (which & WSS_ROOTMENU) {
OpenRootMenu(scr, x, y, False);
pmenu = scr->root_menu;
}
else if (which & WSS_SWITCHMENU) {
} else if (which & WSS_SWITCHMENU) {
OpenSwitchMenu(scr, x, y, False);
pmenu = scr->switch_menu;
}
else if (which & WSS_WSMENU) {
} else
#endif /* !LITE */
if (which & WSS_WSMENU) {
OpenWorkspaceMenu(scr, x, y);
pmenu = scr->workspace_menu;
if (pmenu->parent) {
@@ -2428,11 +2437,12 @@ OpenWorkspaceMenu(WScreen *scr, int x, int y)
WMenu *menu, *parent;
WMenuEntry *entry;
#ifndef LITE
if (!scr->root_menu) {
OpenRootMenu(scr, scr->scr_width*2, 0, False);
wMenuUnmap(scr->root_menu);
}
#endif
menu = scr->workspace_menu;
if (menu) {
if (menu->flags.mapped) {
+154 -33
View File
@@ -206,8 +206,7 @@ NextFocusWindow(WScreen *scr)
d = 0xffffffff;
while (tmp) {
if (wWindowCanReceiveFocus(tmp)
&& (!tmp->window_flags.skip_window_list
|| tmp->flags.internal_window)) {
&& (!WFLAGP(tmp, skip_window_list)|| tmp->flags.internal_window)) {
if (min->client_win > tmp->client_win)
min = tmp;
if (tmp->client_win > wwin->client_win
@@ -239,8 +238,7 @@ PrevFocusWindow(WScreen *scr)
d = 0xffffffff;
while (tmp) {
if (wWindowCanReceiveFocus(tmp) &&
(!tmp->window_flags.skip_window_list
|| tmp->flags.internal_window)) {
(!WFLAGP(tmp, skip_window_list) || tmp->flags.internal_window)) {
if (max->client_win < tmp->client_win)
max = tmp;
if (tmp->client_win < wwin->client_win
@@ -276,7 +274,7 @@ isBelow(WWindow *win1, WWindow *win2)
tmp = tmp->stacking->under;
}
for (i=win1->frame->window_level-1; i>=0; i--) {
for (i=win1->frame->core->stacking->window_level-1; i>=0; i--) {
tmp = win1->screen_ptr->stacking_list[i];
while (tmp) {
if (tmp == win2->frame->core)
@@ -564,19 +562,20 @@ ShrinkString(WFont *font, char *string, int width)
char*
FindImage(char **paths, char *file)
FindImage(char *paths, char *file)
{
char *tmp, *path;
tmp = strrchr(file, ':');
if (tmp) {
*tmp = 0;
path = wfindfileinlist(paths, file);
path = wfindfile(paths, file);
*tmp = ':';
}
if (!tmp || !path) {
path = wfindfileinlist(paths, file);
path = wfindfile(paths, file);
}
return path;
}
@@ -604,7 +603,8 @@ FlattenStringList(char **list, int count)
*flat_string = 0;
for (i=0; i<count; i++) {
if (list[i]!=NULL && list[i][0]!=0) {
strcat(flat_string, " ");
if (i>0)
strcat(flat_string, " ");
wspace = strpbrk(list[i], " \t");
if (wspace)
strcat(flat_string, "\"");
@@ -780,31 +780,82 @@ static char*
getuserinput(WScreen *scr, char *line, int *ptr)
{
char *ret;
char *tmp;
int i;
char buffer[256];
if (line[*ptr]!='(') {
tmp = _("Program Arguments");
} else {
i = 0;
while (line[*ptr]!=0 && line[*ptr]!=')') {
(*ptr)++;
if (line[*ptr]!='\\') {
buffer[i++] = line[*ptr];
} else {
(*ptr)++;
if (line[*ptr]==0)
break;
}
}
if (i>0)
buffer[i-1] = 0;
tmp = (char*)buffer;
}
char *title;
char *prompt;
int i, j, k, state;
char tbuffer[256], pbuffer[256];
title = _("Program Arguments");
prompt = _("Enter command arguments:");
ret = NULL;
if (!wInputDialog(scr, tmp, _("Enter command arguments:"), &ret))
#define _STARTING 0
#define _TITLE 1
#define _PROMPT 2
#define _DONE 3
state = _STARTING;
j = 0;
for (i = 0; line[i]==0 && state!=_DONE; i++) {
switch (state) {
case _STARTING:
if (line[i]=='(') {
state = _TITLE;
} else {
state = _DONE;
}
break;
case _TITLE:
if (j <= 0 && line[i]==',') {
j = 0;
if (i > 1) {
strncpy(tbuffer, &line[1], WMIN(i, 255));
tbuffer[WMIN(i, 255)] = 0;
title = (char*)tbuffer;
}
k = i+1;
state = _PROMPT;
} else if (j <= 0 && line[i]==')') {
if (i > 1) {
strncpy(tbuffer, &line[1], WMIN(i, 255));
tbuffer[WMIN(i, 255)] = 0;
title = (char*)tbuffer;
}
state = _DONE;
} else if (line[i]=='(')
j++;
else if (line[i]==')')
j--;
break;
case _PROMPT:
if (line[i]==')' && j==0) {
if (i-k > 1) {
strncpy(pbuffer, &line[k], WMIN(i-k, 255));
pbuffer[WMIN(i-k, 255)] = 0;
title = (char*)pbuffer;
}
state = _DONE;
} else if (line[i]=='(')
j++;
else if (line[i]==')')
j--;
break;
}
}
#undef _STARTING
#undef _TITLE
#undef _PROMPT
#undef _DONE
if (!wInputDialog(scr, title, prompt, &ret))
return NULL;
else
return ret;
@@ -1302,3 +1353,73 @@ UnescapeWM_CLASS(char *str, char **name, char **class)
*class = NULL;
}
}
void
SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
{
unsigned char *buffer;
int len;
int i;
char buf[16];
if (!scr->flags.backimage_helper_launched) {
return;
}
len = (msg ? strlen(msg) : 0) + (workspace >=0 ? 4 : 0) + 1 ;
buffer = wmalloc(len+5);
sprintf(buf, "%4i", len);
memcpy(buffer, buf, 4);
buffer[4] = type;
i = 5;
if (workspace >= 0) {
sprintf(buf, "%4i", workspace);
memcpy(&buffer[i], buf, 4);
i += 4;
buffer[i] = 0;
}
if (msg)
strcpy(&buffer[i], msg);
if (write(scr->helper_fd, buffer, len+4) < 0) {
wsyserror(_("could not send message to background image helper"));
}
free(buffer);
}
void
ExecuteShellCommand(WScreen *scr, char *command)
{
static char *shell = NULL;
pid_t pid;
/*
* This have a problem: if the shell is tcsh (not sure about others)
* and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
* will block and the command will not be executed.
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
*/
shell = "/bin/sh";
pid = fork();
if (pid==0) {
SetupEnvironment(scr);
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl(shell, shell, "-c", command, NULL);
wsyserror("could not execute %s -c %s", shell, command);
Exit(-1);
} else if (pid < 0) {
wsyserror("cannot fork a new process");
}
}
+258
View File
@@ -0,0 +1,258 @@
/* motif.c-- stuff for support for mwm hints
*
* Window Maker window manager
*
* Copyright (c) 1998, 1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include "wconfig.h"
#ifdef MWM_HINTS
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "WindowMaker.h"
#include "wcore.h"
#include "framewin.h"
#include "window.h"
#include "properties.h"
#include "icon.h"
#include "client.h"
#include "funcs.h"
#include "motif.h"
/* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0)
#define MWM_HINTS_DECORATIONS (1L << 1)
/* bit definitions for MwmHints.functions */
#define MWM_FUNC_ALL (1L << 0)
#define MWM_FUNC_RESIZE (1L << 1)
#define MWM_FUNC_MOVE (1L << 2)
#define MWM_FUNC_MINIMIZE (1L << 3)
#define MWM_FUNC_MAXIMIZE (1L << 4)
#define MWM_FUNC_CLOSE (1L << 5)
/* bit definitions for MwmHints.decorations */
#define MWM_DECOR_ALL (1L << 0)
#define MWM_DECOR_BORDER (1L << 1)
#define MWM_DECOR_RESIZEH (1L << 2)
#define MWM_DECOR_TITLE (1L << 3)
#define MWM_DECOR_MENU (1L << 4)
#define MWM_DECOR_MINIMIZE (1L << 5)
#define MWM_DECOR_MAXIMIZE (1L << 6)
#define PROP_MWM_HINTS_ELEMENTS 4
/* Motif window hints */
typedef struct {
long flags;
long functions;
long decorations;
long inputMode;
} MWMHints;
static Atom _XA_MOTIF_WM_HINTS;
static void
setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
{
/*
* We will ignore all decoration hints that have an equivalent as
* functions, because wmaker does not distinguish decoration hints
*/
if (mwm_hints->flags & MWM_HINTS_DECORATIONS) {
# ifdef DEBUG
fprintf(stderr,"has decor hints [ ");
# endif
WSETUFLAG(wwin, no_titlebar, 1);
WSETUFLAG(wwin, no_close_button, 1);
WSETUFLAG(wwin, no_miniaturize_button, 1);
WSETUFLAG(wwin, no_resizebar, 1);
if (mwm_hints->decorations & MWM_DECOR_ALL) {
# ifdef DEBUG
fprintf(stderr,"ALL ");
# endif
WSETUFLAG(wwin, no_titlebar, 0);
WSETUFLAG(wwin, no_close_button, 0);
WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_miniaturize_button, 0);
WSETUFLAG(wwin, no_miniaturizable, 0);
WSETUFLAG(wwin, no_resizebar, 0);
WSETUFLAG(wwin, no_resizable, 0);
}
/*
if (mwm_hints->decorations & MWM_DECOR_BORDER) {
# ifdef DEBUG
fprintf(stderr,"(BORDER) ");
# endif
}
*/
if (mwm_hints->decorations & MWM_DECOR_RESIZEH) {
# ifdef DEBUG
fprintf(stderr,"RESIZEH ");
# endif
WSETUFLAG(wwin, no_resizebar, 0);
}
if (mwm_hints->decorations & MWM_DECOR_TITLE) {
# ifdef DEBUG
fprintf(stderr,"TITLE+close ");
# endif
WSETUFLAG(wwin, no_titlebar, 0);
WSETUFLAG(wwin, no_close_button, 0);
WSETUFLAG(wwin, no_closable, 0);
}
/*
if (mwm_hints->decorations & MWM_DECOR_MENU) {
# ifdef DEBUG
fprintf(stderr,"(MENU) ");
# endif
}
*/
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
# ifdef DEBUG
fprintf(stderr,"MINIMIZE ");
# endif
WSETUFLAG(wwin, no_miniaturize_button, 0);
WSETUFLAG(wwin, no_miniaturizable, 0);
}
/*
if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
# ifdef DEBUG
fprintf(stderr,"(MAXIMIZE) ");
# endif
}
*/
# ifdef DEBUG
fprintf(stderr,"]\n");
# endif
}
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
# ifdef DEBUG
fprintf(stderr,"has function hints [ ");
# endif
WSETUFLAG(wwin, no_closable, 1);
WSETUFLAG(wwin, no_miniaturizable, 1);
WSETUFLAG(wwin, no_resizable, 1);
if (mwm_hints->functions & MWM_FUNC_ALL) {
# ifdef DEBUG
fprintf(stderr,"ALL ");
# endif
WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_miniaturizable, 0);
WSETUFLAG(wwin, no_resizable, 0);
}
if (mwm_hints->functions & MWM_FUNC_RESIZE) {
# ifdef DEBUG
fprintf(stderr,"RESIZE ");
# endif
WSETUFLAG(wwin, no_resizable, 0);
}
/*
if (mwm_hints->functions & MWM_FUNC_MOVE) {
# ifdef DEBUG
fprintf(stderr,"(MOVE) ");
# endif
}
*/
if (mwm_hints->functions & MWM_FUNC_MINIMIZE) {
# ifdef DEBUG
fprintf(stderr,"MINIMIZE ");
# endif
WSETUFLAG(wwin, no_miniaturizable, 0);
}
if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) {
# ifdef DEBUG
fprintf(stderr,"MAXIMIZE ");
/* a window must be resizable to be maximizable */
WSETUFLAG(wwin, no_resizable, 0);
# endif
}
if (mwm_hints->functions & MWM_FUNC_CLOSE) {
# ifdef DEBUG
fprintf(stderr,"CLOSE ");
# endif
WSETUFLAG(wwin, no_closable, 0);
}
# ifdef DEBUG
fprintf(stderr,"]\n");
# endif
}
}
static int
getMWMHints(Window window, MWMHints *mwmhints)
{
unsigned long *data;
if (!_XA_MOTIF_WM_HINTS) {
_XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
}
data = (unsigned long*)PropGetCheckProperty(window, _XA_MOTIF_WM_HINTS,
_XA_MOTIF_WM_HINTS, 32,
PROP_MWM_HINTS_ELEMENTS, NULL);
if (!data)
return 0;
mwmhints->flags = data[0];
mwmhints->functions = data[1];
mwmhints->decorations = data[2];
mwmhints->inputMode = data[3];
XFree(data);
return 1;
}
void
wMWMCheckClientHints(WWindow *wwin)
{
MWMHints hints;
if (getMWMHints(wwin->client_win, &hints)) {
setupMWMHints(wwin, &hints);
}
}
#endif /* MWM_HINTS */
+2 -38
View File
@@ -1,9 +1,8 @@
/* motif.h-- stuff for support for mwm hints
* ripped from E.h (enlightenment)
*
* Window Maker window manager
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
* Copyright (c) 1998, 1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,41 +24,6 @@
#ifndef WMMWM_H_
#define WMMWM_H_
#include <X11/Xproto.h>
/* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0)
#define MWM_HINTS_DECORATIONS (1L << 1)
/* bit definitions for MwmHints.functions */
#define MWM_FUNC_ALL (1L << 0)
#define MWM_FUNC_RESIZE (1L << 1)
#define MWM_FUNC_MOVE (1L << 2)
#define MWM_FUNC_MINIMIZE (1L << 3)
#define MWM_FUNC_MAXIMIZE (1L << 4)
#define MWM_FUNC_CLOSE (1L << 5)
/* bit definitions for MwmHints.decorations */
#define MWM_DECOR_ALL (1L << 0)
#define MWM_DECOR_BORDER (1L << 1)
#define MWM_DECOR_RESIZEH (1L << 2)
#define MWM_DECOR_TITLE (1L << 3)
#define MWM_DECOR_MENU (1L << 4)
#define MWM_DECOR_MINIMIZE (1L << 5)
#define MWM_DECOR_MAXIMIZE (1L << 6)
#define PROP_MWM_HINTS_ELEMENTS 4
/* Motif window hints */
typedef struct _mwmhints
{
CARD32 flags;
CARD32 functions;
CARD32 decorations;
INT32 inputMode;
}
MWMHints;
extern Atom _XA_MOTIF_WM_HINTS;
void wMWMCheckClientHints(WWindow *wwin);
#endif
+305 -19
View File
@@ -33,6 +33,7 @@
#include "window.h"
#include "client.h"
#include "icon.h"
#include "dock.h"
#include "funcs.h"
#include "actions.h"
#include "workspace.h"
@@ -404,27 +405,39 @@ XUnmapWindow(dpy, (w)->screen_ptr->geometry_display);
static void
checkEdgeResistance(WWindow *wwin, int *winx, int *winy, int off_x, int off_y)
{
int scr_width = wwin->screen_ptr->scr_width;
WScreen *scr = wwin->screen_ptr;
int scr_width = wwin->screen_ptr->scr_width - 3;
int scr_height = wwin->screen_ptr->scr_height;
int x = *winx;
int y = *winy;
int edge_resistance = wPreferences.edge_resistance;
int right_side = scr_width;
int left_side = 0;
int isize = wPreferences.icon_size;
x -= off_x;
y -= off_y;
if ((x + wwin->frame->core->width) >= (scr_width - 2)) {
if ((x + wwin->frame->core->width) < ((scr_width - 2)
if (scr->dock)
{
if (scr->dock->on_right_side)
right_side -= isize + DOCK_EXTRA_SPACE;
else
left_side += isize + DOCK_EXTRA_SPACE;
}
if ((x + wwin->frame->core->width) >= right_side) {
if ((x + wwin->frame->core->width) < (right_side
+ edge_resistance)) {
x = scr_width - wwin->frame->core->width - 2;
x = right_side - wwin->frame->core->width;
} else {
x -= edge_resistance;
}
}
if (x <= 0) {
if (x > -edge_resistance) {
x = 0;
if (x <= left_side) {
if (x > (left_side - edge_resistance)) {
x = left_side;
} else {
x += edge_resistance;
}
@@ -497,10 +510,10 @@ drawTransparentFrame(WWindow *wwin, int x, int y, int width, int height)
int h = 0;
int bottom = 0;
if (!wwin->window_flags.no_titlebar && !wwin->flags.shaded) {
if (!WFLAGP(wwin, no_titlebar) && !wwin->flags.shaded) {
h = wwin->screen_ptr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
}
if (!wwin->window_flags.no_resizebar && !wwin->flags.shaded) {
if (!WFLAGP(wwin, no_resizebar) && !wwin->flags.shaded) {
/* Can't use wwin-frame->bottom_width because, in some cases
(e.g. interactive placement), frame does not point to anything. */
bottom = RESIZEBAR_HEIGHT - 1;
@@ -623,13 +636,276 @@ crossWorkspace(WScreen *scr, WWindow *wwin, int opaque_move,
* The position display configuration may be changed.
*----------------------------------------------------------------------
*/
#if 0
typedef struct _looper {
WWindow *wwin;
int x,y,w,h,ox,oy;
} _looper;
void
_keyloop(_looper *lpr){
WWindow *wwin = lpr->wwin;
WScreen *scr = wwin->screen_ptr;
int w = wwin->frame->core->width;
int h = wwin->frame->core->height;
int src_x = wwin->frame_x;
int src_y = wwin->frame_y;
if (!scr->selected_windows){
drawTransparentFrame(wwin, src_x+lpr->ox, src_y+lpr->oy, w, h);
}
XUngrabServer(dpy);
XSync(dpy, False);
usleep(10000);
XGrabServer(dpy);
printf("called\n");
if (!scr->selected_windows){
drawTransparentFrame(wwin, src_x+lpr->ox, src_y+lpr->oy, w, h);
}
/* reset timer */
if(scr->keymove_tick)
WMAddTimerHandler(15000,(WMCallback*)_keyloop, lpr);
}
#endif
#define _KS 20;
int
wKeyboardMoveResizeWindow(WWindow *wwin)
{
WScreen *scr = wwin->screen_ptr;
Window root = scr->root_win;
XEvent event;
int w = wwin->frame->core->width;
int h = wwin->frame->core->height;
int scr_width = wwin->screen_ptr->scr_width;
int scr_height = wwin->screen_ptr->scr_height;
int vert_border = wwin->frame->top_width + wwin->frame->bottom_width;
int src_x = wwin->frame_x;
int src_y = wwin->frame_y;
int done,off_x,off_y,ww,wh;
KeySym keysym=NoSymbol;
KeyCode shiftl,shiftr,ctrll,ctrlmode;
/*
int timer;
_looper looper;
looper.wwin=wwin;
scr->keymove_tick=1;
WMAddTimerHandler(1000,(WMCallback*)_keyloop, &looper);
*/
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
ctrll = XKeysymToKeycode(dpy, XK_Control_L);
ctrlmode=done=off_x=off_y=0;
XSync(dpy, False);
usleep(10000);
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
if (!wwin->flags.selected) {
wUnselectWindows(scr);
}
XGrabServer(dpy);
if (!scr->selected_windows){
drawTransparentFrame(wwin, src_x, src_y, w, h);
mapPositionDisplay(wwin, src_x, src_y, w, h);
} else {
drawFrames(wwin,scr->selected_windows,0,0,0,0);
}
ww=w;
wh=h;
while(1) {
/*
looper.ox=off_x;
looper.oy=off_y;
*/
WMMaskEvent(dpy, KeyPressMask | ButtonReleaseMask
| ButtonPressMask | ExposureMask, &event);
if (!scr->selected_windows){
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
else {
drawFrames(wwin,scr->selected_windows,off_x,off_y,0,0);
}
if(ctrlmode)
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
switch (event.type) {
case KeyPress:
if (event.xkey.state & ControlMask){
ctrlmode=1;
wUnselectWindows(scr);
}
else {
ctrlmode=0;
}
if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr){
if(ctrlmode)
cycleGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh, 0);
else
cyclePositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
else {
keysym = XLookupKeysym(&event.xkey, 0);
switch(keysym){
case XK_Return:
done=2;
break;
case XK_Escape:
done=1;
break;
case XK_Up:
case XK_KP_Up:
case XK_k:
if (ctrlmode){
h-=_KS;
}
else off_y-=_KS;
break;
case XK_Down:
case XK_KP_Down:
case XK_j:
if (ctrlmode){
h+=_KS;
}
else off_y+=_KS;
break;
case XK_Left:
case XK_KP_Left:
case XK_h:
if (ctrlmode){
w-=_KS;
}
else off_x-=_KS;
break;
case XK_Right:
case XK_KP_Right:
case XK_l:
if (ctrlmode){
w+=_KS;
}
else off_x+=_KS;
break;
}
ww=w;wh=h;
wh-=vert_border;
wWindowConstrainSize(wwin, &ww, &wh);
wh+=vert_border;
if (wPreferences.ws_cycle){
if (src_x + off_x + wwin->frame->core->width < 20){
if(!scr->current_workspace) {
wWorkspaceChange(scr, scr->workspace_count-1);
}
else wWorkspaceChange(scr, scr->current_workspace-1);
off_x += scr_width;
}
else if (src_x + off_x + 20 > scr_width){
if(scr->current_workspace == scr->workspace_count-1) {
wWorkspaceChange(scr, 0);
}
else wWorkspaceChange(scr, scr->current_workspace+1);
off_x -= scr_width;
}
}
else {
if (src_x + off_x + wwin->frame->core->width < 20)
off_x = 20 - wwin->frame->core->width - src_x;
else if (src_x + off_x + 20 > scr_width)
off_x = scr_width - 20 - src_x;
}
if (src_y + off_y + wwin->frame->core->height < 20)
off_y = 20 - wwin->frame->core->height - src_y;
else if (src_y + off_y + 20 > scr_height)
off_y = scr_height - 20 - src_y;
}
break;
case ButtonPress:
case ButtonRelease:
done=1;
break;
default:
}
/*
XUngrabServer(dpy);
WMHandleEvent(&event);
XSync(dpy, False);
XGrabServer(dpy);
* */
if (!scr->selected_windows){
if(ctrlmode){
unmapPositionDisplay(wwin);
mapGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
else {
unmapGeometryDisplay(wwin);
mapPositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
else {
drawFrames(wwin,scr->selected_windows,off_x,off_y,0,0);
}
if(ctrlmode){
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
}
else
showPosition(wwin, src_x+off_x, src_y+off_y);
/**/
if(done){
scr->keymove_tick=0;
/*
WMDeleteTimerWithClientData(&looper);
*/
if (!scr->selected_windows){
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
}
else {
drawFrames(wwin,scr->selected_windows,off_x,off_y,0,0);
}
if(ctrlmode){
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
unmapGeometryDisplay(wwin);
}
else
unmapPositionDisplay(wwin);
XUngrabKeyboard(dpy, CurrentTime);
XUngrabServer(dpy);
if(done==2){
if (!scr->selected_windows){
wWindowConfigure(wwin, src_x+off_x, src_y+off_y, ww, wh - vert_border);
wWindowSynthConfigureNotify(wwin);
}
else {
LinkedList *list;
list=scr->selected_windows;
doWindowMove(wwin,0,0,scr->selected_windows,off_x,off_y,0,0);
while (list) {
wWindowSynthConfigureNotify(list->head);
list = list->tail;
}
}
wWindowChangeWorkspace(wwin, scr->current_workspace);
wSetFocusTo(scr, wwin);
}
return 1;
}
}
}
int
wMouseMoveWindow(WWindow *wwin, XEvent *ev)
{
WScreen *scr = wwin->screen_ptr;
XEvent event;
Window root = scr->root_win;
KeyCode shiftl, shiftr;
KeyCode shiftl, shiftr, tab;
int w = wwin->frame->core->width;
int h = wwin->frame->core->height;
int x = wwin->frame_x;
@@ -642,7 +918,8 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
/* This needs not to change while moving, else bad things can happen */
int opaque_move = wPreferences.opaque_move;
int XOffset, YOffset, origDragX, origDragY;
int grid = 0;
origDragX = wwin->frame_x;
origDragY = wwin->frame_y;
XOffset = origDragX - ev->xbutton.x_root;
@@ -662,13 +939,15 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
#endif
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
tab = XKeysymToKeycode(dpy, XK_Tab);
while (1) {
if (warped) {
int junk;
Window junkw;
/* XWarpPointer() doesn't seem to generate Motion events, so
we've got to simulate them */
printf("warp\n");
XQueryPointer(dpy, root, &junkw, &junkw, &event.xmotion.x_root,
&event.xmotion.y_root, &junk, &junk,
(unsigned *) &junk);
@@ -676,7 +955,7 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
Window win;
WMMaskEvent(dpy, KeyPressMask | ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask | ExposureMask, &event);
| ButtonReleaseMask | ButtonPressMask | ExposureMask, &event);
if (event.type == MotionNotify) {
/* compress MotionNotify events */
@@ -702,10 +981,17 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
}
showPosition(wwin, x, y);
}
if (event.xkey.keycode == tab) {
grid = !grid;
}
break;
case MotionNotify:
if (started) {
if (grid) {
event.xmotion.x_root = (event.xmotion.x_root/10)*10;
event.xmotion.y_root = (event.xmotion.y_root/10)*10;
}
showPosition(wwin, x, y);
if (!opaque_move) {
@@ -972,7 +1258,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
ry2 = fy + fh - 1;
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
if (!wwin->window_flags.no_titlebar)
if (!WFLAGP(wwin, no_titlebar))
h = wwin->screen_ptr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
else
h = 0;
@@ -1139,7 +1425,7 @@ wUnselectWindows(WScreen *scr)
}
}
#ifndef LITE
static void
selectWindowsInside(WScreen *scr, int x1, int y1, int x2, int y2)
{
@@ -1150,7 +1436,7 @@ selectWindowsInside(WScreen *scr, int x1, int y1, int x2, int y2)
while (tmpw != NULL) {
if (!(tmpw->flags.miniaturized || tmpw->flags.hidden)) {
if ((tmpw->frame->workspace == scr->current_workspace
|| tmpw->window_flags.omnipresent)
|| IS_OMNIPRESENT(tmpw))
&& (tmpw->frame_x >= x1) && (tmpw->frame_y >= y1)
&& (tmpw->frame->core->width + tmpw->frame_x <= x2)
&& (tmpw->frame->core->height + tmpw->frame_y <= y2)) {
@@ -1232,7 +1518,7 @@ wSelectWindows(WScreen *scr, XEvent *ev)
}
}
}
#endif /* !LITE */
void
InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
@@ -1253,11 +1539,11 @@ InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
*y_ret = 0;
return;
}
if (!wwin->window_flags.no_titlebar) {
if (!WFLAGP(wwin, no_titlebar)) {
h = scr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
height += h;
}
if (!wwin->window_flags.no_resizebar) {
if (!WFLAGP(wwin, no_resizebar)) {
height += RESIZEBAR_HEIGHT;
}
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+384
View File
@@ -0,0 +1,384 @@
/*
* openlook.c - OPEN LOOK (tm) compatibility stuff
*
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
/*
* based on olwm code
*/
#include "wconfig.h"
#ifdef OLWM_HINTS
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "WindowMaker.h"
#include "wcore.h"
#include "framewin.h"
#include "window.h"
#include "properties.h"
#include "icon.h"
#include "client.h"
#include "funcs.h"
#include "openlook.h"
/* pin states */
#define OL_PIN_OUT 0
#define OL_PIN_IN 1
/* flags */
#define OL_DECORATION_HEADER (1<<0)
#define OL_DECORATION_FOOTER (1<<1)
#define OL_DECORATION_PUSHPIN (1<<2)
#define OL_DECORATION_CLOSEBUTTON (1<<3)
#define OL_DECORATION_RESIZEABLE (1<<4)
#define OL_DECORATION_ICONNAME (1<<5)
#define OL_DECORATION_WARPTOPIN (1<<6)
#define OL_DECORATION_NONE (1<<7)
typedef struct {
long flags;
Atom winType;
Atom menuType;
long pinInitState;
long cancel;
} OLHints;
#define OL_WINTYPE (1<<0)
#define OL_MENUTYPE (1<<1)
#define OL_PINSTATE (1<<2)
#define OL_CANCEL (1<<3)
typedef struct {
unsigned long flags;
unsigned long state;
} OLWindowState;
#define OL_STATE_SEMANTIC (1<<0)
#define OL_STATE_COMPOSE (1<<0)
#define OL_STATE_CAPSLOCK (1<<1)
#define OL_STATE_NUMLOCK (1<<2)
#define OL_STATE_SCROLLLOCK (1<<3)
static Atom _XA_SUN_WM_PROTOCOLS = 0;
static Bool
getWindowState(Window win, OLWindowState *state)
{
static Atom _XA_SUN_WINDOW_STATE = 0;
unsigned long *data;
if (!_XA_SUN_WINDOW_STATE) {
_XA_SUN_WINDOW_STATE = XInternAtom(dpy, "_SUN_WINDOW_STATE", False);
}
data = (unsigned long*)PropGetCheckProperty(win, _XA_SUN_WINDOW_STATE,
XA_INTEGER, 32, 2, NULL);
if (!data) {
return False;
}
state->flags = data[0];
state->state = data[1];
XFree(data);
return True;
}
static Bool
getWindowHints(Window window, OLHints *hints)
{
long *data;
int count;
if (!_XA_OL_WIN_ATTR) {
_XA_OL_WIN_ATTR = XInternAtom(dpy, "_OL_WIN_ATTR", False);
}
data = (long*)PropGetCheckProperty(window, _XA_OL_WIN_ATTR,
_XA_OL_WIN_ATTR, 32, 0, &count);
if (!data)
return False;
if (count == 3) {
/* old format */
hints->flags = OL_WINTYPE|OL_MENUTYPE|OL_PINSTATE;
hints->winType = data[0];
hints->menuType = data[1];
hints->pinInitState = data[2];
hints->cancel = 0;
} else if (count == 5) {
/* new format */
hints->flags = data[0];
hints->winType = data[1];
hints->menuType = data[2];
hints->pinInitState = data[3];
hints->cancel = data[4];
} else {
XFree(data);
return False;
}
XFree(data);
/* do backward compatibility stuff */
if (hints->flags & OL_PINSTATE) {
static Atom pinIn = 0, pinOut;
if (!pinIn) {
pinIn = XInternAtom(dpy, "_OL_PIN_IN", False);
pinOut = XInternAtom(dpy, "_OL_PIN_OUT", False);
}
if (hints->pinInitState == pinIn)
hints->pinInitState = OL_PIN_IN;
else if (hints->pinInitState == pinOut)
hints->pinInitState = OL_PIN_OUT;
}
return True;
}
static void
applyDecorationHints(Window win, int *flags)
{
Atom *atoms;
static Atom _XA_OL_DECOR_ADD = 0;
static Atom _XA_OL_DECOR_DEL = 0;
static Atom _XA_CLOSE, _XA_FOOTER, _XA_RESIZE, _XA_HEADER, _XA_PIN,
_XA_ICONNAME;
int count;
int i;
if (!_XA_OL_DECOR_DEL) {
_XA_OL_DECOR_ADD = XInternAtom(dpy, "_OL_DECOR_ADD", False);
_XA_OL_DECOR_DEL = XInternAtom(dpy, "_OL_DECOR_DEL", False);
_XA_CLOSE = XInternAtom(dpy, "_OL_DECOR_CLOSE", False);
_XA_FOOTER = XInternAtom(dpy, "_OL_DECOR_FOOTER", False);
_XA_RESIZE = XInternAtom(dpy, "_OL_DECOR_RESIZE", False);
_XA_HEADER = XInternAtom(dpy, "_OL_DECOR_HEADER", False);
_XA_PIN = XInternAtom(dpy, "_OL_DECOR_PIN", False);
_XA_ICONNAME = XInternAtom(dpy, "_OL_DECOR_ICON_NAME", False);
}
atoms = PropGetCheckProperty(win, _XA_OL_DECOR_ADD, XA_ATOM, 32, 0,
&count);
if (atoms) {
for (i=0; i < count; i++) {
if (atoms[i] == _XA_CLOSE)
*flags |= OL_DECORATION_CLOSEBUTTON;
else if (atoms[i] == _XA_FOOTER)
*flags |= OL_DECORATION_FOOTER;
else if (atoms[i] == _XA_RESIZE)
*flags |= OL_DECORATION_RESIZEABLE;
else if (atoms[i] == _XA_HEADER)
*flags |= OL_DECORATION_HEADER;
else if (atoms[i] == _XA_PIN)
*flags |= OL_DECORATION_PUSHPIN;
else if (atoms[i] == _XA_ICONNAME)
*flags |= OL_DECORATION_ICONNAME;
}
XFree(atoms);
}
atoms = PropGetCheckProperty(win, _XA_OL_DECOR_DEL, XA_ATOM, 32, 0,
&count);
if (atoms) {
for (i=0; i < count; i++) {
if (atoms[i] == _XA_CLOSE)
*flags &= ~OL_DECORATION_CLOSEBUTTON;
else if (atoms[i] == _XA_FOOTER)
*flags &= ~OL_DECORATION_FOOTER;
else if (atoms[i] == _XA_RESIZE)
*flags &= ~OL_DECORATION_RESIZEABLE;
else if (atoms[i] == _XA_HEADER)
*flags &= ~OL_DECORATION_HEADER;
else if (atoms[i] == _XA_PIN)
*flags &= ~OL_DECORATION_PUSHPIN;
else if (atoms[i] == _XA_ICONNAME)
*flags &= ~OL_DECORATION_ICONNAME;
}
XFree(atoms);
}
}
void
wOLWMInitStuff(WScreen *scr)
{
static Atom _SUN_OL_WIN_ATTR_5;
if (!_XA_SUN_WM_PROTOCOLS) {
_XA_SUN_WM_PROTOCOLS = XInternAtom(dpy, "_SUN_WM_PROTOCOLS", False);
_SUN_OL_WIN_ATTR_5 = XInternAtom(dpy, "_SUN_OL_WIN_ATTR_5", False);
}
XChangeProperty(dpy, scr->root_win, _XA_SUN_WM_PROTOCOLS, XA_ATOM, 32,
PropModeReplace, (unsigned char*)&_SUN_OL_WIN_ATTR_5, 1);
}
void
wOLWMShutdown(WScreen *scr)
{
XDeleteProperty(dpy, scr->root_win, _XA_SUN_WM_PROTOCOLS);
}
void
wOLWMCheckClientHints(WWindow *wwin)
{
OLHints hints;
static Atom WT_BASE = 0, WT_CMD, WT_NOTICE, WT_HELP, WT_OTHER;
static Atom MT_FULL, MT_LIMITED, MT_NONE;
int decorations;
int pinInitState = OL_PIN_IN;
Atom menuType;
if (!WT_BASE) {
WT_BASE = XInternAtom(dpy, "_OL_WT_BASE", False);
WT_CMD = XInternAtom(dpy, "_OL_WT_CMD", False);
WT_NOTICE = XInternAtom(dpy, "_OL_WT_NOTICE", False);
WT_HELP = XInternAtom(dpy, "_OL_WT_HELP", False);
WT_OTHER = XInternAtom(dpy, "_OL_WT_OTHER", False);
MT_FULL = XInternAtom(dpy, "_OL_MENU_FULL", False);
MT_LIMITED = XInternAtom(dpy, "_OL_MENU_LIMITED", False);
MT_NONE = XInternAtom(dpy, "_OL_NONE", False);
}
/* get attributes */
if (!getWindowHints(wwin->client_win, &hints) ||
!(hints.flags & OL_WINTYPE)) {
decorations = OL_DECORATION_CLOSEBUTTON|OL_DECORATION_RESIZEABLE
|OL_DECORATION_HEADER|OL_DECORATION_ICONNAME;
menuType = MT_FULL;
} else {
if (hints.winType == WT_BASE) {
decorations = OL_DECORATION_CLOSEBUTTON|OL_DECORATION_RESIZEABLE
|OL_DECORATION_HEADER|OL_DECORATION_ICONNAME;
menuType = MT_FULL;
} else if (hints.winType == WT_CMD) {
decorations = OL_DECORATION_PUSHPIN|OL_DECORATION_RESIZEABLE
|OL_DECORATION_HEADER|OL_DECORATION_ICONNAME;
menuType = MT_LIMITED;
} else if (hints.winType == WT_NOTICE) {
decorations = OL_DECORATION_ICONNAME;
menuType = MT_NONE;
} else if (hints.winType == WT_HELP) {
decorations = OL_DECORATION_PUSHPIN|OL_DECORATION_HEADER
|OL_DECORATION_ICONNAME|OL_DECORATION_WARPTOPIN;
menuType = MT_LIMITED;
} else if (hints.winType == WT_OTHER) {
decorations = OL_DECORATION_ICONNAME;
menuType = MT_NONE;
if (hints.flags & OL_MENUTYPE) {
menuType = hints.menuType;
}
}
if (hints.flags & OL_PINSTATE) {
pinInitState = hints.pinInitState;
} else {
pinInitState = OL_PIN_OUT;
}
}
/* mask attributes with decoration hints */
applyDecorationHints(wwin->client_win, &decoration);
if ((decoration & OL_DECORATION_CLOSEBUTTON)
&& (decoration & OL_DECORATION_PUSHPIN))
decoration &= ~OL_DECORATION_CLOSEBUTTON;
if (!(decoration & OL_DECORATION_PUSHPIN))
decoration &= ~OL_DECORATION_WARPTOPIN;
/* map the hints to our attributes */
if (menuType == MT_FULL)
wwin->flags.olwm_limit_menu = 0;
else
wwin->flags.olwm_limit_menu = 1;
/*
* Emulate olwm pushpin.
* If the initial state of the pin is in, then put the normal close
* button. If not, make the close button different and when the
* user moves the window or clicks in the close button, turn it
* into a normal close button.
*/
if ((decoration & OL_DECORATION_PUSHPIN) && pinInitState==OL_PIN_OUT) {
wwin->flags.olwm_push_pin = 1;
}
}
#endif
+31
View File
@@ -0,0 +1,31 @@
/*
* openlook.h - OPEN LOOK (tm) compatibility stuff
*
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef _OPENLOOK_H_
#define _OPENLOOK_H_
#endif
+82 -100
View File
@@ -41,8 +41,11 @@
extern WPreferences wPreferences;
#define X_ORIGIN wPreferences.window_place_origin.x
#define Y_ORIGIN wPreferences.window_place_origin.y
#define X_ORIGIN(scr) WMAX((scr)->totalUsableArea.x1,\
wPreferences.window_place_origin.x)
#define Y_ORIGIN(scr) WMAX((scr)->totalUsableArea.y1,\
wPreferences.window_place_origin.y)
/*
@@ -74,7 +77,7 @@ iconPosition(WCoreWindow *wcore, int sx1, int sy1, int sx2, int sy2,
ok = 1;
} else if (wcore->descriptor.parent_type == WCLASS_MINIWINDOW &&
(((WIcon*)parent)->owner->frame->workspace==workspace
|| ((WIcon*)parent)->owner->window_flags.omnipresent
|| IS_OMNIPRESENT(((WIcon*)parent)->owner)
|| wPreferences.sticky_icons)
&& !((WIcon*)parent)->owner->flags.hidden) {
@@ -237,84 +240,89 @@ PlaceIcon(WScreen *scr, int *x_ret, int *y_ret)
static int
static Bool
smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height)
unsigned int width, unsigned int height, int tryCount)
{
WScreen *scr = wwin->screen_ptr;
int test_x = 0, test_y = Y_ORIGIN;
int test_x = 0, test_y = Y_ORIGIN(scr);
int loc_ok = False, tw,tx,ty,th;
int swidth, sx;
WWindow *test_window;
int extra_height;
WArea usableArea = scr->totalUsableArea;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
else
extra_height = 24; /* random value */
swidth = scr->scr_width;
sx = X_ORIGIN;
if (scr->dock && !scr->dock->lowered) {
if (scr->dock->on_right_side)
swidth -= wPreferences.icon_size + DOCK_EXTRA_SPACE;
else if (X_ORIGIN < wPreferences.icon_size + DOCK_EXTRA_SPACE)
sx += wPreferences.icon_size + DOCK_EXTRA_SPACE - X_ORIGIN;
}
swidth = usableArea.x2-usableArea.x1;
sx = X_ORIGIN(scr);
/* this was based on fvwm2's smart placement */
height += extra_height;
while (((test_y + height) < (scr->scr_height)) && (!loc_ok)) {
test_x = sx;
while (((test_x + width) < swidth) && (!loc_ok)) {
loc_ok = True;
test_window = scr->focused_window;
while ((test_window != (WWindow *) 0) && (loc_ok == True)) {
while ((test_window != NULL) && (loc_ok == True)) {
if (test_window->frame->core->stacking->window_level
< WMNormalLevel && tryCount > 0) {
test_window = test_window->next;
continue;
}
tw = test_window->client.width;
if (test_window->flags.shaded)
th = test_window->frame->top_width;
else
th = test_window->client.height+extra_height;
th = test_window->client.height + extra_height;
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)))) {
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 != (WWindow *) 0) && (loc_ok == True)) {
while ((test_window != NULL) && (loc_ok == True)) {
if (test_window->frame->core->stacking->window_level
< WMNormalLevel && tryCount > 0) {
test_window = test_window->prev;
continue;
}
tw = test_window->client.width;
if (test_window->flags.shaded)
th = test_window->frame->top_width;
else
th = test_window->client.height+extra_height;
th = test_window->client.height + extra_height;
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)))) {
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;
}
@@ -338,31 +346,21 @@ cascadeWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, int h)
{
unsigned int extra_height;
unsigned int scr_width;
int xoffset = 0;
scr_width = scr->scr_width;
if (scr->dock && !scr->dock->lowered) {
if (scr->dock->on_right_side) {
scr_width -= wPreferences.icon_size;
} else {
xoffset = wPreferences.icon_size;
}
}
WArea usableArea = scr->totalUsableArea;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
else
extra_height = 24; /* random value */
*x_ret = h * scr->cascade_index + X_ORIGIN;
*y_ret = h * scr->cascade_index + Y_ORIGIN;
*x_ret = h * scr->cascade_index + X_ORIGIN(scr);
*y_ret = h * scr->cascade_index + Y_ORIGIN(scr);
height += extra_height;
if (width + *x_ret > scr_width || height + *y_ret > scr->scr_height) {
if (width + *x_ret > usableArea.x2 || height + *y_ret > usableArea.y2) {
scr->cascade_index = 0;
*x_ret = h*scr->cascade_index + X_ORIGIN;
*y_ret = h*scr->cascade_index + Y_ORIGIN;
*x_ret = X_ORIGIN(scr);
*y_ret = Y_ORIGIN(scr);
}
}
@@ -380,8 +378,11 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
break;
case WPM_SMART:
if (smartPlaceWindow(wwin, x_ret, y_ret, width, height))
break;
if (smartPlaceWindow(wwin, x_ret, y_ret, width, height, 0)) {
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 */
@@ -394,45 +395,26 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
if (wPreferences.window_placement == WPM_CASCADE)
scr->cascade_index++;
if (scr->dock && !scr->dock->lowered) {
int x2;
x2 = *x_ret + width;
if (scr->dock->on_right_side
&& x2 > scr->scr_width - wPreferences.icon_size -
DOCK_EXTRA_SPACE)
*x_ret = scr->scr_width - width
- wPreferences.icon_size - DOCK_EXTRA_SPACE;
else if (!scr->dock->on_right_side &&
X_ORIGIN < wPreferences.icon_size + DOCK_EXTRA_SPACE)
*x_ret += wPreferences.icon_size + DOCK_EXTRA_SPACE - X_ORIGIN;
}
break;
case WPM_RANDOM:
{
int w, h;
w = (scr->scr_width - width);
h = (scr->scr_height - height);
int w, h, extra_height;
WArea usableArea = scr->totalUsableArea;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
else
extra_height = 24; /* random value */
//w = ((usableArea.x2-usableArea.x1) - width);
//h = ((usableArea.y2-usableArea.y1) - height - extra_height);
w = ((usableArea.x2-X_ORIGIN(scr)) - width);
h = ((usableArea.y2-Y_ORIGIN(scr)) - height - extra_height);
if (w<1) w = 1;
if (h<1) h = 1;
*x_ret = rand()%w;
*y_ret = rand()%h;
if (scr->dock && !scr->dock->lowered) {
int x2;
x2 = *x_ret + width;
if (scr->dock->on_right_side
&& x2 > scr->scr_width - wPreferences.icon_size -
DOCK_EXTRA_SPACE)
*x_ret = scr->scr_width - width
- wPreferences.icon_size - DOCK_EXTRA_SPACE;
else if (!scr->dock->on_right_side
&& *x_ret < wPreferences.icon_size)
*x_ret = wPreferences.icon_size + DOCK_EXTRA_SPACE;
}
*x_ret = X_ORIGIN(scr) + rand()%w;
*y_ret = Y_ORIGIN(scr) + rand()%h;
}
break;
@@ -444,15 +426,15 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
#endif
}
if (*x_ret < 0)
*x_ret = 0;
else if (*x_ret + width > scr->scr_width)
if (*x_ret + width > scr->scr_width)
*x_ret = scr->scr_width - width;
if (*y_ret < 0)
*y_ret = 0;
else if (*y_ret + height > scr->scr_height)
if (*x_ret < 0)
*x_ret = 0;
if (*y_ret + height > scr->scr_height)
*y_ret = scr->scr_height - height;
if (*y_ret < 0)
*y_ret = 0;
}
+49 -68
View File
@@ -30,9 +30,6 @@
#include "WindowMaker.h"
#include "window.h"
#include "GNUstep.h"
#ifdef MWM_HINTS
# include "motif.h"
#endif
/* atoms */
@@ -94,6 +91,7 @@ PropGetWMClass(Window window, char **wm_class, char **wm_instance)
return True;
}
void
PropGetProtocols(Window window, WProtocols *prots)
{
@@ -118,22 +116,50 @@ PropGetProtocols(Window window, WProtocols *prots)
}
int
PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
unsigned char*
PropGetCheckProperty(Window window, Atom hint, Atom type, int format,
int count, int *retCount)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned long *data;
unsigned char *data;
int tmp;
if (count <= 0)
tmp = 0xffffff;
if (XGetWindowProperty(dpy, window, _XA_GNUSTEP_WM_ATTR, 0, 9,
False, _XA_GNUSTEP_WM_ATTR,
if (XGetWindowProperty(dpy, window, hint, 0, tmp, False, type,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data)!=Success || !data)
return False;
if (type_ret!=_XA_GNUSTEP_WM_ATTR || !data || fmt_ret!=32)
return False;
return NULL;
if ((type!=AnyPropertyType && type!=type_ret)
|| (count > 0 && nitems_ret != count)
|| (format != 0 && format != fmt_ret)) {
XFree(data);
return NULL;
}
if (retCount)
*retCount = nitems_ret;
return data;
}
int
PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
{
unsigned long *data;
data = (unsigned long*)PropGetCheckProperty(window, _XA_GNUSTEP_WM_ATTR,
_XA_GNUSTEP_WM_ATTR, 32, 9,
NULL);
if (!data)
return False;
*attr = malloc(sizeof(GNUstepWMAttributes));
if (!*attr) {
@@ -156,49 +182,6 @@ PropGetGNUstepWMAttr(Window window, GNUstepWMAttributes **attr)
}
#ifdef MWM_HINTS
int
PropGetMotifWMHints(Window window, MWMHints **mwmhints)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned long *data;
if (XGetWindowProperty(dpy, window, _XA_MOTIF_WM_HINTS, 0,
PROP_MWM_HINTS_ELEMENTS,
False, _XA_MOTIF_WM_HINTS,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data)!=Success)
return 0;
if (type_ret!=_XA_MOTIF_WM_HINTS || fmt_ret!=32
|| nitems_ret!=PROP_MWM_HINTS_ELEMENTS || !data)
return 0;
*mwmhints = malloc(sizeof(MWMHints));
if (!*mwmhints) {
XFree(data);
return 0;
}
(*mwmhints)->flags = data[0];
(*mwmhints)->functions = data[1];
(*mwmhints)->decorations = data[2];
(*mwmhints)->inputMode = data[3];
XFree(data);
if (type_ret==_XA_MOTIF_WM_HINTS)
return 1;
else
return 0;
}
#endif /* MWM_HINTS */
void
PropSetWMakerProtocols(Window root)
@@ -217,27 +200,19 @@ PropSetWMakerProtocols(Window root)
Window
PropGetClientLeader(Window window)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
Window *win;
Window leader;
if (XGetWindowProperty(dpy, window, _XA_WM_CLIENT_LEADER, 0, 1,
False, AnyPropertyType,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char**)&win)!=Success || !win)
return None;
win = (Window*)PropGetCheckProperty(window, _XA_WM_CLIENT_LEADER,
XA_WINDOW, 32, 1, NULL);
if (!win)
return None;
leader = (Window)*win;
XFree(win);
if (type_ret == XA_WINDOW && fmt_ret == 32 && nitems_ret == 1
&& bytes_after_ret == 0)
return leader;
else
return None;
return leader;
}
@@ -319,4 +294,10 @@ PropCleanUp(Window root)
XDeleteProperty(dpy, root, _XA_WINDOWMAKER_WM_PROTOCOLS);
XDeleteProperty(dpy, root, XA_WM_ICON_SIZE);
#ifdef KWM_HINTS
XDeleteProperty(dpy, root, XInternAtom(dpy, "KWM_RUNNING", False));
#endif
}
+3 -7
View File
@@ -25,9 +25,8 @@
#include "GNUstep.h"
#ifdef MWM_HINTS
# include "motif.h"
#endif
unsigned char* PropGetCheckProperty(Window window, Atom hint, Atom type,
int format, int count, int *retCount);
int PropGetNormalHints(Window window, XSizeHints *size_hints, int *pre_iccm);
@@ -39,14 +38,11 @@ void PropWriteGNUstepWMAttr(Window window, GNUstepWMAttributes *attr);
void PropSetWMakerProtocols(Window root);
void PropCleanUp(Window root);
#ifdef MWM_HINTS
int PropGetMotifWMHints(Window window, MWMHints **mwmhints);
#endif
Window PropGetClientLeader(Window window);
#ifdef R6SM
char *PropGetClientID(Window window);
#endif
#endif
+95 -91
View File
@@ -22,6 +22,8 @@
#include "wconfig.h"
#ifndef LITE
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -59,7 +61,7 @@ extern char *Locale;
extern WDDomain *WDRootMenu;
extern wCursor[WCUR_LAST];
extern Cursor wCursor[WCUR_LAST];
extern Time LastTimestamp;
@@ -152,19 +154,6 @@ static void
execCommand(WMenu *menu, WMenuEntry *entry)
{
char *cmdline;
static char *shell = NULL;
/*
* This have a problem: if the shell is tcsh (not sure about others)
* and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
* will block and the command will not be executed.
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
*/
shell = "/bin/sh";
cmdline = ExpandOptions(menu->frame->screen_ptr, (char*)entry->clientdata);
@@ -174,26 +163,7 @@ execCommand(WMenu *menu, WMenuEntry *entry)
XSync(dpy, 0);
if (cmdline) {
/* We should not use ParseCommand() here, because it does not handle
* correctly '~/' expansion and '>' redirection.
* While we can do '~/' expansion ourselves, we can do nothing about
* '>' redirection.
* So we better let /bin/sh to do that for us. Dan.
* Ok. -Alfredo
*/
if (fork()==0) {
SetupEnvironment(menu->frame->screen_ptr);
CloseDescriptors();
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl(shell, shell, "-c", cmdline, NULL);
wsyserror("could not exec %s -c %s\n", shell, cmdline);
Exit(-1);
}
ExecuteShellCommand(menu->frame->screen_ptr, cmdline);
free(cmdline);
}
XUngrabPointer(dpy, CurrentTime);
@@ -215,22 +185,10 @@ exitCommand(WMenu *menu, WMenuEntry *entry)
|| wMessageDialog(menu->frame->screen_ptr, _("Exit"),
_("Exit window manager?"),
_("Exit"), _("Cancel"), NULL)==WAPRDefault) {
int i;
#ifdef DEBUG
printf("Exiting WindowMaker.\n");
#endif
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr)
wScreenSaveState(scr);
}
RestoreDesktop(NULL);
ExecExitScript();
Exit(0);
Shutdown(WSExitMode);
}
inside = 0;
}
@@ -241,7 +199,6 @@ shutdownCommand(WMenu *menu, WMenuEntry *entry)
{
static int inside = 0;
int result;
int i;
/* prevent reentrant calls */
if (inside)
@@ -288,21 +245,11 @@ shutdownCommand(WMenu *menu, WMenuEntry *entry)
if (result!=R_CANCEL) {
#ifdef R6SM
if (result == R_CLOSE) {
wSessionRequestShutdown();
Shutdown(WSLogoutMode);
} else
#endif /* R6SM */
{
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr)
wScreenSaveState(scr);
}
WipeDesktop(NULL);
ExecExitScript();
Exit(0);
Shutdown(WSKillMode);
}
}
#undef R_CLOSE
@@ -315,16 +262,7 @@ shutdownCommand(WMenu *menu, WMenuEntry *entry)
static void
restartCommand(WMenu *menu, WMenuEntry *entry)
{
int i;
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr)
wScreenSaveState(scr);
}
RestoreDesktop(NULL);
Shutdown(WSRestartPreparationMode);
Restart((char*)entry->clientdata);
}
@@ -457,7 +395,7 @@ rebindKeygrabs(WScreen *scr)
while (wwin!=NULL) {
XUngrabKey(dpy, AnyKey, AnyModifier, wwin->frame->core->window);
if (!wwin->window_flags.no_bind_keys) {
if (!WFLAGP(wwin, no_bind_keys)) {
wWindowSetKeyGrabs(wwin);
}
wwin = wwin->prev;
@@ -509,8 +447,7 @@ addShortcut(char *file, char *shortcutDefinition, WMenu *menu,
*k = 0;
mod = wXModifierFromKey(b);
if (mod<0) {
wwarning(_("%s:invalid key modifier \"%s\""), file,
shortcutDefinition);
wwarning(_("%s:invalid key modifier \"%s\""), file, b);
free(ptr);
return False;
}
@@ -692,7 +629,13 @@ constructMenu(WMenu *menu, WMenuEntry *entry)
i=0;
while(path[i] != NULL) {
char *tmp;
Bool statted = False;
if (strcmp(path[i], "-noext")==0) {
i++;
continue;
}
tmp = wexpandpath(path[i]);
free(path[i]);
path[i] = tmp;
@@ -709,12 +652,14 @@ constructMenu(WMenu *menu, WMenuEntry *entry)
if (i>2) {
lpath[strlen(lpath)-(i-2)]=0;
if (stat(lpath, &stat_buf)==0) {
statted = True;
free(path[i]);
path[i] = lpath;
lpath = NULL;
}
}
} else {
statted = True;
free(path[i]);
path[i] = lpath;
lpath = NULL;
@@ -726,7 +671,7 @@ constructMenu(WMenu *menu, WMenuEntry *entry)
lpath = NULL;
}
if (stat(path[i], &stat_buf)==0) {
if (statted || stat(path[i], &stat_buf)==0) {
if (last < stat_buf.st_mtime)
last = stat_buf.st_mtime;
if (first<0)
@@ -740,7 +685,7 @@ constructMenu(WMenu *menu, WMenuEntry *entry)
}
if (first < 0) {
wsyserror(_("%s:could not stat menu :%s"), "OPEN_MENU",
wsyserror(_("%s:could not stat menu:%s"), "OPEN_MENU",
(char*)entry->clientdata);
goto finish;
}
@@ -751,7 +696,7 @@ constructMenu(WMenu *menu, WMenuEntry *entry)
if (S_ISDIR(stat_buf.st_mode)) {
/* menu directory */
submenu = readMenuDirectory(menu->frame->screen_ptr,
entry->text, &path[first], cmd);
entry->text, path, cmd);
if (submenu)
submenu->timestamp = last;
} else if (S_ISREG(stat_buf.st_mode)) {
@@ -801,7 +746,7 @@ addWorkspaceMenu(WScreen *scr, WMenu *menu, char *title)
wsmenu = wWorkspaceMenuMake(scr, True);
scr->workspace_menu = wsmenu;
entry=wMenuAddCallback(menu, title, NULL, NULL);
entry = wMenuAddCallback(menu, title, NULL, NULL);
wMenuEntrySetCascade(menu, entry, wsmenu);
wWorkspaceMenuUpdate(scr, wsmenu);
@@ -1302,6 +1247,25 @@ myCompare(dir_data *d1, dir_data *d2)
/************ Menu Configuration From Directory *************/
static Bool
isFilePackage(char *file)
{
int l;
/* check if the extension indicates this file is a
* file package. For now, only recognize .themed */
l = strlen(file);
if (l > 7 && strcmp(&(file[l-7]), ".themed")==0) {
return True;
} else {
return False;
}
}
static WMenu*
readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
{
@@ -1313,9 +1277,16 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
LinkedList *dirs = NULL, *files = NULL;
int length, i, have_space=0;
dir_data *data;
int stripExtension = 0;
i=0;
while (path[i]!=NULL) {
if (strcmp(path[i], "-noext")==0) {
stripExtension = 1;
i++;
continue;
}
dir = opendir(path[i]);
if (!dir) {
i++;
@@ -1346,32 +1317,36 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
wsyserror(_("%s:could not stat file \"%s\" in menu directory"),
path[i], dentry->d_name);
} else {
data = (dir_data*) wmalloc(sizeof(dir_data));
data->name = wstrdup(dentry->d_name);
data->index = i;
if (S_ISDIR(stat_buf.st_mode)) {
Bool isFilePack = False;
data = NULL;
if (S_ISDIR(stat_buf.st_mode)
&& !(isFilePack = isFilePackage(dentry->d_name))) {
/* access always returns success for user root */
if (access(buffer, X_OK)==0) {
/* Directory is accesible. Add to directory list */
data = (dir_data*) wmalloc(sizeof(dir_data));
data->name = wstrdup(dentry->d_name);
data->index = i;
list_insert_sorted(data, &dirs, (int(*)())myCompare);
data = NULL;
}
} else if (S_ISREG(stat_buf.st_mode)) {
} else if (S_ISREG(stat_buf.st_mode) || isFilePack) {
/* Hack because access always returns X_OK success for user root */
#define S_IXANY (S_IXUSR | S_IXGRP | S_IXOTH)
if ((command!=NULL && access(buffer, R_OK)==0) ||
(command==NULL && access(buffer, X_OK)==0 &&
(stat_buf.st_mode & S_IXANY))) {
data = (dir_data*) wmalloc(sizeof(dir_data));
data->name = wstrdup(dentry->d_name);
data->index = i;
list_insert_sorted(data, &files, (int(*)())myCompare);
data = NULL;
}
}
if (data!=NULL) {
if (data->name)
free(data->name);
free(data);
data = NULL;
}
}
free(buffer);
}
@@ -1467,6 +1442,11 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
if (have_space)
strcat(buffer, "\"");
if (stripExtension) {
char *ptr = strrchr(f->name, '.');
if (ptr && ptr!=f->name)
*ptr = 0;
}
addMenuEntry(menu, f->name, NULL, "EXEC", buffer, path[f->index]);
free(buffer);
@@ -1491,6 +1471,8 @@ makeDefaultMenu(WScreen *scr)
menu = wMenuCreate(scr, _("Commands"), True);
wMenuAddCallback(menu, "XTerm", execCommand, "xterm");
wMenuAddCallback(menu, "rxvt", execCommand, "rxvt");
wMenuAddCallback(menu, _("Restart"), restartCommand, NULL);
wMenuAddCallback(menu, _("Exit..."), exitCommand, NULL);
return menu;
}
@@ -1615,9 +1597,30 @@ configureMenu(WScreen *scr, proplist_t definition)
menu = wMenuCreate(scr, mtitle, False);
menu->on_destroy = removeShortcutsForMenu;
#ifdef GLOBAL_SUBMENU_FILE
{
WMenu *submenu;
WMenuEntry *mentry;
submenu = readMenuFile(scr, GLOBAL_SUBMENU_FILE);
if (submenu) {
mentry = wMenuAddCallback(menu, submenu->frame->title, NULL, NULL);
wMenuEntrySetCascade(menu, mentry, submenu);
}
}
#endif
for (i=1; i<count; i++) {
elem = PLGetArrayElement(definition, i);
#if 0
if (PLIsString(elem)) {
char *file;
file = PLGetString(elem);
}
#endif
if (!PLIsArray(elem) || PLGetNumberOfElements(elem) < 2)
goto error;
@@ -1766,3 +1769,4 @@ OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
rebindKeygrabs(scr);
}
#endif /* !LITE */
+163 -5
View File
@@ -48,17 +48,28 @@
#include "workspace.h"
#include "session.h"
#include "balloon.h"
#ifdef KWM_HINTS
#include "kwm.h"
#endif
#ifdef GNOME_STUFF
#include "gnome.h"
#endif
#include <proplist.h>
#include "defaults.h"
#ifdef LITE
#define EVENT_MASK (LeaveWindowMask|EnterWindowMask|PropertyChangeMask\
|SubstructureNotifyMask|PointerMotionMask \
|SubstructureRedirectMask|KeyPressMask|KeyReleaseMask)
#else
#define EVENT_MASK (LeaveWindowMask|EnterWindowMask|PropertyChangeMask\
|SubstructureNotifyMask|PointerMotionMask \
|SubstructureRedirectMask|ButtonPressMask|ButtonReleaseMask\
|KeyPressMask|KeyReleaseMask)
#endif
/**** Global variables ****/
@@ -559,13 +570,20 @@ wScreenInit(int screen_number)
scr->scr_width = WidthOfScreen(ScreenOfDisplay(dpy, screen_number));
scr->scr_height = HeightOfScreen(ScreenOfDisplay(dpy, screen_number));
scr->usableArea.x2 = scr->scr_width;
scr->usableArea.y2 = scr->scr_height;
scr->totalUsableArea.x2 = scr->scr_width;
scr->totalUsableArea.y2 = scr->scr_height;
CantManageScreen = 0;
oldHandler = XSetErrorHandler((XErrorHandler)alreadyRunningError);
event_mask = EVENT_MASK;
if (wPreferences.disable_root_mouse)
if (wPreferences.disable_root_mouse) {
event_mask &= ~(ButtonPressMask|ButtonReleaseMask);
}
XSelectInput(dpy, scr->root_win, event_mask);
XSync(dpy, False);
@@ -619,9 +637,15 @@ wScreenInit(int screen_number)
scr->white_pixel = scr->rcontext->white;
/* create screen descriptor for WINGs */
scr->wmscreen = WMCreateScreenWithRContext(dpy, screen_number,
scr->wmscreen = WMCreateScreenWithRContext(dpy, screen_number,
scr->rcontext);
if (!scr->wmscreen) {
wfatal(_("could not do initialization of WINGs widget set"));
return NULL;
}
color = WMGrayColor(scr->wmscreen);
scr->light_pixel = WMColorPixel(color);
WMReleaseColor(color);
@@ -643,11 +667,19 @@ wScreenInit(int screen_number)
/* read defaults for this screen */
wReadDefaults(scr, WDWindowMaker->dictionary);
createInternalWindows(scr);
#ifdef KWM_HINTS
wKWMInitStuff(scr);
#endif
#ifdef GNOME_STUFF
wGNOMEInitStuff(scr);
#endif
/* create initial workspace */
wWorkspaceNew(scr);
createInternalWindows(scr);
/* create shared pixmaps */
createPixmaps(scr);
@@ -668,14 +700,137 @@ wScreenInit(int screen_number)
wBalloonInitialize(scr);
#endif
wScreenUpdateUsableArea(scr);
#ifndef LITE
/* kluge to load menu configurations at startup */
OpenRootMenu(scr, -10000, -10000, False);
wMenuUnmap(scr->root_menu);
#endif
return scr;
}
void
wScreenUpdateUsableArea(WScreen *scr)
{
#ifdef GNOME_STUFF
WReservedArea *area;
#endif
scr->totalUsableArea = scr->usableArea;
if (scr->dock && (!scr->dock->lowered
|| wPreferences.no_window_over_dock)) {
int offset = wPreferences.icon_size + DOCK_EXTRA_SPACE;
if (scr->dock->on_right_side) {
scr->totalUsableArea.x2 = WMIN(scr->totalUsableArea.x2,
scr->scr_width - offset);
} else {
scr->totalUsableArea.x1 = WMAX(scr->totalUsableArea.x1, offset);
}
}
if (wPreferences.no_window_over_icons) {
if (wPreferences.icon_yard & IY_VERT) {
if (!(wPreferences.icon_yard & IY_RIGHT)) {
scr->totalUsableArea.x1 += wPreferences.icon_size;
} else {
scr->totalUsableArea.x2 -= wPreferences.icon_size;
}
} else {
if (wPreferences.icon_yard & IY_TOP) {
scr->totalUsableArea.y1 += wPreferences.icon_size;
} else {
scr->totalUsableArea.y2 -= wPreferences.icon_size;
}
}
}
#ifdef KWM_HINTS
{
WArea area;
if (wKWMGetUsableArea(scr, &area)) {
scr->totalUsableArea.x1 = WMAX(scr->totalUsableArea.x1, area.x1);
scr->totalUsableArea.y1 = WMAX(scr->totalUsableArea.y1, area.y1);
scr->totalUsableArea.x2 = WMIN(scr->totalUsableArea.x2, area.x2);
scr->totalUsableArea.y2 = WMIN(scr->totalUsableArea.y2, area.y2);
}
}
#endif
#ifdef GNOME_STUFF
area = scr->reservedAreas;
while (area) {
int th, bh;
int lw, rw;
int w, h;
w = area->area.x2 - area->area.x1;
h = area->area.y2 - area->area.y1;
th = area->area.y1;
bh = scr->scr_height - area->area.y2;
lw = area->area.x1;
rw = scr->scr_width - area->area.x2;
if (WMIN(th, bh) < WMIN(lw, rw)) {
/* horizontal */
if (th < bh) {
/* on top */
if (scr->totalUsableArea.y1 < area->area.y2)
scr->totalUsableArea.y1 = area->area.y2;
} else {
/* on bottom */
if (scr->totalUsableArea.y2 > area->area.y1)
scr->totalUsableArea.y2 = area->area.y1;
}
} else {
/* vertical */
if (lw < rw) {
/* on left */
if (scr->totalUsableArea.x1 < area->area.x2)
scr->totalUsableArea.x1 = area->area.x2;
} else {
/* on right */
if (scr->totalUsableArea.x2 > area->area.x1)
scr->totalUsableArea.x2 = area->area.x1;
}
}
area = area->next;
}
#endif /* GNOME_STUFF */
if (scr->totalUsableArea.x2 - scr->totalUsableArea.x1 < scr->scr_width/2) {
scr->totalUsableArea.x2 = scr->usableArea.x2;
scr->totalUsableArea.x1 = scr->usableArea.x1;
}
if (scr->totalUsableArea.y2 - scr->totalUsableArea.y1 < scr->scr_height/2) {
scr->totalUsableArea.y2 = scr->usableArea.y2;
scr->totalUsableArea.y1 = scr->usableArea.y1;
}
#ifdef KWM_HINTS
{
int i;
for (i = 0; i < scr->workspace_count; i++) {
wKWMSetUsableAreaHint(scr, i);
}
}
#endif
}
void
wScreenRestoreState(WScreen *scr)
{
@@ -713,6 +868,7 @@ wScreenRestoreState(WScreen *scr)
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
}
wScreenUpdateUsableArea(scr);
}
@@ -838,3 +994,5 @@ wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height)
return moved;
}
+46 -20
View File
@@ -43,17 +43,6 @@ typedef struct WFont {
short y;
} WFont;
#ifdef EXPERIMENTAL
typedef struct {
Pixmap pixmap; /* None means use pixel */
WMPixel pixel;
proplist_t spec; /* retained */
pid_t pid; /* If !=0, process ID of wmsetbg that
* is rendering the pixmap for this
* texture. Set to 0 when finishes */
} WWorkspaceTexture;
#endif /* EXPERIMENTAL */
#define WTB_LEFT 0
#define WTB_RIGHT 1
@@ -63,6 +52,16 @@ typedef struct {
#define WTB_PFOCUSED 4
#define WTB_MENU 6
#ifdef GNOME_STUFF
/* an area of the screen reserved by some window */
typedef struct WReservedArea {
WArea area;
Window window;
struct WReservedArea *next;
} WReservedArea;
#endif
/*
* each WScreen is saved into a context associated with it's root window
@@ -113,16 +112,24 @@ typedef struct _WScreen {
/* int window_level_count[MAX_WINDOW_LEVELS];*/
int window_count; /* number of windows in window_list */
#ifdef EXPERIMENTAL
WWorkspaceTexture *defaultTexture;
WWorkspaceTexture **wspaceTextures;
int wspaceTextureCount;
#endif /* EXPERIMENTAL */
int workspace_count; /* number of workspaces */
struct WWorkspace **workspaces; /* workspace array */
int current_workspace; /* current workspace number */
#ifdef GNOME_STUFF
WReservedArea *reservedAreas; /* used to build totalUsableArea */
#endif
WArea usableArea; /* area of the workspace where
* we can put windows on, as defined
* by other clients (not us) */
WArea totalUsableArea; /* same as above, but including
* the dock and other stuff */
WMPixel black_pixel;
WMPixel white_pixel;
@@ -190,9 +197,11 @@ typedef struct _WScreen {
struct WPixmap *menu_shade_indicator; /* for shaded window */
int app_menu_x, app_menu_y; /* position for application menus */
#ifndef LITE
struct WMenu *root_menu; /* root window menu */
struct WMenu *workspace_menu; /* workspace operation */
struct WMenu *switch_menu; /* window list menu */
#endif
struct WMenu *workspace_menu; /* workspace operation */
struct WMenu *window_menu; /* window command menu */
struct WMenu *icon_menu; /* icon/appicon menu */
struct WMenu *workspace_submenu; /* workspace list for window_menu */
@@ -213,6 +222,7 @@ typedef struct _WScreen {
* window resize, move etc. */
unsigned int geometry_display_width;
unsigned int geometry_display_height;
int keymove_tick;
struct RContext *rcontext;
@@ -246,12 +256,19 @@ typedef struct _WScreen {
* raised */
/* for window shortcuts */
struct WWindow *shortcutWindow[4];
struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
#ifdef XDE_DND
char *xdestring;
#endif
#ifdef KWM_HINTS
Window kwm_dock;
#endif
int helper_fd;
pid_t helper_pid;
struct {
unsigned int startup:1; /* during window manager startup */
unsigned int regenerate_icon_textures:1;
@@ -262,8 +279,13 @@ typedef struct _WScreen {
unsigned int supports_tiff:1;
unsigned int clip_balloon_mapped:1;
unsigned int next_click_is_not_double:1;
unsigned int backimage_helper_launched:1;
/* some client has issued a WM_COLORMAP_NOTIFY */
unsigned int colormap_stuff_blocked:1;
#ifdef KWM_HINTS
unsigned int kwm_syncing_name:1;
unsigned int kwm_syncing_count:1;
#endif
} flags;
} WScreen;
@@ -295,4 +317,8 @@ WScreen *wScreenWithNumber(int i);
WScreen *wScreenForRootWindow(Window window); /* window must be valid */
WScreen *wScreenForWindow(Window window); /* slower than above functions */
void wScreenFinish(WScreen *scr);
void wScreenUpdateUsableArea(WScreen *scr);
#endif
+141 -22
View File
@@ -254,7 +254,7 @@ wSessionSaveState(WScreen *scr)
WApplication *wapp=wApplicationOf(wwin->main_window);
if (wwin->transient_for==None && list_find(wapp_list, wapp)==NULL
&& !wwin->window_flags.dont_save_session) {
&& !WFLAGP(wwin, dont_save_session)) {
/* A entry for this application was not yet saved. Save one. */
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
list = PLAppendArrayElement(list, win_info);
@@ -313,8 +313,6 @@ execCommand(WScreen *scr, char *command, char *host)
SetupEnvironment(scr);
CloseDescriptors();
args = malloc(sizeof(char*)*(argc+1));
if (!args)
exit(111);
@@ -385,7 +383,6 @@ getWindowState(WScreen *scr, proplist_t win_state)
#define SAME(x, y) (((x) && (y) && !strcmp((x), (y))) || (!(x) && !(y)))
void
wSessionRestoreState(WScreen *scr)
{
@@ -570,16 +567,144 @@ wSessionRestoreLastWorkspace(WScreen *scr)
* WM_CLASSS.class
* WM_WINDOW_ROLE
* geometry
* (state array (miniaturized, shaded, etc))
* workspace
* wich dock
* state = (miniaturized, shaded, etc)
* attribute
* workspace #
* app state = (which dock, hidden)
* window shortcut #
*/
static proplist_t
makeAppState(WWindow *wwin)
{
WApplication *wapp;
proplist_t state;
WScreen *scr = wwin->screen_ptr;
state = PLMakeArrayWithElements(NULL, NULL);
wapp = wApplicationOf(wwin->main_window);
if (wapp) {
if (wapp->app_icon && wapp->app_icon->dock) {
if (wapp->app_icon->dock == scr->dock) {
PLAppendArrayElement(state, PLMakeString("Dock"));
} else {
int i;
for(i=0; i<scr->workspace_count; i++)
if(scr->workspaces[i]->clip == wapp->app_icon->dock)
break;
assert(i < scr->workspace_count);
PLAppendArrayElement(state,
PLMakeString(scr->workspaces[i]->name));
}
}
PLAppendArrayElement(state, PLMakeString(wapp->hidden ? "1" : "0"));
}
return state;
}
static proplist_t
makeAttributeState(WWindow *wwin)
{
unsigned int data1, data2;
char buffer[256];
#define W_FLAG(wwin, FLAG) ((wwin)->defined_user_flags.FLAG \
? (wwin)->user_flags.FLAG : -1)
sprintf(buffer, "%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
W_FLAG(no_titlebar),
W_FLAG(no_resizable),
W_FLAG(no_closable),
W_FLAG(no_miniaturizable),
W_FLAG(no_resizebar),
W_FLAG(no_close_button),
W_FLAG(no_miniaturize_button),
/*
W_FLAG(broken_close),
W_FLAG(kill_close),
*/
W_FLAG(no_shadeable),
W_FLAG(omnipresent),
W_FLAG(skip_window_list),
W_FLAG(floating),
W_FLAG(sunken),
W_FLAG(no_bind_keys),
W_FLAG(no_bind_mouse),
W_FLAG(no_hide_others),
W_FLAG(no_appicon),
W_FLAG(dont_move_off),
W_FLAG(no_focusable),
W_FLAG(always_user_icon),
W_FLAG(start_miniaturized),
W_FLAG(start_hidden),
W_FLAG(start_maximized),
W_FLAG(dont_save_session),
W_FLAG(emulate_appicon));
return PLMakeString(buffer);
}
static proplist_t
makeClientState(WWindow *wwin)
{
proplist_t key;
proplist_t state;
proplist_t tmp;
char *str;
char buffer[256];
int i;
state = PLMakeArrayWithElements(NULL, NULL);
/* spec */
PLAppendArrayElement(state, PLMakeString(wwin->wm_instance));
PLAppendArrayElement(state, PLMakeString(wwin->wm_class));
PLAppendArrayElement(state, PLMakeString(str));
/* geometry */
sprintf(buffer, "%i %i %i %i", wwin->frame_x, wwin->frame_y,
wwin->frame->core->width, wwin->frame->core->height);
PLAppendArrayElement(state, PLMakeString(buffer));
/* state */
sprintf(buffer, "%i %i %i", wwin->flags.miniaturized,
wwin->flags.shaded, wwin->flags.maximized);
PLAppendArrayElement(state, PLMakeString(buffer));
/* attributes */
PLAppendArrayElement(state, makeAttributeState(wwin));
/* workspace */
sprintf(buffer, "%i", wwin->frame->workspace);
PLAppendArrayElement(state, PLMakeString(buffer));
/* app state (repeated for all windows of the app) */
PLAppendArrayElement(state, makeAppState(wwin));
/* shortcuts */
tmp = PLMakeArrayWithElements(NULL, NULL);
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
if (scr->shortcutWindow[i] == wwin) {
sprintf(buffer, "%i", i);
PLAppendArrayElement(tmp, PLMakeString(buffer));
}
}
PLAppendArrayElement(state, tmp);
return state;
}
@@ -647,8 +772,8 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
* Format:
*
* state_file ::= dictionary with version_info ; state
* version_info ::= version = 1;
* state ::= state = array of screen_info
* version_info ::= 'version' = '1';
* state ::= 'state' = array of screen_info
* screen_info ::= array of (screen number, window_info, window_info, ...)
* window_info ::=
*/
@@ -680,7 +805,7 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
proplist_t statefile;
statefile = PLMakeDictionaryFromEntries(PLMakeString("Version"),
PLMakeString("1"),
PLMakeString("1.0"),
PLMakeString("Screens"),
state,
@@ -805,10 +930,7 @@ smDieProc(SmcConn smc_conn, SmPointer client_data)
wSessionDisconnectManager();
RestoreDesktop(NULL);
ExecExitScript();
Exit(0);
Shutdown(WSExitMode);
}
@@ -910,7 +1032,10 @@ wSessionConnectManager(char **argv, int argc)
/* check for session manager clients */
iceConn = SmcGetIceConnection(smcConn);
if (fcntl(IceConnectionNumber(iceConn), F_SETFD, FD_CLOEXEC) < 0) {
wsyserror("error setting close-on-exec flag for ICE connection");
}
sSMInputHandler = WMAddInputHandler(IceConnectionNumber(iceConn),
WIReadMask, iceMessageProc, iceConn);
@@ -960,12 +1085,6 @@ wSessionConnectManager(char **argv, int argc)
}
void
_wSessionCloseDescriptors(void)
{
if (sSMCConn)
close(IceConnectionNumber(SmcGetIceConnection(smcConn)));
}
void
wSessionDisconnectManager(void)
+104 -27
View File
@@ -22,6 +22,8 @@
#include "wconfig.h"
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -33,12 +35,106 @@
#include "funcs.h"
#include "properties.h"
#include "winspector.h"
#ifdef KWM_HINTS
#include "kwm.h"
#endif
extern Atom _XA_WM_DELETE_WINDOW;
extern Time LastTimestamp;
extern int wScreenCount;
static void wipeDesktop(WScreen *scr);
/*
*----------------------------------------------------------------------
* Shutdown-
* Exits the window manager cleanly. If mode is WSLogoutMode,
* the whole X session will be closed, by killing all clients if
* no session manager is running or by asking a shutdown to
* it if its present.
*
*----------------------------------------------------------------------
*/
void
Shutdown(WShutdownMode mode)
{
int i;
switch (mode) {
case WSExitMode:
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr) {
if (scr->helper_pid)
kill(scr->helper_pid, SIGKILL);
#ifdef KWM_HINTS
wKWMShutdown(scr);
#endif
wScreenSaveState(scr);
RestoreDesktop(scr);
}
}
ExecExitScript();
Exit(0);
break;
case WSLogoutMode:
#ifdef R6SM
wSessionRequestShutdown();
break;
#else
/* fall through */
#endif
case WSKillMode:
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr) {
if (scr->helper_pid)
kill(scr->helper_pid, SIGKILL);
#ifdef KWM_HINTS
wKWMShutdown(scr);
#endif
wScreenSaveState(scr);
wipeDesktop(scr);
}
}
ExecExitScript();
Exit(0);
break;
case WSRestartPreparationMode:
for (i=0; i<wScreenCount; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
if (scr) {
if (scr->helper_pid)
kill(scr->helper_pid, SIGKILL);
#ifdef KWM_HINTS
wKWMShutdown(scr);
#endif
wScreenSaveState(scr);
RestoreDesktop(scr);
}
}
break;
}
}
/*
*----------------------------------------------------------------------
* RestoreDesktop--
@@ -56,18 +152,11 @@ RestoreDesktop(WScreen *scr)
{
int i;
if (!scr) {
int j;
for (j=0; j<wScreenCount; j++) {
WScreen *scr;
scr = wScreenWithNumber(j);
if (scr) {
RestoreDesktop(scr);
}
}
return;
if (scr->helper_pid) {
kill(scr->helper_pid, SIGTERM);
scr->helper_pid = 0;
}
XGrabServer(dpy);
wDestroyInspectorPanels();
@@ -106,7 +195,7 @@ RestoreDesktop(WScreen *scr)
/*
*----------------------------------------------------------------------
* WipeDesktop--
* wipeDesktop--
* Kills all windows in a screen. Send DeleteWindow to all windows
* that support it and KillClient on all windows that don't.
*
@@ -116,23 +205,11 @@ RestoreDesktop(WScreen *scr)
* TODO: change to XQueryTree()
*----------------------------------------------------------------------
*/
void
WipeDesktop(WScreen *scr)
static void
wipeDesktop(WScreen *scr)
{
WWindow *wwin;
if (!scr) {
int j;
for (j=0; j<wScreenCount; j++) {
WScreen *scr;
scr = wScreenWithNumber(j);
if (scr) {
WipeDesktop(scr);
}
}
return;
}
wwin = scr->focused_window;
while (wwin) {
if (wwin->protocols.DELETE_WINDOW)
+24 -5
View File
@@ -34,6 +34,9 @@
#include "actions.h"
#include "properties.h"
#include "stacking.h"
#ifdef KWM_HINTS
#include "kwm.h"
#endif
/*** Global Variables ***/
extern XContext wStackContext;
@@ -162,7 +165,7 @@ CommitStacking(WScreen *scr)
* Changes the stacking order of frame.
*----------------------------------------------------------------------
*/
static void
void
moveFrameToUnder(WCoreWindow *under, WCoreWindow *frame)
{
Window wins[2];
@@ -200,8 +203,8 @@ wRaiseFrame(WCoreWindow *frame)
/* insert on top of other windows */
while (wlist)
wlist = wlist->stacking->above;
wlist = wlist->stacking->above;
/* window is inserted before the point found */
if (wlist==NULL) {
/* top most window (last on the list) */
@@ -262,7 +265,7 @@ wRaiseFrame(WCoreWindow *frame)
/* can't optimize */
above = frame->screen_ptr->stacking_list[i];
while (above->stacking->under)
above = above->stacking->under;
above = above->stacking->under;
break;
}
}
@@ -274,6 +277,14 @@ wRaiseFrame(WCoreWindow *frame)
} else {
moveFrameToUnder(frame->stacking->above, frame);
}
#ifdef KWM_HINTS
{
WWindow *wwin = wWindowFor(frame->window);
if (wwin)
wKWMSendEventMessage(wwin, WKWMRaiseWindow);
}
#endif
}
void
@@ -362,6 +373,14 @@ wLowerFrame(WCoreWindow *frame)
} else {
moveFrameToUnder(frame->stacking->above, frame);
}
#ifdef KWM_HINTS
{
WWindow *wwin = wWindowFor(frame->window);
if (wwin)
wKWMSendEventMessage(wwin, WKWMLowerWindow);
}
#endif
}
@@ -500,7 +519,7 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
/*
*----------------------------------------------------------------------
* MoveInStackListUnder--
* Moves the frame under "prev".
* Moves the frame to under "prev".
*
* Returns:
* None
+27 -22
View File
@@ -42,9 +42,6 @@
#include "WindowMaker.h"
#include "GNUstep.h"
#ifdef MWM_HINTS
# include "motif.h"
#endif
#include "texture.h"
#include "screen.h"
#include "window.h"
@@ -64,6 +61,10 @@
#include "wmsound.h"
#endif
#ifdef KWM_HINTS
#include "kwm.h"
#endif
#if 0
#ifdef SYS_SIGLIST_DECLARED
extern const char * const sys_siglist[];
@@ -154,10 +155,6 @@ static void manageAllWindows();
extern void NotifyDeadProcess(pid_t pid, unsigned char status);
#ifdef R6SM
extern void _wSessionCloseDescriptors();
#endif
static int
catchXError(Display *dpy, XErrorEvent *error)
@@ -209,6 +206,7 @@ static int
handleXIO(Display *dpy)
{
Exit(0);
return 0;
}
@@ -289,15 +287,23 @@ handleSig(int sig)
wfatal(_("got signal %i\n"), sig);
#endif
if (sig==SIGSEGV || sig==SIGFPE || sig==SIGBUS || sig==SIGILL) {
if (sig==SIGSEGV || sig==SIGFPE || sig==SIGBUS || sig==SIGILL
|| sig==SIGABRT) {
if (already_crashed) {
wfatal(_("crashed while trying to do some post-crash cleanup. Aborting immediatelly."));
#ifndef NO_EMERGENCY_AUTORESTART
exit(1);
#else
abort();
#endif
}
already_crashed = 1;
dumpcore = 1;
wfatal(_("a fatal error has occured, probably due to a bug. "
"Please fill the included BUGFORM and report it."));
#ifndef NO_EMERGENCY_AUTORESTART
/* restart another window manager so that the X session doesn't
* go to space */
@@ -386,7 +392,7 @@ getOffendingModifiers()
int i;
XModifierKeymap *modmap;
KeyCode nlock, slock;
static mask_table[8] = {
static int mask_table[8] = {
ShiftMask,LockMask,ControlMask,Mod1Mask,
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
};
@@ -562,16 +568,6 @@ wScreenForWindow(Window window)
}
void
CloseDescriptors()
{
if (dpy)
close(ConnectionNumber(dpy));
#ifdef R6SM
_wSessionCloseDescriptors();
#endif
}
/*
*----------------------------------------------------------
@@ -621,9 +617,6 @@ StartUp(Bool defaultScreenOnly)
_XA_WM_COLORMAP_NOTIFY = XInternAtom(dpy, "WM_COLORMAP_NOTIFY", False);
_XA_GNUSTEP_WM_ATTR = XInternAtom(dpy, GNUSTEP_WM_ATTR_NAME, False);
#ifdef MWM_HINTS
_XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
#endif
_XA_WINDOWMAKER_MENU = XInternAtom(dpy, "_WINDOWMAKER_MENU", False);
_XA_WINDOWMAKER_STATE = XInternAtom(dpy, "_WINDOWMAKER_STATE", False);
@@ -675,6 +668,9 @@ StartUp(Bool defaultScreenOnly)
sigaction(SIGSEGV, &sig_action, NULL);
sigaction(SIGBUS, &sig_action, NULL);
sigaction(SIGFPE, &sig_action, NULL);
#ifndef NO_EMERGENCY_AUTORESTART
sigaction(SIGABRT, &sig_action, NULL);
#endif
/* Here we set SA_RESTART for safety, because SIGHUP may not be handled
* immediately.
@@ -814,6 +810,10 @@ StartUp(Bool defaultScreenOnly)
} else {
wSessionRestoreLastWorkspace(wScreen[j]);
}
#ifdef KWM_HINTS
wKWMSetInitializedHint(wScreen[j]);
#endif
}
if (wScreenCount == 0) {
@@ -914,6 +914,10 @@ manageAllWindows(WScreen *scr)
if (children[i]==None)
continue;
#ifdef KWM_HINTS
wKWMCheckModule(scr, children[i]);
#endif
XGetWindowAttributes(dpy, children[i], &wattribs);
state = getState(children[i]);
@@ -978,6 +982,7 @@ manageAllWindows(WScreen *scr)
XFree(children);
scr->flags.startup = 0;
scr->flags.startup2 = 1;
while (XPending(dpy)) {
XEvent ev;
WMNextEvent(dpy, &ev);
+87 -11
View File
@@ -23,6 +23,8 @@
#include "wconfig.h"
#ifndef LITE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -128,6 +130,37 @@ OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard)
}
}
static int
menuIndexForWindow(WMenu *menu, WWindow *wwin, int old_pos)
{
int idx;
if (menu->entry_no == 0)
return -1;
#define WS(i) ((WWindow*)menu->entries[i]->clientdata)->frame->workspace
if (old_pos >= 0) {
if (WS(old_pos) >= wwin->frame->workspace
&& (old_pos == 0 || WS(old_pos-1) <= wwin->frame->workspace)) {
return old_pos;
}
}
#undef WS
for (idx = 0; idx < menu->entry_no; idx++) {
WWindow *tw = (WWindow*)menu->entries[idx]->clientdata;
if (!IS_OMNIPRESENT(tw)
&& tw->frame->workspace > wwin->frame->workspace) {
break;
}
}
return idx;
}
/*
*
* Update switch menu
@@ -152,29 +185,38 @@ UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action)
* 2. When a window is destroyed.
*
* 3. When a window changes it's title.
* 4. When a window changes its workspace.
*/
if (action == ACTION_ADD) {
char *t;
if (wwin->flags.internal_window
|| wwin->window_flags.skip_window_list)
return;
int idx;
if (wwin->flags.internal_window || WFLAGP(wwin, skip_window_list))
return;
if (wwin->frame->title)
sprintf(title, "%s", wwin->frame->title);
else
sprintf(title, "%s", DEF_WINDOW_TITLE);
t = ShrinkString(scr->menu_entry_font, title, MAX_WINDOWLIST_WIDTH);
entry = wMenuAddCallback(switchmenu, t, focusWindow, wwin);
if (IS_OMNIPRESENT(wwin))
idx = -1;
else {
idx = menuIndexForWindow(switchmenu, wwin, -1);
}
entry = wMenuInsertCallback(switchmenu, idx, t, focusWindow, wwin);
free(t);
entry->flags.indicator = 1;
entry->rtext = wmalloc(MAX_WORKSPACENAME_WIDTH+8);
if (wwin->window_flags.omnipresent)
if (IS_OMNIPRESENT(wwin))
sprintf(entry->rtext, "[*]");
else
sprintf(entry->rtext, "[%s]",
scr->workspaces[wwin->frame->workspace]->name);
if (wwin->flags.hidden) {
entry->flags.indicator_type = MI_HIDDEN;
entry->flags.indicator_on = 1;
@@ -216,14 +258,45 @@ UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action)
t = ShrinkString(scr->menu_entry_font, title,
MAX_WINDOWLIST_WIDTH);
entry->text = t;
/* fall through to update workspace number */
wMenuRealize(switchmenu);
checkVisibility = 1;
break;
case ACTION_CHANGE_WORKSPACE:
if (entry->rtext) {
if (wwin->window_flags.omnipresent)
int idx = -1;
char *t, *rt;
int it, ion;
if (IS_OMNIPRESENT(wwin)) {
sprintf(entry->rtext, "[*]");
else
} else {
sprintf(entry->rtext, "[%s]",
scr->workspaces[wwin->frame->workspace]->name);
}
rt = entry->rtext;
entry->rtext = NULL;
t = entry->text;
entry->text = NULL;
it = entry->flags.indicator_type;
ion = entry->flags.indicator_on;
wMenuRemoveItem(switchmenu, i);
if (!IS_OMNIPRESENT(wwin) && idx < 0) {
idx = menuIndexForWindow(switchmenu, wwin, i);
}
entry = wMenuInsertCallback(switchmenu, idx, t,
focusWindow, wwin);
free(t);
entry->rtext = rt;
entry->flags.indicator = 1;
entry->flags.indicator_type = it;
entry->flags.indicator_on = ion;
}
wMenuRealize(switchmenu);
checkVisibility = 1;
@@ -280,8 +353,8 @@ UpdateSwitchMenuWorkspace(WScreen *scr, int workspace)
wwin = (WWindow*)menu->entries[i]->clientdata;
if (wwin->frame->workspace==workspace
&& !wwin->window_flags.omnipresent) {
if (wwin->window_flags.omnipresent)
&& !IS_OMNIPRESENT(wwin)) {
if (IS_OMNIPRESENT(wwin))
sprintf(menu->entries[i]->rtext, "[*]");
else
sprintf(menu->entries[i]->rtext, "[%s]",
@@ -292,3 +365,6 @@ UpdateSwitchMenuWorkspace(WScreen *scr, int workspace)
if (!menu->flags.realized)
wMenuRealize(menu);
}
#endif /* !LITE */
+100 -14
View File
@@ -145,7 +145,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
/*
* some stupid servers don't like white or black being freed...
*/
#define CANFREE(c) (c!=scr->black_pixel && c!=scr->white_pixel)
#define CANFREE(c) (c!=scr->black_pixel && c!=scr->white_pixel && c!=0)
switch (texture->any.type) {
case WTEX_SOLID:
XFreeGC(dpy, texture->solid.light_gc);
@@ -171,6 +171,12 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
}
free(texture->mgradient.colors);
break;
case WTEX_THGRADIENT:
case WTEX_TVGRADIENT:
case WTEX_TDGRADIENT:
RDestroyImage(texture->tgradient.pixmap);
break;
}
if (CANFREE(texture->any.color.pixel))
colors[count++] = texture->any.color.pixel;
@@ -179,6 +185,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
/* ignore error from buggy servers that don't know how
* to do reference counting for colors. */
XSync(dpy,0);
oldhandler = XSetErrorHandler(dummyErrorHandler);
XFreeColors(dpy, scr->colormap, colors, count, 0);
XSync(dpy,0);
@@ -192,7 +199,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
WTexGradient*
wTextureMakeGradient(WScreen *scr, int style, XColor *from, XColor *to)
wTextureMakeGradient(WScreen *scr, int style, RColor *from, RColor *to)
{
WTexGradient *texture;
XGCValues gcv;
@@ -206,9 +213,9 @@ wTextureMakeGradient(WScreen *scr, int style, XColor *from, XColor *to)
texture->color1 = *from;
texture->color2 = *to;
texture->normal.red = (from->red + to->red)/2;
texture->normal.green = (from->green + to->green)/2;
texture->normal.blue = (from->blue + to->blue)/2;
texture->normal.red = (from->red + to->red)<<7;
texture->normal.green = (from->green + to->green)<<7;
texture->normal.blue = (from->blue + to->blue)<<7;
XAllocColor(dpy, scr->w_colormap, &texture->normal);
gcv.background = gcv.foreground = texture->normal.pixel;
@@ -296,11 +303,62 @@ wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, XColor *color)
}
WTexTGradient*
wTextureMakeTGradient(WScreen *scr, int style, RColor *from, RColor *to,
char *pixmap_file, int opacity)
{
WTexTGradient *texture;
XGCValues gcv;
RImage *image;
char *file;
file = FindImage(wPreferences.pixmap_path, pixmap_file);
if (!file) {
wwarning(_("image file \"%s\" used as texture could not be found."),
pixmap_file);
return NULL;
}
image = RLoadImage(scr->rcontext, file, 0);
if (!image) {
wwarning(_("could not load texture pixmap \"%s\":%s"), file,
RMessageForError(RErrorCode));
free(file);
return NULL;
}
free(file);
texture = wmalloc(sizeof(WTexture));
memset(texture, 0, sizeof(WTexture));
texture->type = style;
texture->opacity = opacity;
texture->color1 = *from;
texture->color2 = *to;
texture->normal.red = (from->red + to->red)<<7;
texture->normal.green = (from->green + to->green)<<7;
texture->normal.blue = (from->blue + to->blue)<<7;
XAllocColor(dpy, scr->w_colormap, &texture->normal);
gcv.background = gcv.foreground = texture->normal.pixel;
gcv.graphics_exposures = False;
texture->normal_gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground
|GCGraphicsExposures, &gcv);
texture->pixmap = image;
return texture;
}
RImage*
wTextureRenderImage(WTexture *texture, int width, int height, int relief)
{
RImage *image;
RColor color1, color2;
RColor color1;
int d;
int subtype;
@@ -342,14 +400,9 @@ wTextureRenderImage(WTexture *texture, int width, int height, int relief)
case WTEX_DGRADIENT:
subtype = RGRD_DIAGONAL;
render_gradient:
color1.red = texture->gradient.color1.red >> 8;
color1.green = texture->gradient.color1.green >> 8;
color1.blue = texture->gradient.color1.blue >> 8;
color2.red = texture->gradient.color2.red >> 8;
color2.green = texture->gradient.color2.green >> 8;
color2.blue = texture->gradient.color2.blue >> 8;
image = RRenderGradient(width, height, &color1, &color2, subtype);
image = RRenderGradient(width, height, &texture->gradient.color1,
&texture->gradient.color2, subtype);
break;
case WTEX_MHGRADIENT:
@@ -367,10 +420,43 @@ wTextureRenderImage(WTexture *texture, int width, int height, int relief)
&(texture->mgradient.colors[1]),
subtype);
break;
case WTEX_THGRADIENT:
subtype = RGRD_HORIZONTAL;
goto render_tgradient;
case WTEX_TVGRADIENT:
subtype = RGRD_VERTICAL;
goto render_tgradient;
case WTEX_TDGRADIENT:
subtype = RGRD_DIAGONAL;
render_tgradient:
{
RImage *grad;
image = RMakeTiledImage(texture->tgradient.pixmap, width, height);
if (!image)
break;
grad = RRenderGradient(width, height, &texture->tgradient.color1,
&texture->tgradient.color2, subtype);
if (!grad) {
RDestroyImage(image);
image = NULL;
break;
}
RCombineImagesWithOpaqueness(image, grad,
texture->tgradient.opacity);
RDestroyImage(grad);
}
break;
default:
puts("ERROR in wTextureRenderImage()");
image = NULL;
break;
}
if (!image) {
+13 -16
View File
@@ -44,20 +44,15 @@
#define WTEX_MVGRADIENT ((1<<6)|WREL_BORDER_MASK)
#define WTEX_MDGRADIENT ((1<<7)|WREL_BORDER_MASK)
#define WTEX_PIXMAP (1<<8)
#define WTEX_THGRADIENT ((1<<9)|WREL_BORDER_MASK)
#define WTEX_TVGRADIENT ((1<<10)|WREL_BORDER_MASK)
#define WTEX_TDGRADIENT ((1<<11)|WREL_BORDER_MASK)
/* pixmap subtypes */
#define WTP_TILE 2
#define WTP_SCALE 4
#define WTP_CENTER 6
/*
* (solid <color>)
* (hgradient <color> <color>)
* (vgradient <color> <color>)
* (dgradient <color> <color>)
* (pixmap <file> <mode>)
*/
typedef struct {
short type; /* type of texture */
@@ -89,8 +84,8 @@ typedef struct WTexGradient {
XColor normal;
GC normal_gc;
XColor color1;
XColor color2;
RColor color1;
RColor color2;
} WTexGradient;
@@ -113,16 +108,17 @@ typedef struct WTexPixmap {
struct RImage *pixmap;
} WTexPixmap;
typedef struct WTexCompose {
typedef struct WTexTGradient {
short type;
char subtype;
XColor normal;
GC normal_gc;
union WTexture *back;
union WTexture *fore;
RColor color1;
RColor color2;
struct RImage *pixmap;
int opacity;
} WTexCompose;
} WTexTGradient;
typedef union WTexture {
WTexAny any;
@@ -130,13 +126,14 @@ typedef union WTexture {
WTexGradient gradient;
WTexMGradient mgradient;
WTexPixmap pixmap;
WTexCompose compose;
WTexTGradient tgradient;
} WTexture;
WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, XColor*, XColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, RColor*, RColor*);
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
WTexTGradient *wTextureMakeTGradient(WScreen*, int, RColor*, RColor*, char *, int);
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file,
XColor *color);
void wTextureDestroy(WScreen*, WTexture*);
+54 -15
View File
@@ -74,6 +74,11 @@
*/
#undef XDE_DND
/*
* support for Motif window manager (mwm) window hints
*/
#define MWM_HINTS
/*
* Undefine BALLOON_TEXT if you don't want balloons for showing extra
@@ -102,13 +107,10 @@
#define FALLBACK_WINDOWMANAGER "blackbox"
/* Define if you want MWM hint support (and consequently GNOME). */
#define MWM_HINTS
/* Define if you have a 5 button mouse and want to use button 4
* (in the root window) for switching to the previous workspace
* and 5 for the next */
* and 5 for the next. This will not work if you enable
* DisableWSMouseActions or compile wmaker with --enable-lite */
#undef MOUSE_WS_SWITCH
/*
@@ -128,6 +130,16 @@
#undef REDUCE_APPICONS
/*
* define EXTEND_WINDOWSHORTCUT if you have a great memory and want 10
* 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 OPTIMIZE_SHAPE if you want the shape setting code to be optimized
* for applications that change their shape frequently (like xdaliclock
@@ -145,6 +157,15 @@
#undef CONFIGURE_WINDOW_WHILE_MOVING
/*
* disable/enable workspace indicator in the dock
*/
#undef WS_INDICATOR
#define SILLYNESS
/*
*..........................................................................
* The following options WILL NOT BE MADE RUN-TIME. Please do not request.
@@ -205,6 +226,11 @@
#define DEFAULTS_DIR "Defaults"
/* the file of the system wide submenu to be forced into the main menu */
/* remove the comments if you want it */
/*
#define GLOBAL_SUBMENU_FILE PKGDATADIR"/GlobalMenu"
*/
/* pixmap path */
#define DEF_PIXMAP_PATHS \
@@ -248,6 +274,12 @@
#define DEF_APPMENU_X 10
#define DEF_APPMENU_Y 10
/* number of window shortcuts */
#ifdef EXTEND_WINDOWSHORTCUT
# define MAX_WINDOW_SHORTCUTS 10
#else
# define MAX_WINDOW_SHORTCUTS 4
#endif
/* Window level where icons reside */
#define NORMAL_ICON_LEVEL WMNormalLevel
@@ -284,7 +316,7 @@
#define BALLOON_DELAY 1000
/* delay for menu item selection hysteresis */
#define MENU_SELECT_DELAY 300
#define MENU_SELECT_DELAY 200
/* animation speed constants */
@@ -372,6 +404,13 @@
/* Delay (in ms) after which the clip will autocollapse when leaved */
#define AUTO_COLLAPSE_DELAY 1000
/* Delay (in ms) after which the clip will be lowered when leaved */
#define AUTO_LOWER_DELAY 1000
/* Delay (in ms) after which the clip will be raised when entered.
* Set this to zero if you want instant raise. */
#define AUTO_RAISE_DELAY 650
/* Max. number of icons the clip can have */
#define CLIP_MAX_ICONS 32
@@ -382,7 +421,8 @@
#define CURSOR_BLINK_RATE 300
#define MOVE_THRESHOLD 3 /* how many pixels to move before dragging windows */
#define MOVE_THRESHOLD 5 /* how many pixels to move before dragging windows
* and other objects */
#define HRESIZE_THRESHOLD 3
@@ -400,12 +440,8 @@
/* don't put titles in miniwindows */
#undef NO_MINIWINDOW_TITLES
/*
* disable/enable workspace indicator in the dock
*/
#undef WS_INDICATOR
#define FRAME_BORDER_COLOR "black"
/*
*----------------------------------------------------------------------
@@ -418,8 +454,6 @@
#define WM_PI 3.14159265358979323846
#define FRAME_BORDER_COLOR "black"
#define FRAME_BORDER_WIDTH 1 /* width of window border for frames */
#define RESIZEBAR_HEIGHT 8 /* height of the resizebar */
@@ -442,7 +476,12 @@
#define MAX_ICON_WIDTH 60 /* size of the icon pixmap */
#define MAX_ICON_HEIGHT 48
#define MAX_WORKSPACES 100
/* KDE may have problems with more than 32 workspaces */
#ifdef KWM_HINTS
# define MAX_WORKSPACES 32
#else
# define MAX_WORKSPACES 100
#endif
#define MAX_MENU_TEXT_LENGTH 512
+54 -15
View File
@@ -74,6 +74,11 @@
*/
#undef XDE_DND
/*
* support for Motif window manager (mwm) window hints
*/
#define MWM_HINTS
/*
* Undefine BALLOON_TEXT if you don't want balloons for showing extra
@@ -102,13 +107,10 @@
#define FALLBACK_WINDOWMANAGER "blackbox"
/* Define if you want MWM hint support (and consequently GNOME). */
#define MWM_HINTS
/* Define if you have a 5 button mouse and want to use button 4
* (in the root window) for switching to the previous workspace
* and 5 for the next */
* and 5 for the next. This will not work if you enable
* DisableWSMouseActions or compile wmaker with --enable-lite */
#undef MOUSE_WS_SWITCH
/*
@@ -128,6 +130,16 @@
@REDUCE_APPICONS@
/*
* define EXTEND_WINDOWSHORTCUT if you have a great memory and want 10
* 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 OPTIMIZE_SHAPE if you want the shape setting code to be optimized
* for applications that change their shape frequently (like xdaliclock
@@ -145,6 +157,15 @@
#undef CONFIGURE_WINDOW_WHILE_MOVING
/*
* disable/enable workspace indicator in the dock
*/
#undef WS_INDICATOR
#define SILLYNESS
/*
*..........................................................................
* The following options WILL NOT BE MADE RUN-TIME. Please do not request.
@@ -205,6 +226,11 @@
#define DEFAULTS_DIR "Defaults"
/* the file of the system wide submenu to be forced into the main menu */
/* remove the comments if you want it */
/*
#define GLOBAL_SUBMENU_FILE PKGDATADIR"/GlobalMenu"
*/
/* pixmap path */
#define DEF_PIXMAP_PATHS \
@@ -248,6 +274,12 @@
#define DEF_APPMENU_X 10
#define DEF_APPMENU_Y 10
/* number of window shortcuts */
#ifdef EXTEND_WINDOWSHORTCUT
# define MAX_WINDOW_SHORTCUTS 10
#else
# define MAX_WINDOW_SHORTCUTS 4
#endif
/* Window level where icons reside */
#define NORMAL_ICON_LEVEL WMNormalLevel
@@ -284,7 +316,7 @@
#define BALLOON_DELAY 1000
/* delay for menu item selection hysteresis */
#define MENU_SELECT_DELAY 300
#define MENU_SELECT_DELAY 200
/* animation speed constants */
@@ -372,6 +404,13 @@
/* Delay (in ms) after which the clip will autocollapse when leaved */
#define AUTO_COLLAPSE_DELAY 1000
/* Delay (in ms) after which the clip will be lowered when leaved */
#define AUTO_LOWER_DELAY 1000
/* Delay (in ms) after which the clip will be raised when entered.
* Set this to zero if you want instant raise. */
#define AUTO_RAISE_DELAY 650
/* Max. number of icons the clip can have */
#define CLIP_MAX_ICONS 32
@@ -382,7 +421,8 @@
#define CURSOR_BLINK_RATE 300
#define MOVE_THRESHOLD 3 /* how many pixels to move before dragging windows */
#define MOVE_THRESHOLD 5 /* how many pixels to move before dragging windows
* and other objects */
#define HRESIZE_THRESHOLD 3
@@ -400,12 +440,8 @@
/* don't put titles in miniwindows */
#undef NO_MINIWINDOW_TITLES
/*
* disable/enable workspace indicator in the dock
*/
#undef WS_INDICATOR
#define FRAME_BORDER_COLOR "black"
/*
*----------------------------------------------------------------------
@@ -418,8 +454,6 @@
#define WM_PI 3.14159265358979323846
#define FRAME_BORDER_COLOR "black"
#define FRAME_BORDER_WIDTH 1 /* width of window border for frames */
#define RESIZEBAR_HEIGHT 8 /* height of the resizebar */
@@ -442,7 +476,12 @@
#define MAX_ICON_WIDTH 60 /* size of the icon pixmap */
#define MAX_ICON_HEIGHT 48
#define MAX_WORKSPACES 100
/* KDE may have problems with more than 32 workspaces */
#ifdef KWM_HINTS
# define MAX_WORKSPACES 32
#else
# define MAX_WORKSPACES 100
#endif
#define MAX_MENU_TEXT_LENGTH 512
+46 -56
View File
@@ -78,6 +78,7 @@ static proplist_t AKeepInsideScreen;
static proplist_t AUnfocusable;
static proplist_t AAlwaysUserIcon;
static proplist_t AStartMiniaturized;
static proplist_t AStartMaximized;
static proplist_t AStartHidden; /* app */
static proplist_t ADontSaveSession; /* app */
static proplist_t AEmulateAppIcon;
@@ -113,6 +114,7 @@ init_wdefaults(WScreen *scr)
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
AStartMiniaturized = PLMakeString("StartMiniaturized");
AStartHidden = PLMakeString("StartHidden");
AStartMaximized = PLMakeString("StartMaximized");
ADontSaveSession = PLMakeString("DontSaveSession");
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
@@ -167,9 +169,22 @@ get_value(proplist_t dict_win, proplist_t dict_class, proplist_t dict_name,
}
/*
*----------------------------------------------------------------------
* wDefaultFillAttributes--
* Retrieves attributes for the specified instance/class and
* fills attr with it. Values that are actually defined are also
* set in mask. If useGlobalDefault is True, the default for
* all windows ("*") will be used for when no values are found
* for that instance/class.
*
*----------------------------------------------------------------------
*/
void
wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
WWindowAttributes *attr, Bool useGlobalDefault)
WWindowAttributes *attr,
WWindowAttributes *mask,
Bool useGlobalDefault)
{
proplist_t value;
proplist_t key1, key2, key3;
@@ -181,12 +196,12 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
key1 = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
else
key1 = NULL;
if (instance)
key2 = PLMakeString(instance);
else
key2 = NULL;
if (class)
key3 = PLMakeString(class);
else
@@ -219,82 +234,70 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
if (key3)
PLRelease(key3);
#define APPLY_VAL(value, flag, attrib) \
if (value) {attr->flag = getBool(attrib, value); \
if (mask) mask->flag = 1;}
/* get the data */
value = get_value(dw, dc, dn, da, ANoTitlebar, No, useGlobalDefault);
if (value)
attr->no_titlebar = getBool(ANoTitlebar, value);
APPLY_VAL(value, no_titlebar, ANoTitlebar);
value = get_value(dw, dc, dn, da, ANoResizebar, No, useGlobalDefault);
if (value)
attr->no_resizebar = getBool(ANoResizebar, value);
APPLY_VAL(value, no_resizebar, ANoResizebar);
value = get_value(dw, dc, dn, da, ANoMiniaturizeButton, No, useGlobalDefault);
if (value)
attr->no_miniaturize_button = getBool(ANoMiniaturizeButton, value);
APPLY_VAL(value, no_miniaturize_button, ANoMiniaturizeButton);
value = get_value(dw, dc, dn, da, ANoCloseButton, No, useGlobalDefault);
if (value)
attr->no_close_button = getBool(ANoCloseButton, value);
APPLY_VAL(value, no_close_button, ANoCloseButton);
value = get_value(dw, dc, dn, da, ANoHideOthers, No, useGlobalDefault);
if (value)
attr->no_hide_others = getBool(ANoHideOthers, value);
APPLY_VAL(value, no_hide_others, ANoHideOthers);
value = get_value(dw, dc, dn, da, ANoMouseBindings, No, useGlobalDefault);
if (value)
attr->no_bind_mouse = getBool(ANoMouseBindings, value);
APPLY_VAL(value, no_bind_mouse, ANoMouseBindings);
value = get_value(dw, dc, dn, da, ANoKeyBindings, No, useGlobalDefault);
if (value)
attr->no_bind_keys = getBool(ANoKeyBindings, value);
APPLY_VAL(value, no_bind_keys, ANoKeyBindings);
value = get_value(dw, dc, dn, da, ANoAppIcon, No, useGlobalDefault);
if (value)
attr->no_appicon = getBool(ANoAppIcon, value);
APPLY_VAL(value, no_appicon, ANoAppIcon);
value = get_value(dw, dc, dn, da, AKeepOnTop, No, useGlobalDefault);
if (value)
attr->floating = getBool(AKeepOnTop, value);
APPLY_VAL(value, floating, AKeepOnTop);
value = get_value(dw, dc, dn, da, AKeepOnBottom, No, useGlobalDefault);
if (value)
attr->floating = getBool(AKeepOnBottom, value);
APPLY_VAL(value, sunken, AKeepOnBottom);
value = get_value(dw, dc, dn, da, AOmnipresent, No, useGlobalDefault);
if (value)
attr->omnipresent = getBool(AOmnipresent, value);
APPLY_VAL(value, omnipresent, AOmnipresent);
value = get_value(dw, dc, dn, da, ASkipWindowList, No, useGlobalDefault);
if (value)
attr->skip_window_list = getBool(ASkipWindowList, value);
APPLY_VAL(value, skip_window_list, ASkipWindowList);
value = get_value(dw, dc, dn, da, AKeepInsideScreen, No, useGlobalDefault);
if (value)
attr->dont_move_off = getBool(AKeepInsideScreen, value);
APPLY_VAL(value, dont_move_off, AKeepInsideScreen);
value = get_value(dw, dc, dn, da, AUnfocusable, No, useGlobalDefault);
if (value)
attr->no_focusable = getBool(AUnfocusable, value);
APPLY_VAL(value, no_focusable, AUnfocusable);
value = get_value(dw, dc, dn, da, AAlwaysUserIcon, No, useGlobalDefault);
if (value)
attr->always_user_icon = getBool(AAlwaysUserIcon, value);
APPLY_VAL(value, always_user_icon, AAlwaysUserIcon);
value = get_value(dw, dc, dn, da, AStartMiniaturized, No, useGlobalDefault);
if (value)
attr->start_miniaturized = getBool(AStartMiniaturized, value);
APPLY_VAL(value, start_miniaturized, AStartMiniaturized);
value = get_value(dw, dc, dn, da, AStartHidden, No, useGlobalDefault);
if (value)
attr->start_hidden = getBool(AStartHidden, value);
APPLY_VAL(value, start_hidden, AStartHidden);
value = get_value(dw, dc, dn, da, AStartMaximized, No, useGlobalDefault);
APPLY_VAL(value, start_maximized, AStartMaximized);
value = get_value(dw, dc, dn, da, ADontSaveSession, No, useGlobalDefault);
if (value)
attr->dont_save_session = getBool(ADontSaveSession, value);
APPLY_VAL(value, dont_save_session, ADontSaveSession);
value = get_value(dw, dc, dn, da, AEmulateAppIcon, No, useGlobalDefault);
if (value)
attr->emulate_appicon = getBool(AEmulateAppIcon, value);
APPLY_VAL(value, emulate_appicon, AEmulateAppIcon);
/* clean up */
PLSetStringCmpHook(StringCompareHook);
@@ -483,18 +486,6 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
strcat(strcat(strcpy(buffer, instance), "."), class);
key = PLMakeString(buffer);
if (PLGetDictionaryEntry(dict, key)==NULL) {
PLRelease(key);
key = PLMakeString(instance);
if (PLGetDictionaryEntry(dict, key)==NULL) {
PLRelease(key);
key = PLMakeString(class);
if (PLGetDictionaryEntry(dict, key)==NULL) {
PLRelease(key);
key = PLMakeString(buffer);
}
}
}
free(buffer);
} else if (instance) {
key = PLMakeString(instance);
@@ -517,15 +508,14 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
same = 1;
}
if((attr = PLGetDictionaryEntry(dict, key)) != NULL) {
if ((attr = PLGetDictionaryEntry(dict, key)) != NULL) {
if (PLIsDictionary(attr)) {
if (icon_value!=NULL && !same)
PLMergeDictionaries(attr, icon_value);
else
PLRemoveDictionaryEntry(attr, AIcon);
}
}
else if (icon_value!=NULL && !same) {
} else if (icon_value!=NULL && !same) {
PLInsertDictionaryEntry(dict, key, icon_value);
}
if (!wPreferences.flags.noupdates)
+358 -366
View File
File diff suppressed because it is too large Load Diff
+46 -9
View File
@@ -26,9 +26,6 @@
#include "wconfig.h"
#include "GNUstep.h"
#ifdef MWM_HINTS
# include "motif.h"
#endif
#include "texture.h"
#include "menu.h"
#include "application.h"
@@ -67,10 +64,27 @@ typedef enum {
* that the value that will be used will be that of the leader foo.bar.
* The attributes inspector must always save application wide options
* in the name of the leader window, not the child.
*
*/
/*
* All flags must have their default values = 0
*
* New flag scheme:
*
* user_flags, defined_flags
* client_flags
*
* if defined window_flag then window_flag else client_flag
*
*/
#define WFLAGP(wwin, FLAG) ((wwin)->defined_user_flags.FLAG \
? (wwin)->user_flags.FLAG \
: (wwin)->client_flags.FLAG)
#define WSETUFLAG(wwin, FLAG, VAL) (wwin)->user_flags.FLAG = (VAL),\
(wwin)->defined_user_flags.FLAG = 1
typedef struct {
/* OpenStep */
unsigned int no_titlebar:1; /* draw titlebar? */
@@ -107,11 +121,12 @@ typedef struct {
unsigned int always_user_icon:1; /* ignore client IconPixmap or
* IconWindow */
unsigned int start_miniaturized:1;
unsigned int start_hidden:1;
unsigned int start_maximized:1;
unsigned int dont_save_session:1; /* do not save app's state in session */
/*
* emulate_app_icon must be automatically disabled for apps that can
* generate their own appicons and for apps that have no_appicon=1
@@ -119,6 +134,8 @@ typedef struct {
unsigned int emulate_appicon:1;
} WWindowAttributes;
/*
* Window manager protocols that both the client as we understand.
*/
@@ -144,7 +161,11 @@ typedef struct WWindow {
struct WWindow *next;
WScreen *screen_ptr; /* pointer to the screen structure */
WWindowAttributes window_flags; /* window attribute flags */
WWindowAttributes user_flags; /* window attribute flags set by user */
WWindowAttributes defined_user_flags;/* mask for user_flags */
WWindowAttributes client_flags; /* window attribute flags set by app
* initialized with global defaults */
struct InspectorPanel *inspector; /* pointer to attribute editor panel */
struct WFrameWindow *frame; /* the frame window */
@@ -203,6 +224,7 @@ typedef struct WWindow {
unsigned int hidden:1;
unsigned int shaded:1;
unsigned int maximized:2;
unsigned int omnipresent:1;
unsigned int semi_focused:1;
/* window type flags */
@@ -210,7 +232,7 @@ typedef struct WWindow {
#ifdef SHAPE
unsigned int shaped:1;
#endif
/* info flags */
unsigned int buttons_dont_fit:1;
unsigned int rebuild_texture:1;/* the window was resized and
@@ -228,8 +250,16 @@ typedef struct WWindow {
unsigned int inspector_open:1; /* attrib inspector is already open */
unsigned int destroyed:1; /* window was already destroyed */
unsigned int menu_open_for_me:1; /* window commands menu */
#ifdef KWM_HINTS
unsigned int kwm_hidden_for_modules:1;
#endif
#ifdef OLWM_HINTS
unsigned int olwm_push_pin:1; /* emulate pushpin behaviour */
unsigned int olwm_limit_menu:1;
#endif
} flags; /* state of the window */
struct WIcon *icon; /* icon info for the window */
@@ -237,6 +267,12 @@ typedef struct WWindow {
} WWindow;
#define IS_OMNIPRESENT(w) ((w)->flags.omnipresent ^ WFLAGP(w, omnipresent))
#define WINDOW_LEVEL(w) ((w)->frame->core->stacking->window_level)
/*
* Changes to this must update wWindowSaveState/getSavedState
*
@@ -309,7 +345,7 @@ WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
char *title, int x, int y,
int width, int height);
void wWindowCheckAttributeSanity(WWindow *wwin, WWindowAttributes *flags);
void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace);
void wWindowUpdateGNUstepAttr(WWindow *wwin, GNUstepWMAttributes *attr);
@@ -326,5 +362,6 @@ WMagicNumber wWindowGetSavedState(Window win);
void wWindowDeleteSavedState(WMagicNumber id);
Bool wWindowObscuresWindow(WWindow *wwin, WWindow *obscured);
#endif
+281 -53
View File
@@ -42,20 +42,27 @@
#include "workspace.h"
#include "winspector.h"
#include "dialog.h"
#include "stacking.h"
#define MC_MAXIMIZE 0
#define MC_MINIATURIZE 1
#define MC_SHADE 2
#define MC_HIDE 3
#define MC_SELECT 4
#define MC_DUMMY_MOVETO 5
#define MC_PROPERTIES 6
#define MC_SHORTCUT 7
#define MC_MOVERESIZE 4
#define MC_SELECT 5
#define MC_DUMMY_MOVETO 6
#define MC_PROPERTIES 7
#define MC_OPTIONS 8
#define MC_SHORTCUT 8
#define MC_CLOSE 8
#define MC_KILL 9
#define MC_CLOSE 9
#define MC_KILL 10
#define WO_KEEP_ON_TOP 0
#define WO_KEEP_AT_BOTTOM 1
#define WO_OMNIPRESENT 2
#define WO_ENTRIES 3
/**** Global data ***/
extern Time LastTimestamp;
@@ -66,6 +73,36 @@ extern WShortKey wKeyBindings[WKBD_LAST];
extern WPreferences wPreferences;
static void updateOptionsMenu(WMenu *menu, WWindow *wwin);
static void
execWindowOptionCommand(WMenu *menu, WMenuEntry *entry)
{
WWindow *wwin = (WWindow*)entry->clientdata;
switch (entry->order) {
case WO_KEEP_ON_TOP:
if(wwin->frame->core->stacking->window_level!=WMFloatingLevel)
ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
else
ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
break;
case WO_KEEP_AT_BOTTOM:
if(wwin->frame->core->stacking->window_level!=WMSunkenLevel)
ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
else
ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
break;
case WO_OMNIPRESENT:
wwin->flags.omnipresent^=1;
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_WORKSPACE);
break;
}
}
static void
execMenuCommand(WMenu *menu, WMenuEntry *entry)
{
@@ -79,6 +116,7 @@ execMenuCommand(WMenu *menu, WMenuEntry *entry)
/* send delete message */
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
break;
case MC_KILL:
wretain(wwin);
if (wPreferences.dont_confirm_kill
@@ -90,38 +128,52 @@ execMenuCommand(WMenu *menu, WMenuEntry *entry)
}
wrelease(wwin);
break;
case MC_MINIATURIZE:
if (wwin->protocols.MINIATURIZE_WINDOW) {
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
LastTimestamp);
} else {
wIconifyWindow(wwin);
if (wwin->flags.miniaturized) {
wDeiconifyWindow(wwin);
} else{
if (wwin->protocols.MINIATURIZE_WINDOW) {
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW,
LastTimestamp);
} else {
wIconifyWindow(wwin);
}
}
break;
case MC_MAXIMIZE:
if (wwin->flags.maximized)
wUnmaximizeWindow(wwin);
else
wMaximizeWindow(wwin, MAX_VERTICAL|MAX_HORIZONTAL);
break;
case MC_SHADE:
if (wwin->flags.shaded)
wUnshadeWindow(wwin);
else
wShadeWindow(wwin);
break;
case MC_SELECT:
wSelectWindow(wwin, !wwin->flags.selected);
break;
case MC_MOVERESIZE:
wKeyboardMoveResizeWindow(wwin);
break;
case MC_PROPERTIES:
if (wwin->wm_class || wwin->wm_instance)
wShowInspectorForWindow(wwin);
break;
case MC_HIDE:
wapp = wApplicationOf(wwin->main_window);
wHideApplication(wapp);
break;
}
}
@@ -141,7 +193,7 @@ makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
{
WWindow *wwin = (WWindow*)entry->clientdata;
wwin->screen_ptr->shortcutWindow[entry->order] = wwin;
wwin->screen_ptr->shortcutWindow[entry->order-WO_ENTRIES] = wwin;
wSelectWindow(wwin, !wwin->flags.selected);
XFlush(dpy);
@@ -194,15 +246,25 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
if (!smenu)
return;
buffer = wmalloc(strlen(_("Shortcut"))+16);
buffer = wmalloc(strlen(_("Set Shortcut"))+16);
for (i=0; i<smenu->entry_no; i++) {
for (i=WO_ENTRIES; i<smenu->entry_no; i++) {
char *tmp;
WWindow *twin = wwin->screen_ptr->shortcutWindow[i];
int shortcutNo = i-WO_ENTRIES;
WWindow *twin = wwin->screen_ptr->shortcutWindow[shortcutNo];
WMenuEntry *entry = smenu->entries[i];
sprintf(buffer, "%s %s %i", twin ? (twin == wwin ? "+" : "-" ) : " ",
_("Shortcut"), i+1);
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
if (!twin) {
entry->flags.indicator_on = 0;
} else {
entry->flags.indicator_on = 1;
if (twin != wwin)
entry->flags.indicator_type = MI_CHECK;
else
entry->flags.indicator_type = MI_DIAMOND;
}
if (strcmp(buffer, entry->text)!=0) {
free(entry->text);
@@ -210,7 +272,7 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
smenu->flags.realized = 0;
}
kcode = wKeyBindings[WKBD_WINDOW1+i].keycode;
kcode = wKeyBindings[WKBD_WINDOW1+shortcutNo].keycode;
if (kcode) {
if ((tmp = XKeysymToString(XKeycodeToKeysym(dpy, kcode, 0)))
@@ -237,6 +299,30 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
}
static void
updateOptionsMenu(WMenu *menu, WWindow *wwin)
{
WMenu *smenu = menu->cascades[menu->entries[MC_OPTIONS]->cascade];
/* keep on top check */
smenu->entries[WO_KEEP_ON_TOP]->clientdata = wwin;
smenu->entries[WO_KEEP_ON_TOP]->flags.indicator_on =
(wwin->frame->core->stacking->window_level == WMFloatingLevel)?1:0;
/* keep at bottom check */
smenu->entries[WO_KEEP_AT_BOTTOM]->clientdata = wwin;
smenu->entries[WO_KEEP_AT_BOTTOM]->flags.indicator_on =
(wwin->frame->core->stacking->window_level == WMSunkenLevel)?1:0;
/* omnipresent check */
smenu->entries[WO_OMNIPRESENT]->clientdata = wwin;
smenu->entries[WO_OMNIPRESENT]->flags.indicator_on = IS_OMNIPRESENT(wwin);
smenu->flags.realized = 0;
wMenuRealize(smenu);
}
static WMenu*
makeWorkspaceMenu(WScreen *scr)
{
@@ -253,10 +339,40 @@ makeWorkspaceMenu(WScreen *scr)
return menu;
}
static WMenu*
makeMakeShortcutMenu(WScreen *scr)
makeMakeShortcutMenu(WScreen *scr, WMenu *menu)
{
/*
WMenu *menu;
*/
int i;
/*
menu = wMenuCreate(scr, NULL, False);
if (!menu) {
wwarning(_("could not create submenu for window menu"));
return NULL;
}
*/
for (i=0; i<MAX_WINDOW_SHORTCUTS; i++) {
WMenuEntry *entry;
entry = wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
entry->flags.indicator = 1;
}
return menu;
}
static WMenu*
makeOptionsMenu(WScreen *scr)
{
WMenu *menu;
WMenuEntry *entry;
menu = wMenuCreate(scr, NULL, False);
if (!menu) {
@@ -264,14 +380,25 @@ makeMakeShortcutMenu(WScreen *scr)
return NULL;
}
wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
entry = wMenuAddCallback(menu, _("Keep on top"), execWindowOptionCommand,
NULL);
entry->flags.indicator = 1;
entry->flags.indicator_type = MI_CHECK;
entry = wMenuAddCallback(menu, _("Keep at bottom"), execWindowOptionCommand,
NULL);
entry->flags.indicator = 1;
entry->flags.indicator_type = MI_CHECK;
entry = wMenuAddCallback(menu, _("Omnipresent"), execWindowOptionCommand,
NULL);
entry->flags.indicator = 1;
entry->flags.indicator_type = MI_CHECK;
return menu;
}
static WMenu*
createWindowMenu(WScreen *scr)
{
@@ -286,7 +413,7 @@ createWindowMenu(WScreen *scr)
* entries, you must update the command #defines in the top of
* this file.
*/
entry = wMenuAddCallback(menu, _("(Un)Maximize"), execMenuCommand, NULL);
entry = wMenuAddCallback(menu, _("Maximize"), execMenuCommand, NULL);
if (wKeyBindings[WKBD_MAXIMIZE].keycode!=0) {
kcode = wKeyBindings[WKBD_MAXIMIZE].keycode;
@@ -303,7 +430,7 @@ createWindowMenu(WScreen *scr)
entry->rtext = wstrdup(tmp);
}
entry = wMenuAddCallback(menu, _("(Un)Shade"), execMenuCommand, NULL);
entry = wMenuAddCallback(menu, _("Shade"), execMenuCommand, NULL);
if (wKeyBindings[WKBD_SHADE].keycode!=0) {
kcode = wKeyBindings[WKBD_SHADE].keycode;
@@ -319,6 +446,14 @@ createWindowMenu(WScreen *scr)
entry->rtext = wstrdup(tmp);
}
entry = wMenuAddCallback(menu, _("Resize/Move"), execMenuCommand, NULL);
if (wKeyBindings[WKBD_MOVERESIZE].keycode!=0) {
kcode = wKeyBindings[WKBD_MOVERESIZE].keycode;
if (kcode && (tmp = XKeysymToString(XKeycodeToKeysym(dpy, kcode, 0))))
entry->rtext = wstrdup(tmp);
}
entry = wMenuAddCallback(menu, _("Select"), execMenuCommand, NULL);
if (wKeyBindings[WKBD_SELECT].keycode!=0) {
kcode = wKeyBindings[WKBD_SELECT].keycode;
@@ -334,8 +469,14 @@ createWindowMenu(WScreen *scr)
entry = wMenuAddCallback(menu, _("Attributes..."), execMenuCommand, NULL);
entry = wMenuAddCallback(menu, _("Options"), NULL, NULL);
wMenuEntrySetCascade(menu, entry,
makeMakeShortcutMenu(scr, makeOptionsMenu(scr)));
/*
entry = wMenuAddCallback(menu, _("Select Shortcut"), NULL, NULL);
wMenuEntrySetCascade(menu, entry, makeMakeShortcutMenu(scr));
*/
entry = wMenuAddCallback(menu, _("Close"), execMenuCommand, NULL);
if (wKeyBindings[WKBD_CLOSE].keycode!=0) {
@@ -367,44 +508,63 @@ CloseWindowMenu(WScreen *scr)
}
void
OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
static void
updateMenuForWindow(WMenu *menu, WWindow *wwin)
{
WMenu *menu;
WApplication *wapp = wApplicationOf(wwin->main_window);
WScreen *scr = wwin->screen_ptr;
int i;
wwin->flags.menu_open_for_me = 1;
updateOptionsMenu(menu, wwin);
if (!scr->window_menu) {
scr->window_menu = createWindowMenu(scr);
} else {
updateWorkspaceMenu(scr->workspace_submenu);
}
menu = scr->window_menu;
if (menu->flags.mapped) {
wMenuUnmap(menu);
if (menu->entries[0]->clientdata==wwin) {
return;
}
}
updateMakeShortcutMenu(menu, wwin);
wMenuSetEnabled(menu, MC_HIDE, wapp!=NULL
&& !wapp->main_window_desc->window_flags.no_appicon);
&& !WFLAGP(wapp->main_window_desc, no_appicon));
wMenuSetEnabled(menu, MC_CLOSE,
(wwin->protocols.DELETE_WINDOW
&& !wwin->window_flags.no_closable));
wMenuSetEnabled(menu, MC_MINIATURIZE, !wwin->window_flags.no_miniaturizable);
&& !WFLAGP(wwin, no_closable)));
wMenuSetEnabled(menu, MC_SHADE, !wwin->window_flags.no_shadeable);
if (wwin->flags.miniaturized) {
static char *text = _("Deminiaturize");
wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !wwin->window_flags.omnipresent);
menu->entries[MC_MINIATURIZE]->text = text;
} else {
static char *text = _("Miniaturize");
menu->entries[MC_MINIATURIZE]->text = text;
}
wMenuSetEnabled(menu, MC_MINIATURIZE, !WFLAGP(wwin, no_miniaturizable));
if (wwin->flags.maximized) {
static char *text = _("Unmaximize");
menu->entries[MC_MAXIMIZE]->text = text;
} else {
static char *text = _("Maximize");
menu->entries[MC_MAXIMIZE]->text = text;
}
wMenuSetEnabled(menu, MC_MOVERESIZE, !WFLAGP(wwin, no_resizable));
if (wwin->flags.shaded) {
static char *text = _("Unshade");
menu->entries[MC_SHADE]->text = text;
} else {
static char *text = _("Shade");
menu->entries[MC_SHADE]->text = text;
}
wMenuSetEnabled(menu, MC_SHADE, !WFLAGP(wwin, no_shadeable)
&& !wwin->flags.miniaturized);
wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !IS_OMNIPRESENT(wwin));
if ((wwin->wm_class || wwin->wm_instance) && !wwin->flags.inspector_open) {
wMenuSetEnabled(menu, MC_PROPERTIES, True);
@@ -426,8 +586,39 @@ OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
}
}
if (!menu->flags.realized)
wMenuRealize(menu);
menu->flags.realized = 0;
wMenuRealize(menu);
}
void
OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
{
WMenu *menu;
WScreen *scr = wwin->screen_ptr;
wwin->flags.menu_open_for_me = 1;
if (!scr->window_menu) {
scr->window_menu = createWindowMenu(scr);
/* hack to save some memory allocation/deallocation */
free(scr->window_menu->entries[MC_MINIATURIZE]->text);
free(scr->window_menu->entries[MC_MAXIMIZE]->text);
free(scr->window_menu->entries[MC_SHADE]->text);
} else {
updateWorkspaceMenu(scr->workspace_submenu);
}
menu = scr->window_menu;
if (menu->flags.mapped) {
wMenuUnmap(menu);
if (menu->entries[0]->clientdata==wwin) {
return;
}
}
updateMenuForWindow(menu, wwin);
x -= menu->frame->core->width/2;
if (x + menu->frame->core->width > wwin->frame_x+wwin->frame->core->width)
@@ -438,3 +629,40 @@ OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
if (!wwin->flags.internal_window)
wMenuMapAt(menu, x, y, keyboard);
}
#if 0
void
OpenMiniwindowMenu(WWindow *wwin, int x, int y)
{
WMenu *menu;
WScreen *scr = wwin->screen_ptr;
wwin->flags.menu_open_for_me = 1;
if (!scr->window_menu) {
scr->window_menu = createWindowMenu(scr);
/* hack to save some memory allocation/deallocation */
free(scr->window_menu->entries[MC_MINIATURIZE]->text);
free(scr->window_menu->entries[MC_MAXIMIZE]->text);
free(scr->window_menu->entries[MC_SHADE]->text);
} else {
updateWorkspaceMenu(scr->workspace_submenu);
}
menu = scr->window_menu;
if (menu->flags.mapped) {
wMenuUnmap(menu);
if (menu->entries[0]->clientdata==wwin) {
return;
}
}
updateMenuForWindow(menu, wwin);
x -= menu->frame->core->width/2;
wMenuMapAt(menu, x, y, False);
}
#endif
+141 -105
View File
@@ -69,6 +69,7 @@ static proplist_t AKeepInsideScreen;
static proplist_t AUnfocusable;
static proplist_t AAlwaysUserIcon;
static proplist_t AStartMiniaturized;
static proplist_t AStartMaximized;
static proplist_t ADontSaveSession;
static proplist_t AEmulateAppIcon;
@@ -114,6 +115,7 @@ make_keys()
AUnfocusable = PLMakeString("Unfocusable");
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
AStartMiniaturized = PLMakeString("StartMiniaturized");
AStartMaximized = PLMakeString("StartMaximized");
AStartHidden = PLMakeString("StartHidden");
ADontSaveSession = PLMakeString("DontSaveSession");
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
@@ -505,6 +507,9 @@ saveSettings(WMButton *button, InspectorPanel *panel)
insertAttribute(dict, winDic, AStartMiniaturized, value, &different, flags);
value = (WMGetButtonSelected(panel->attrChk[8])!=0) ? Yes : No;
insertAttribute(dict, winDic, AStartMaximized, value, &different, flags);
value = (WMGetButtonSelected(panel->attrChk[9])!=0) ? Yes : No;
insertAttribute(dict, winDic, ASkipWindowList, value, &different, flags);
@@ -610,7 +615,7 @@ makeAppIconFor(WApplication *wapp)
if (wapp->app_icon)
return;
if (!wapp->main_window_desc->window_flags.no_appicon)
if (!WFLAGP(wapp->main_window_desc, no_appicon))
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
else
wapp->app_icon = NULL;
@@ -676,66 +681,77 @@ static void
applySettings(WMButton *button, InspectorPanel *panel)
{
WWindow *wwin = panel->inspected;
WWindowAttributes *wflags = &wwin->window_flags;
WWindowAttributes oldFlags = *wflags;
WApplication *wapp = wApplicationOf(wwin->main_window);
int floating, sunken, skip_window_list;
int old_omnipresent;
int old_no_bind_keys;
int old_no_bind_mouse;
old_omnipresent = WFLAGP(wwin, omnipresent);
old_no_bind_keys = WFLAGP(wwin, no_bind_keys);
old_no_bind_mouse = WFLAGP(wwin, no_bind_mouse);
showIconFor(WMWidgetScreen(button), panel, NULL, NULL, USE_TEXT_FIELD);
wflags->no_titlebar = WMGetButtonSelected(panel->attrChk[0]);
wflags->no_resizebar = WMGetButtonSelected(panel->attrChk[1]);
wflags->no_close_button = WMGetButtonSelected(panel->attrChk[2]);
wflags->no_miniaturize_button = WMGetButtonSelected(panel->attrChk[3]);
WSETUFLAG(wwin, no_titlebar, WMGetButtonSelected(panel->attrChk[0]));
WSETUFLAG(wwin, no_resizebar, WMGetButtonSelected(panel->attrChk[1]));
WSETUFLAG(wwin, no_close_button, WMGetButtonSelected(panel->attrChk[2]));
WSETUFLAG(wwin, no_miniaturize_button, WMGetButtonSelected(panel->attrChk[3]));
floating = WMGetButtonSelected(panel->attrChk[4]);
sunken = WMGetButtonSelected(panel->attrChk[5]);
wflags->omnipresent = WMGetButtonSelected(panel->attrChk[6]);
wflags->start_miniaturized = WMGetButtonSelected(panel->attrChk[7]);
skip_window_list = WMGetButtonSelected(panel->attrChk[8]);
WSETUFLAG(wwin, omnipresent, WMGetButtonSelected(panel->attrChk[6]));
WSETUFLAG(wwin, start_miniaturized, WMGetButtonSelected(panel->attrChk[7]));
WSETUFLAG(wwin, start_maximized, WMGetButtonSelected(panel->attrChk[8]));
skip_window_list = WMGetButtonSelected(panel->attrChk[9]);
wflags->no_hide_others = WMGetButtonSelected(panel->moreChk[0]);
wflags->no_bind_keys = WMGetButtonSelected(panel->moreChk[1]);
wflags->no_bind_mouse = WMGetButtonSelected(panel->moreChk[2]);
wflags->dont_move_off = WMGetButtonSelected(panel->moreChk[3]);
wflags->no_focusable = WMGetButtonSelected(panel->moreChk[4]);
wflags->dont_save_session = WMGetButtonSelected(panel->moreChk[5]);
wflags->emulate_appicon = WMGetButtonSelected(panel->moreChk[6]);
wflags->always_user_icon = WMGetButtonSelected(panel->alwChk);
if (wflags->no_titlebar && wwin->flags.shaded)
WSETUFLAG(wwin, no_hide_others, WMGetButtonSelected(panel->moreChk[0]));
WSETUFLAG(wwin, no_bind_keys, WMGetButtonSelected(panel->moreChk[1]));
WSETUFLAG(wwin, no_bind_mouse, WMGetButtonSelected(panel->moreChk[2]));
WSETUFLAG(wwin, dont_move_off, WMGetButtonSelected(panel->moreChk[3]));
WSETUFLAG(wwin, no_focusable, WMGetButtonSelected(panel->moreChk[4]));
WSETUFLAG(wwin, dont_save_session, WMGetButtonSelected(panel->moreChk[5]));
WSETUFLAG(wwin, emulate_appicon, WMGetButtonSelected(panel->moreChk[6]));
WSETUFLAG(wwin, always_user_icon, WMGetButtonSelected(panel->alwChk));
if (WFLAGP(wwin, no_titlebar) && wwin->flags.shaded)
wUnshadeWindow(wwin);
wflags->no_shadeable = wflags->no_titlebar;
WSETUFLAG(wwin, no_shadeable, WFLAGP(wwin, no_titlebar));
if (floating) {
if (!wflags->floating)
if (!WFLAGP(wwin, floating))
ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
} else if (sunken) {
if (!wflags->sunken)
if (!WFLAGP(wwin, sunken))
ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
} else {
if (wflags->floating || wflags->sunken)
if (WFLAGP(wwin, floating) || WFLAGP(wwin, sunken))
ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
}
wflags->sunken = sunken;
wflags->floating = floating;
WSETUFLAG(wwin, sunken, sunken);
WSETUFLAG(wwin, floating, floating);
wwin->flags.omnipresent = 0;
if (wflags->skip_window_list != skip_window_list) {
int action = ((wflags->skip_window_list = skip_window_list))
? ACTION_REMOVE : ACTION_ADD;
UpdateSwitchMenu(wwin->screen_ptr, wwin, action);
if (WFLAGP(wwin, skip_window_list) != skip_window_list) {
WSETUFLAG(wwin, skip_window_list, skip_window_list);
UpdateSwitchMenu(wwin->screen_ptr, wwin,
skip_window_list ? ACTION_REMOVE : ACTION_ADD);
} else {
if (WFLAGP(wwin, omnipresent) != old_omnipresent) {
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_WORKSPACE);
}
}
if (wflags->no_bind_keys != oldFlags.no_bind_keys) {
if (!wflags->no_bind_keys) {
if (WFLAGP(wwin, no_bind_keys) != old_no_bind_keys) {
if (!WFLAGP(wwin, no_bind_keys)) {
XUngrabKey(dpy, AnyKey, AnyModifier, wwin->frame->core->window);
} else {
wWindowSetKeyGrabs(wwin);
}
}
if (wflags->no_bind_mouse != oldFlags.no_bind_mouse) {
if (WFLAGP(wwin, no_bind_mouse) != old_no_bind_mouse) {
wWindowResetMouseGrabs(wwin);
}
@@ -749,12 +765,13 @@ applySettings(WMButton *button, InspectorPanel *panel)
if (wapp) {
/* do application wide stuff */
wflags = &wapp->main_window_desc->window_flags;
WSETUFLAG(wapp->main_window_desc, start_hidden,
WMGetButtonSelected(panel->appChk[0]));
wflags->start_hidden = WMGetButtonSelected(panel->appChk[0]);
wflags->no_appicon = WMGetButtonSelected(panel->appChk[1]);
WSETUFLAG(wapp->main_window_desc, no_appicon,
WMGetButtonSelected(panel->appChk[1]));
if (wflags->no_appicon)
if (WFLAGP(wapp->main_window_desc, no_appicon))
removeAppIconFor(wapp);
else
makeAppIconFor(wapp);
@@ -780,9 +797,10 @@ revertSettings(WMButton *button, InspectorPanel *panel)
{
WWindow *wwin = panel->inspected;
WApplication *wapp = wApplicationOf(wwin->main_window);
int i, n, floating, sunken, skip_window_list;
int i, n;
char *wm_instance = NULL;
char *wm_class = NULL;
int workspace, level;
if (WMGetButtonSelected(panel->instRb) != 0)
wm_instance = wwin->wm_instance;
@@ -792,54 +810,45 @@ revertSettings(WMButton *button, InspectorPanel *panel)
wm_instance = wwin->wm_instance;
wm_class = wwin->wm_class;
}
memset(&wwin->window_flags, 0, sizeof(WWindowAttributes));
wDefaultFillAttributes(wwin->screen_ptr, wm_instance, wm_class,
&wwin->window_flags, True);
memset(&wwin->defined_user_flags, 0, sizeof(WWindowAttributes));
memset(&wwin->user_flags, 0, sizeof(WWindowAttributes));
memset(&wwin->client_flags, 0, sizeof(WWindowAttributes));
wWindowCheckAttributeSanity(wwin, &wwin->window_flags);
wWindowSetupInitialAttributes(wwin, &level, &workspace);
wwin->window_flags.kill_close = (wwin->protocols.DELETE_WINDOW) ? 0 : 1;
/* transients can't be iconified or maximized */
if (wwin->window_flags.no_miniaturizable) {
wwin->window_flags.no_miniaturize_button = 1;
}
/* if the window can't be resized, remove the resizebar */
if (wwin->window_flags.no_resizable) {
wwin->window_flags.no_resizebar = 1;
}
wwin->window_flags.no_shadeable = wwin->window_flags.no_titlebar;
for (i=0; i < 9; i++) {
for (i=0; i < 10; i++) {
int flag = 0;
switch (i) {
case 0:
flag = wwin->window_flags.no_titlebar;
flag = WFLAGP(wwin, no_titlebar);
break;
case 1:
flag = wwin->window_flags.no_resizebar;
flag = WFLAGP(wwin, no_resizebar);
break;
case 2:
flag = wwin->window_flags.no_close_button;
flag = WFLAGP(wwin, no_close_button);
break;
case 3:
flag = wwin->window_flags.no_miniaturize_button;
flag = WFLAGP(wwin, no_miniaturize_button);
break;
case 4:
flag = wwin->window_flags.floating;
flag = WFLAGP(wwin, floating);
break;
case 5:
flag = wwin->window_flags.sunken;
flag = WFLAGP(wwin, sunken);
break;
case 6:
flag = wwin->window_flags.omnipresent;
flag = WFLAGP(wwin, omnipresent);
break;
case 7:
flag = wwin->window_flags.no_focusable;
flag = WFLAGP(wwin, start_miniaturized);
break;
case 8:
flag = wwin->window_flags.skip_window_list;
flag = WFLAGP(wwin, start_maximized!=0);
break;
case 9:
flag = WFLAGP(wwin, skip_window_list);
break;
}
WMSetButtonSelected(panel->attrChk[i], flag);
@@ -849,25 +858,25 @@ revertSettings(WMButton *button, InspectorPanel *panel)
switch (i) {
case 0:
flag = wwin->window_flags.no_hide_others;
flag = WFLAGP(wwin, no_hide_others);
break;
case 1:
flag = wwin->window_flags.no_bind_keys;
flag = WFLAGP(wwin, no_bind_keys);
break;
case 2:
flag = wwin->window_flags.no_bind_mouse;
flag = WFLAGP(wwin, no_bind_mouse);
break;
case 3:
flag = wwin->window_flags.dont_move_off;
flag = WFLAGP(wwin, dont_move_off);
break;
case 4:
flag = wwin->window_flags.start_miniaturized;
flag = WFLAGP(wwin, no_focusable);
break;
case 5:
flag = wwin->window_flags.dont_save_session;
flag = WFLAGP(wwin, dont_save_session);
break;
case 6:
flag = wwin->window_flags.emulate_appicon;
flag = WFLAGP(wwin, emulate_appicon);
break;
}
WMSetButtonSelected(panel->moreChk[i], flag);
@@ -878,22 +887,22 @@ revertSettings(WMButton *button, InspectorPanel *panel)
switch (i) {
case 0:
flag = wapp->main_window_desc->window_flags.start_hidden;
flag = WFLAGP(wapp->main_window_desc, start_hidden);
break;
case 1:
flag = wapp->main_window_desc->window_flags.no_appicon;
flag = WFLAGP(wapp->main_window_desc, no_appicon);
break;
}
WMSetButtonSelected(panel->appChk[i], flag);
}
}
WMSetButtonSelected(panel->alwChk, wwin->window_flags.always_user_icon);
WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon));
showIconFor(WMWidgetScreen(panel->alwChk), panel, wm_instance, wm_class,
REVERT_TO_DEFAULT);
n = wDefaultGetStartWorkspace(wwin->screen_ptr, wm_instance, wm_class);
if (n >= 0 && n <= wwin->screen_ptr->workspace_count) {
WMPerformButtonClick(panel->setRb);
WMSetTextFieldText(panel->wsText, wwin->screen_ptr->workspaces[n]->name);
@@ -950,6 +959,20 @@ textEditedObserver(void *observerData, WMNotification *notification)
WMPerformButtonClick(panel->setRb);
}
static void
selectSpecification(WMWidget *bPtr, void *data)
{
InspectorPanel *panel = (InspectorPanel*)data;
if (bPtr == panel->defaultRb) {
WMSetButtonEnabled(panel->applyBtn, False);
} else {
WMSetButtonEnabled(panel->applyBtn, True);
}
}
static InspectorPanel*
createInspectorForWindow(WWindow *wwin)
{
@@ -989,7 +1012,7 @@ createInspectorForWindow(WWindow *wwin)
btn_width = (PWIDTH - (2 * 15) - (2 * 10)) / 3;
panel->saveBtn = WMCreateCommandButton(panel->win);
WMSetButtonAction(panel->saveBtn, (WMAction*)saveSettings, panel);
WMMoveWidget(panel->saveBtn, 15, 310);
WMMoveWidget(panel->saveBtn, (2 * (btn_width + 10)) + 15, 310);
WMSetButtonText(panel->saveBtn, _("Save"));
WMResizeWidget(panel->saveBtn, btn_width, 28);
if (wPreferences.flags.noupdates)
@@ -1003,8 +1026,8 @@ createInspectorForWindow(WWindow *wwin)
panel->revertBtn = WMCreateCommandButton(panel->win);
WMSetButtonAction(panel->revertBtn, (WMAction*)revertSettings, panel);
WMMoveWidget(panel->revertBtn, (2 * (btn_width + 10)) + 15, 310);
WMSetButtonText(panel->revertBtn, _("Revert"));
WMMoveWidget(panel->revertBtn, 15, 310);
WMSetButtonText(panel->revertBtn, _("Reload"));
WMResizeWidget(panel->revertBtn, btn_width, 28);
/* page selection popup button */
@@ -1033,6 +1056,7 @@ createInspectorForWindow(WWindow *wwin)
WMResizeWidget(panel->defaultRb, frame_width - (2 * 10), 20);
WMSetButtonText(panel->defaultRb, _("Defaults for all windows"));
WMSetButtonSelected(panel->defaultRb, False);
WMSetButtonAction(panel->defaultRb, selectSpecification, panel);
if (wwin->wm_class && wwin->wm_instance) {
@@ -1043,6 +1067,8 @@ createInspectorForWindow(WWindow *wwin)
WMSetButtonText(panel->bothRb, charbuf);
WMSetButtonSelected(panel->bothRb, True);
WMGroupButtons(panel->defaultRb, panel->bothRb);
WMSetButtonAction(panel->bothRb, selectSpecification, panel);
}
if (wwin->wm_instance) {
@@ -1052,6 +1078,8 @@ createInspectorForWindow(WWindow *wwin)
WMSetButtonText(panel->instRb, wwin->wm_instance);
WMSetButtonSelected(panel->instRb, False);
WMGroupButtons(panel->defaultRb, panel->instRb);
WMSetButtonAction(panel->instRb, selectSpecification, panel);
}
if (wwin->wm_class) {
@@ -1061,6 +1089,8 @@ createInspectorForWindow(WWindow *wwin)
WMSetButtonText(panel->clsRb, wwin->wm_class);
WMSetButtonSelected(panel->clsRb, False);
WMGroupButtons(panel->defaultRb, panel->clsRb);
WMSetButtonAction(panel->clsRb, selectSpecification, panel);
}
panel->specLbl = WMCreateLabel(panel->win);
@@ -1078,46 +1108,50 @@ createInspectorForWindow(WWindow *wwin)
WMMoveWidget(panel->attrFrm, 15, 50);
WMResizeWidget(panel->attrFrm, frame_width, 240);
for (i=0; i < 9; i++) {
for (i=0; i < 10; i++) {
char *caption = NULL;
int flag = 0;
switch (i) {
case 0:
caption = _("Disable titlebar");
flag = wwin->window_flags.no_titlebar;
flag = WFLAGP(wwin, no_titlebar);
break;
case 1:
caption = _("Disable resizebar");
flag = wwin->window_flags.no_resizebar;
flag = WFLAGP(wwin, no_resizebar);
break;
case 2:
caption = _("Disable close button");
flag = wwin->window_flags.no_close_button;
flag = WFLAGP(wwin, no_close_button);
break;
case 3:
caption = _("Disable miniaturize button");
flag = wwin->window_flags.no_miniaturize_button;
flag = WFLAGP(wwin, no_miniaturize_button);
break;
case 4:
caption = _("Keep on top / floating");
flag = wwin->window_flags.floating;
flag = WFLAGP(wwin, floating);
break;
case 5:
caption = _("Keep on bottom / sunken");
flag = wwin->window_flags.sunken;
caption = _("Keep at bottom / sunken");
flag = WFLAGP(wwin, sunken);
break;
case 6:
caption = _("Omnipresent");
flag = wwin->window_flags.omnipresent;
flag = WFLAGP(wwin, omnipresent);
break;
case 7:
caption = _("Start Miniaturized");
flag = wwin->window_flags.start_miniaturized;
flag = WFLAGP(wwin, start_miniaturized);
break;
case 8:
caption = _("Start Maximized");
flag = WFLAGP(wwin, start_maximized!=0);
break;
case 9:
caption = _("Skip window list");
flag = wwin->window_flags.skip_window_list;
flag = WFLAGP(wwin, skip_window_list);
break;
}
panel->attrChk[i] = WMCreateSwitchButton(panel->attrFrm);
@@ -1141,31 +1175,31 @@ createInspectorForWindow(WWindow *wwin)
switch (i) {
case 0:
caption = _("Ignore HideOthers");
flag = wwin->window_flags.no_hide_others;
flag = WFLAGP(wwin, no_hide_others);
break;
case 1:
caption = _("Don't bind keyboard shortcuts");
flag = wwin->window_flags.no_bind_keys;
flag = WFLAGP(wwin, no_bind_keys);
break;
case 2:
caption = _("Don't bind mouse clicks");
flag = wwin->window_flags.no_bind_mouse;
flag = WFLAGP(wwin, no_bind_mouse);
break;
case 3:
caption = _("Keep inside screen");
flag = wwin->window_flags.dont_move_off;
flag = WFLAGP(wwin, dont_move_off);
break;
case 4:
caption = _("Don't let it take focus");
flag = wwin->window_flags.no_focusable;
flag = WFLAGP(wwin, no_focusable);
break;
case 5:
caption = _("Don't Save Session");
flag = wwin->window_flags.dont_save_session;
flag = WFLAGP(wwin, dont_save_session);
break;
case 6:
caption = _("Emulate Application Icon");
flag = wwin->window_flags.emulate_appicon;
flag = WFLAGP(wwin, emulate_appicon);
break;
}
panel->moreChk[i] = WMCreateSwitchButton(panel->moreFrm);
@@ -1233,7 +1267,7 @@ createInspectorForWindow(WWindow *wwin)
WMMoveWidget(panel->alwChk, 20, 140);
WMResizeWidget(panel->alwChk, PWIDTH - (2 * 15) - (2 * 15), 20);
WMSetButtonText(panel->alwChk, _("Ignore client supplied icon"));
WMSetButtonSelected(panel->alwChk, wwin->window_flags.always_user_icon);
WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon));
panel->wsFrm = WMCreateFrame(panel->win);
@@ -1289,11 +1323,11 @@ createInspectorForWindow(WWindow *wwin)
switch (i) {
case 0:
caption = _("Start Hidden");
flag = wapp->main_window_desc->window_flags.start_hidden;
flag = WFLAGP(wapp->main_window_desc, start_hidden);
break;
case 1:
caption = _("No application icon");
flag = wapp->main_window_desc->window_flags.no_appicon;
flag = WFLAGP(wapp->main_window_desc, no_appicon);
break;
}
panel->appChk[i] = WMCreateSwitchButton(panel->appFrm);
@@ -1303,7 +1337,7 @@ createInspectorForWindow(WWindow *wwin)
WMSetButtonText(panel->appChk[i], caption);
}
if (wwin->window_flags.emulate_appicon) {
if (WFLAGP(wwin, emulate_appicon)) {
WMSetButtonEnabled(panel->appChk[1], False);
WMSetButtonEnabled(panel->moreChk[6], True);
} else {
@@ -1326,7 +1360,7 @@ createInspectorForWindow(WWindow *wwin)
/* if the window is a transient, don't let it have a miniaturize
* button */
if (wwin->transient_for!=None && wwin->transient_for!=scr->root_win)
if (wWindowFor(wwin->transient_for)!=NULL)
WMSetButtonEnabled(panel->attrChk[3], False);
else
WMSetButtonEnabled(panel->attrChk[3], True);
@@ -1343,7 +1377,7 @@ createInspectorForWindow(WWindow *wwin)
if (panel->appFrm)
WMMapSubwidgets(panel->appFrm);
WMSetPopUpButtonSelectedItem(panel->pagePopUp, 0);
WMSetPopUpButtonSelectedItem(panel->pagePopUp, 1);
changePage(panel->pagePopUp, panel);
@@ -1361,14 +1395,16 @@ createInspectorForWindow(WWindow *wwin)
y = wwin->frame_y+wwin->frame->top_width*2;
if (y + PHEIGHT > scr->scr_height)
y = scr->scr_height - PHEIGHT - 30;
if (x + PWIDTH > scr->scr_width)
x = scr->scr_width - PWIDTH;
panel->frame = wManageInternalWindow(scr, parent, wwin->client_win,
charbuf, x, y, PWIDTH, PHEIGHT);
/* kluge to know who should get the key events */
panel->frame->client_leader = WMWidgetXID(panel->win);
panel->frame->window_flags.no_closable = 0;
panel->frame->window_flags.no_close_button = 0;
WSETUFLAG(panel->frame, no_closable, 0);
WSETUFLAG(panel->frame, no_close_button, 0);
wWindowUpdateButtonImages(panel->frame);
wFrameWindowShowButton(panel->frame->frame, WFF_RIGHT_BUTTON);
panel->frame->frame->on_click_right = destroyInspector;
+1 -1
View File
@@ -56,7 +56,7 @@ typedef struct InspectorPanel {
/* second page. attributes */
WMFrame *attrFrm;
WMButton *attrChk[9];
WMButton *attrChk[10];
/* 3rd page. more attributes */
WMFrame *moreFrm;
+108 -44
View File
@@ -41,6 +41,12 @@
#include "actions.h"
#include "workspace.h"
#include "appicon.h"
#ifdef GNOME_STUFF
#include "gnome.h"
#endif
#ifdef KWM_HINTS
#include "kwm.h"
#endif
#include <proplist.h>
@@ -85,17 +91,26 @@ wWorkspaceNew(WScreen *scr)
scr->workspace_count++;
wspace = wmalloc(sizeof(WWorkspace));
wspace->name = NULL;
#ifdef KWM_HINTS
if (scr->flags.kwm_syncing_count) {
wspace->name = wKWMGetWorkspaceName(scr, scr->workspace_count-1);
}
#endif
if (!wspace->name) {
wspace->name = wmalloc(strlen(_("Workspace %i"))+8);
sprintf(wspace->name, _("Workspace %i"), scr->workspace_count);
}
wspace->name = wmalloc(strlen(_("Workspace %i"))+8);
sprintf(wspace->name, _("Workspace %i"), scr->workspace_count);
if (!wPreferences.flags.noclip) {
wspace->clip = wDockCreate(scr, WM_CLIP);
} else
wspace->clip = NULL;
list = wmalloc(sizeof(WWorkspace*)*scr->workspace_count);
for (i=0; i<scr->workspace_count-1; i++) {
list[i] = scr->workspaces[i];
}
@@ -105,7 +120,18 @@ wWorkspaceNew(WScreen *scr)
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
#ifdef GNOME_STUFF
wGNOMEUpdateWorkspaceHints(scr);
#endif
#ifdef KWM_HINTS
if (!scr->flags.kwm_syncing_count) {
wKWMUpdateWorkspaceCountHint(scr);
wKWMUpdateWorkspaceNameHint(scr, scr->workspace_count-1);
}
wKWMSetUsableAreaHint(scr, scr->workspace_count-1);
#endif
XFlush(dpy);
return scr->workspace_count-1;
}
return -1;
@@ -113,24 +139,25 @@ wWorkspaceNew(WScreen *scr)
void
Bool
wWorkspaceDelete(WScreen *scr, int workspace)
{
WWindow *tmp;
WWorkspace **list;
int i, j;
if (workspace<=0)
return;
return False;
/* verify if workspace is in use by some window */
tmp = scr->focused_window;
while (tmp) {
if (tmp->frame->workspace==workspace)
return;
if (!IS_OMNIPRESENT(tmp) && tmp->frame->workspace==workspace)
return False;
tmp = tmp->prev;
}
if (!wPreferences.flags.noclip) {
wDockDestroy(scr->workspaces[workspace]->clip);
scr->workspaces[workspace]->clip = NULL;
@@ -176,6 +203,18 @@ wWorkspaceDelete(WScreen *scr, int workspace)
wMenuRemoveItem(menu, --i);
wMenuRealize(menu);
}
#ifdef GNOME_STUFF
wGNOMEUpdateWorkspaceHints(scr);
#endif
#ifdef KWM_HINTS
wKWMUpdateWorkspaceCountHint(scr);
#endif
if (scr->current_workspace >= scr->workspace_count)
wWorkspaceChange(scr, scr->workspace_count-1);
return True;
}
@@ -191,42 +230,43 @@ wWorkspaceChange(WScreen *scr, int workspace)
}
}
void
wWorkspaceRelativeChange(WScreen *scr, int amount)
{
int w;
w = scr->current_workspace + amount;
if (amount < 0) {
if (w >= 0)
wWorkspaceChange(scr, w);
else if (wPreferences.ws_cycle)
wWorkspaceChange(scr, scr->workspace_count + w);
} else if (amount > 0) {
if (w < scr->workspace_count)
wWorkspaceChange(scr, w);
else if (wPreferences.ws_advance)
wWorkspaceChange(scr, WMAX(w, MAX_WORKSPACES-1));
else if (wPreferences.ws_cycle)
wWorkspaceChange(scr, w % scr->workspace_count);
}
}
void
wWorkspaceForceChange(WScreen *scr, int workspace)
{
WWindow *tmp, *foc=NULL;
#ifdef EXPERIMENTAL
WWorkspaceTexture *wsback;
#endif
if (workspace >= MAX_WORKSPACES || workspace < 0)
return;
#ifdef EXPERIMENTAL
/* update the background for the workspace */
if (workspace < scr->wspaceTextureCount
&& scr->wspaceTextures[workspace]) {
wsback = scr->wspaceTextures[workspace];
} else {
/* check if the previous workspace used the default background */
if (scr->current_workspace < 0
|| scr->current_workspace >= scr->wspaceTextureCount
|| scr->wspaceTextures[scr->current_workspace]==NULL) {
wsback = NULL;
} else {
wsback = scr->defaultTexure;
}
}
if (wsback) {
if (wsback->pixmap!=None) {
XSetWindowBackgroundPixmap(dpy, scr->root_win, wsback->pixmap);
} else {
XSetWindowBackground(dpy, scr->root_win, wsback->solid);
}
XClearWindow(dpy, scr->root_win);
XFlush(dpy);
}
#endif /* EXPERIMENTAL */
SendHelperMessage(scr, 'C', workspace+1, NULL);
if (workspace > scr->workspace_count-1) {
wWorkspaceMake(scr, workspace - scr->workspace_count + 1);
@@ -245,14 +285,14 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
if (tmp->frame->workspace!=workspace && !tmp->flags.selected) {
/* unmap windows not on this workspace */
if ((tmp->flags.mapped||tmp->flags.shaded)
&& !tmp->window_flags.omnipresent
&& !IS_OMNIPRESENT(tmp)
&& !tmp->flags.changing_workspace) {
XUnmapWindow(dpy, tmp->frame->core->window);
tmp->flags.mapped = 0;
}
/* also unmap miniwindows not on this workspace */
if (tmp->flags.miniaturized &&
!tmp->window_flags.omnipresent && tmp->icon) {
if (tmp->flags.miniaturized && !IS_OMNIPRESENT(tmp)
&& tmp->icon) {
if (!wPreferences.sticky_icons) {
XUnmapWindow(dpy, tmp->icon->core->window);
tmp->icon->mapped = 0;
@@ -263,7 +303,7 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
}
}
/* update current workspace of omnipresent windows */
if (tmp->window_flags.omnipresent) {
if (IS_OMNIPRESENT(tmp)) {
WApplication *wapp = wApplicationOf(tmp->main_window);
tmp->frame->workspace = workspace;
@@ -292,7 +332,7 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
/* Also map miniwindow if not omnipresent */
if (!wPreferences.sticky_icons &&
tmp->flags.miniaturized &&
!tmp->window_flags.omnipresent && tmp->icon) {
!IS_OMNIPRESENT(tmp) && tmp->icon) {
tmp->icon->mapped = 1;
XMapWindow(dpy, tmp->icon->core->window);
}
@@ -337,7 +377,8 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
if (scr->dock)
wAppIconPaint(scr->dock->icon_array[0]);
if (scr->clip_icon) {
if (scr->workspaces[workspace]->clip->auto_collapse) {
if (scr->workspaces[workspace]->clip->auto_collapse ||
scr->workspaces[workspace]->clip->auto_raise_lower) {
/* to handle enter notify. This will also */
XUnmapWindow(dpy, scr->clip_icon->icon->core->window);
XMapWindow(dpy, scr->clip_icon->icon->core->window);
@@ -345,6 +386,14 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
wClipIconPaint(scr->clip_icon);
}
}
#ifdef GNOME_STUFF
wGNOMEUpdateCurrentWorkspaceHint(scr);
#endif
#ifdef KWM_HINTS
wKWMUpdateCurrentWorkspaceHint(scr);
#endif
XFlush(dpy);
}
@@ -444,9 +493,18 @@ wWorkspaceRename(WScreen *scr, int workspace, char *name)
wMenuRealize(scr->workspace_menu);
}
}
UpdateSwitchMenuWorkspace(scr, workspace);
if (scr->clip_icon)
wClipIconPaint(scr->clip_icon);
#ifdef GNOME_STUFF
wGNOMEUpdateWorkspaceNamesHint(scr);
#endif
#ifdef KWM_HINTS
wKWMUpdateWorkspaceNameHint(scr, workspace);
#endif
}
@@ -613,7 +671,13 @@ wWorkspaceRestoreState(WScreen *scr)
if (i>0)
wDockHideIcons(scr->workspaces[i]->clip);
}
#ifdef KWM_HINTS
wKWMUpdateWorkspaceNameHint(scr, i);
#endif
}
#ifdef GNOME_STUFF
wGNOMEUpdateWorkspaceNamesHint(scr);
#endif
}
+3 -1
View File
@@ -32,7 +32,7 @@ typedef struct WWorkspace {
void wWorkspaceMake(WScreen *scr, int count);
int wWorkspaceNew(WScreen *scr);
void wWorkspaceDeleteLast(WScreen *scr);
Bool wWorkspaceDelete(WScreen *scr, int workspace);
void wWorkspaceChange(WScreen *scr, int workspace);
void wWorkspaceForceChange(WScreen *scr, int workspace);
@@ -47,4 +47,6 @@ void wWorkspaceRestoreState(WScreen *scr);
void wWorkspaceRename(WScreen *scr, int workspace, char *name);
void wWorkspaceRelativeChange(WScreen *scr, int amount);
#endif
+113
View File
@@ -0,0 +1,113 @@
#include "wconfig.h"
#ifdef XDE_DND
#include <X11/Xlib.h>
#include "WindowMaker.h"
#include "window.h"
#include "stdlib.h"
#include <X11/Xatom.h>
#include <gdk/gdk.h>
extern Atom _XA_XDE_REQUEST;
extern Atom _XA_XDE_ENTER;
extern Atom _XA_XDE_LEAVE;
extern Atom _XA_XDE_DATA_AVAILABLE;
extern Atom _XDE_FILETYPE;
extern Atom _XDE_URLTYPE;
Bool
wXDEProcessClientMessage(XClientMessageEvent *event)
{
Bool done = False;
if (event->message_type==_XA_XDE_DATA_AVAILABLE) {
GdkEvent gdkev;
WScreen *scr = wScreenForWindow(event->window);
Atom tmpatom;
int datalenght;
long tmplong;
char * tmpstr, * runstr, * freestr, * tofreestr;
printf("x\n");
gdkev.dropdataavailable.u.allflags = event->data.l[1];
gdkev.dropdataavailable.timestamp = event->data.l[4];
if(gdkev.dropdataavailable.u.flags.isdrop){
gdkev.dropdataavailable.type = GDK_DROP_DATA_AVAIL;
gdkev.dropdataavailable.requestor = event->data.l[0];
XGetWindowProperty(dpy,gdkev.dropdataavailable.requestor,
event->data.l[2],
0, LONG_MAX -1,
0, XA_PRIMARY, &tmpatom,
&datalenght,
&gdkev.dropdataavailable.data_numbytes,
&tmplong,
&tmpstr);
datalenght=gdkev.dropdataavailable.data_numbytes-1;
tofreestr=tmpstr;
runstr=NULL;
for(;datalenght>0;datalenght-=(strlen(tmpstr)+1),tmpstr=&tmpstr[strlen(tmpstr)+1]){
freestr=runstr;runstr=wstrappend(runstr,tmpstr);free(freestr);
freestr=runstr;runstr=wstrappend(runstr," ");free(freestr);
}
free(tofreestr);
scr->xdestring=runstr;
/* no need to redirect ? */
wDockReceiveDNDDrop(scr,event);
free(runstr);
scr->xdestring=NULL;
}
done = True;
} else if (event->message_type==_XA_XDE_LEAVE) {
printf("leave\n");
done = True;
} else if (event->message_type==_XA_XDE_ENTER) {
GdkEvent gdkev;
XEvent replyev;
gdkev.dropenter.u.allflags=event->data.l[1];
printf("from win %x\n",event->data.l[0]);
printf("to win %x\n",event->window);
printf("enter %x\n",event->data.l[1]);
printf("v %x ",event->data.l[2]);
printf("%x ",event->data.l[3]);
printf("%x\n",event->data.l[4]);
if(event->data.l[2]==_XDE_FILETYPE ||
event->data.l[3]==_XDE_FILETYPE ||
event->data.l[4]==_XDE_FILETYPE ||
event->data.l[2]==_XDE_URLTYPE ||
event->data.l[3]==_XDE_URLTYPE ||
event->data.l[4]==_XDE_URLTYPE)
if(gdkev.dropenter.u.flags.sendreply){
/*reply*/
replyev.xclient.type = ClientMessage;
replyev.xclient.window = event->data.l[0];
replyev.xclient.format = 32;
replyev.xclient.message_type = _XA_XDE_REQUEST;
replyev.xclient.data.l[0] = event->window;
gdkev.dragrequest.u.allflags = 0;
gdkev.dragrequest.u.flags.protocol_version = 0;
gdkev.dragrequest.u.flags.willaccept = 1;
gdkev.dragrequest.u.flags.delete_data = 0;
replyev.xclient.data.l[1] = gdkev.dragrequest.u.allflags;
replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
replyev.xclient.data.l[4] = event->data.l[2];
XSendEvent(dpy, replyev.xclient.window, 0, NoEventMask, &replyev);
XSync(dpy, 0);
}
done = True;
}
return done;
}
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef _XDE_H_
#define _XDE_H_
Bool wXDEProcessClientMessage(XClientMessageEvent *event);
#endif