Sun Mar 23 22:45:31 EST 2003

(KainX)

Patch from Kim Woelders <kim@woelders.dk> for freedesktop.org WM hints.


SVN revision: 6780
This commit is contained in:
Michael Jennings 2003-03-24 03:48:09 +00:00
parent a039b27fb9
commit d43b62e544
43 changed files with 4960 additions and 3694 deletions

View File

@ -1752,3 +1752,11 @@ Mon Feb 4 10:39:42 EST 2002
Applied patch from Boris Buegling <boris@icculus.org> for XFree86 4.2.0.
-------------------------------------------------------------------------------
Sun Mar 23 22:45:31 EST 2003
(KainX)
Patch from Kim Woelders <kim@woelders.dk> for freedesktop.org WM hints.
-------------------------------------------------------------------------------

View File

@ -9,7 +9,7 @@ SUBDIRS = \
po \
debian
EXTRA_DIST = config.rpath \
EXTRA_DIST = \
sample-scripts/bouncingball.pl \
sample-scripts/lcdmover.sh \
sample-scripts/testroller.pl \
@ -27,5 +27,3 @@ FAQ \
INSTALL \
NEWS \
README
ACLOCAL_AMFLAGS = -I m4

View File

@ -31,3 +31,9 @@
#undef PACKAGE
#undef HAS_XINERAMA
#undef VERSION
#undef ENABLE_EWMH
#undef ENABLE_GNOME
#undef ENABLE_KDE

View File

@ -2,7 +2,7 @@ AC_INIT(e.spec)
ENLIGHTENMENT_MAJOR=0
ENLIGHTENMENT_MINOR=16
ENLIGHTENMENT_MICRO=5
ENLIGHTENMENT_MICRO=6
ENLIGHTENMENT_VERSION=$ENLIGHTENMENT_MAJOR.$ENLIGHTENMENT_MINOR.$ENLIGHTENMENT_MICRO
VERSION=$ENLIGHTENMENT_VERSION
@ -79,6 +79,20 @@ AC_ARG_ENABLE(sound, [ --enable-sound compile with sound support [defa
AC_ARG_ENABLE(upgrade, [ --enable-upgrade compile with auto-upgrade support [default=yes]], ,enable_upgrade=yes)
AC_ARG_ENABLE(hints-ewmh,
[ --enable-hints-ewmh compile with Extended Window Manager Hints support [default=yes]],, enable_hints_ewmh=yes)
AC_ARG_ENABLE(hints-gnome,
[ --enable-hints-gnome compile with GNOME hints support [default=yes]],, enable_hints_gnome=yes)
AC_ARG_ENABLE(hints-kde,
[ --enable-hints-kde compile with KDE hints support [default=no]],, enable_hints_kde=no)
if test "x$enable_hints_ewmh" = "xyes"; then AC_DEFINE(ENABLE_EWMH) fi
if test "x$enable_hints_gnome" = "xyes"; then AC_DEFINE(ENABLE_GNOME) fi
if test "x$enable_hints_kde" = "xyes"; then AC_DEFINE(ENABLE_KDE) fi
AM_CONDITIONAL(ENABLE_EWMH, test "x$enable_hints_ewmh" = "xyes")
AM_CONDITIONAL(ENABLE_GNOME, test "x$enable_hints_gnome" = "xyes")
AM_CONDITIONAL(ENABLE_KDE, test "x$enable_hints_kde" = "xyes")
dnl The following test must come after AM_GNU_GETTEXT as it relies on
dnl ${DATADIRNAME} being defined.

4
e.spec
View File

@ -2,8 +2,8 @@
Summary: The Enlightenment window manager.
Name: enlightenment
Version: 0.16.5
Release: 5
Version: 0.16.6
Release: 0.1
Copyright: BSD
Group: User Interface/Desktops
Source: ftp://ftp.enlightenment.org/pub/enlightenment/enlightenment-%{version}.tar.gz

436
po/de.po

File diff suppressed because it is too large Load Diff

436
po/dk.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

436
po/es.po

File diff suppressed because it is too large Load Diff

436
po/fr.po

File diff suppressed because it is too large Load Diff

436
po/hu.po

File diff suppressed because it is too large Load Diff

436
po/ja.po

File diff suppressed because it is too large Load Diff

436
po/ko.po

File diff suppressed because it is too large Load Diff

436
po/nl.po

File diff suppressed because it is too large Load Diff

436
po/no.po

File diff suppressed because it is too large Load Diff

436
po/pl.po

File diff suppressed because it is too large Load Diff

436
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

436
po/ru.po

File diff suppressed because it is too large Load Diff

436
po/sv.po

File diff suppressed because it is too large Load Diff

436
po/tr.po

File diff suppressed because it is too large Load Diff

52
src/E.h
View File

@ -37,6 +37,8 @@
#include <Imlib.h>
#include <Fnlib.h>
#define DEBUG_EWMH 0
#define XSync(d, f) \
{XImage *__xim; \
__xim = XGetImage(d, root.win, 0, 0, 1, 1, 0xffffffff, ZPixmap); \
@ -907,6 +909,8 @@ typedef struct _ewin
char focusclick;
char internal;
char neverfocus;
char neverraise;
int ewmh_flags;
Menu *menu;
Window shownmenu;
Dialog *dialog;
@ -921,7 +925,9 @@ typedef struct _ewin
Snapshot *snap;
int icon_pmap_w, icon_pmap_h;
Pixmap icon_pmap, icon_mask;
#if ENABLE_KDE
char kde_hint;
#endif
int head;
}
EWin;
@ -1271,12 +1277,14 @@ typedef struct _emode
char nogroup;
GroupConfig group_config;
char group_swapmove;
#if ENABLE_KDE
Window kde_dock;
int kde_support;
int kde_x1;
int kde_x2;
int kde_y1;
int kde_y2;
#endif
char clickalways;
char keybinds_changed;
char firsttime;
@ -1743,6 +1751,7 @@ typedef struct _drawqueue
}
DrawQueue;
#if ENABLE_KDE
/* some kde hint enums here */
typedef enum
@ -1765,6 +1774,7 @@ typedef enum
IconChange
}
KMessage;
#endif
/* only used for remember list dialog callback funcs (SettingsDialog()
* in in settings.c)... snaps are attached to windows, not a global list */
@ -2360,6 +2370,7 @@ void setSimpleHint(Window win, Atom atom, long value);
long *getSimpleHint(Window win, Atom atom);
void deleteHint(Window win, Atom atom);
#if ENABLE_GNOME
/* gnome.c functions */
void GNOME_GetHintIcons(EWin * ewin, Atom atom_change);
void GNOME_SetCurrentDesk(void);
@ -2383,7 +2394,10 @@ void GNOME_SetCurrentArea(void);
void GNOME_SetAreaCount(void);
void GNOME_SetWMNameVer(void);
void GNOME_DelHints(EWin * ewin);
void GNOME_ProcessClientMessage(XClientMessageEvent * event);
#endif
#if ENABLE_KDE
/* kde.c functions */
void KDE_ClientMessage(Window win, Atom atom, long data,
@ -2410,6 +2424,44 @@ void KDE_SetNumDesktops(void);
void KDE_NewWindow(EWin * ewin);
void KDE_RemoveWindow(EWin * ewin);
void KDE_UpdateClient(EWin * ewin);
#endif
#if ENABLE_EWMH
/* ewmh.c functions */
void EWMH_Init(void);
void EWMH_SetDesktopCount(void);
void EWMH_SetDesktopNames(void);
void EWMH_SetDesktopSize(void);
void EWMH_SetCurrentDesktop(void);
void EWMH_SetDesktopViewport(void);
void EWMH_SetClientList(void);
void EWMH_SetActiveWindow(void);
void EWMH_SetWindowDesktop(const EWin *ewin);
void EWMH_SetWindowState(const EWin *ewin);
void EWMH_GetWindowDesktop(EWin *ewin);
void EWMH_GetWindowState(EWin *ewin);
void EWMH_GetWindowHints(EWin *ewin);
void EWMH_DelWindowHints(const EWin *ewin);
void EWMH_ProcessClientMessage(XClientMessageEvent * event);
void EWMH_ProcessPropertyChange(EWin *ewin, Atom atom_change);
#endif
/* hints.c functions */
void HintsInit(void);
void HintsSetDesktopConfig(void);
void HintsSetViewportConfig(void);
void HintsSetCurrentDesktop(void);
void HintsSetDesktopViewport(void);
void HintsSetClientList(void);
void HintsSetActiveWindow(void);
void HintsSetWindowDesktop(EWin *ewin);
void HintsSetWindowArea(EWin *ewin);
void HintsSetWindowState(EWin *ewin);
void HintsSetWindowHints(EWin *ewin);
void HintsGetWindowHints(EWin *ewin);
void HintsDelWindowHints(EWin *ewin);
void HintsProcessPropertyChange(EWin *ewin, Atom atom_change);
void HintsProcessClientMessage(XClientMessageEvent *event);
/* sound.c functions */
Sample *LoadWav(char *file);

View File

@ -46,16 +46,15 @@ enlightenment_SOURCES = \
focus.c \
fx.c \
globals.c \
gnome.c \
grabs.c \
groups.c \
handlers.c \
hints.c \
icccm.c \
iclass.c \
iconify.c \
init.c \
ipc.c \
kde.c \
lists.c \
main.c \
memory.c \
@ -90,7 +89,17 @@ enlightenment_SOURCES = \
warp.c \
windowmatch.c \
x.c \
zoom.c
zoom.c \
$(SRCS_EWMH) $(SRCS_GNOME) $(SRCS_KDE)
if ENABLE_EWMH
SRCS_EWMH = ewmh.c
endif
if ENABLE_GNOME
SRCS_GNOME = gnome.c
endif
if ENABLE_KDE
SRCS_KDE = kde.c
endif
LDADD = \
@INTLLIBS@ \

View File

@ -1467,6 +1467,7 @@ doCleanup(void *params)
}
Efree(blst);
}
#if ENABLE_KDE
if (mode.kde_support)
{
fixed = Erealloc(fixed, sizeof(RectBox) * (k + 2));
@ -1514,6 +1515,7 @@ doCleanup(void *params)
k++;
}
#endif
ArrangeRects(fixed, k, floating, j, ret, 0, 0, root.w, root.h, method,
0);
for (i = 0; i < (j + k); i++)
@ -1750,7 +1752,6 @@ doStick(void *params)
&& ((curr_group && !curr_group->cfg.mirror) || !sticky))
MakeWindowSticky(gwins[i]);
params = NULL;
GNOME_SetHint(gwins[i]);
RememberImportantInfoForEwin(gwins[i]);
}
Efree(gwins);
@ -1792,8 +1793,8 @@ doSkipLists(void *params)
ewin->skipwinlist = !(skip);
ewin->skipfocus = !(skip);
params = NULL;
GNOME_SetHint(ewin);
GNOME_SetClientList();
HintsSetWindowState(ewin);
HintsSetClientList();
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
@ -1821,8 +1822,8 @@ doSkipTask(void *params)
ewin->skiptask = !(skiptask);
params = NULL;
GNOME_SetHint(ewin);
GNOME_SetClientList();
HintsSetWindowState(ewin);
HintsSetClientList();
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
@ -1851,7 +1852,7 @@ doSkipFocus(void *params)
ewin->skipfocus = !(skipfocus);
params = NULL;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
}
@ -1878,7 +1879,7 @@ doSkipWinList(void *params)
ewin->skipwinlist = !(skipwinlist);
params = NULL;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
}
@ -1905,7 +1906,7 @@ doNeverFocus(void *params)
ewin->neverfocus = !(neverfocus);
params = NULL;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
}
@ -3112,6 +3113,7 @@ doSetLayer(void *params)
}
ewin->layer = l;
RaiseEwin(ewin);
HintsSetWindowState(ewin);
RememberImportantInfoForEwin(ewin);
EDBUG_RETURN(0);
}
@ -3458,8 +3460,10 @@ doConfigure(void *params)
SettingsAutoRaise();
else if (!strcmp(s, "tooltips"))
SettingsTooltips();
#if ENABLE_KDE
else if (!strcmp(s, "kde"))
SettingsKDE();
#endif
else if (!strcmp(s, "audio"))
SettingsAudio();
else if (!strcmp(s, "fx"))

View File

@ -115,7 +115,7 @@ SetAreaSize(int aw, int ah)
ah = 1;
area_w = aw;
area_h = ah;
GNOME_SetAreaCount();
HintsSetViewportConfig();
PagerReArea();
EDBUG_RETURN_;
}
@ -366,7 +366,7 @@ SetCurrentArea(int ax, int ay)
mode.flipp = 0;
lst[i]->area_x = a1;
lst[i]->area_y = a2;
GNOME_SetEwinArea(lst[i]);
HintsSetWindowArea(lst[i]);
}
}
}
@ -427,7 +427,7 @@ SetCurrentArea(int ax, int ay)
mode.flipp = 0;
lst[i]->area_x = a1;
lst[i]->area_y = a2;
GNOME_SetEwinArea(lst[i]);
HintsSetWindowArea(lst[i]);
}
}
}
@ -437,8 +437,8 @@ SetCurrentArea(int ax, int ay)
/* set the current area up in out data structs */
desks.desk[desks.current].current_area_x = ax;
desks.desk[desks.current].current_area_y = ay;
/* set gnome hints up for it */
GNOME_SetCurrentArea();
/* set hints up for it */
HintsSetDesktopViewport();
XSync(disp, False);
/* redraw any windows that were in "move mode" */
mode.moveresize_pending_ewin = NULL;
@ -528,7 +528,7 @@ MoveEwinToArea(EWin * ewin, int ax, int ay)
ewin->y + (root.h * (ay - ewin->area_y)));
ewin->area_x = ax;
ewin->area_y = ay;
GNOME_SetEwinArea(ewin);
HintsSetWindowArea(ewin);
EDBUG_RETURN_;
}
@ -538,7 +538,7 @@ SetEwinToCurrentArea(EWin * ewin)
EDBUG(4, "SetEwinToCurrentArea");
ewin->area_x = desks.desk[ewin->desktop].current_area_x;
ewin->area_y = desks.desk[ewin->desktop].current_area_y;
GNOME_SetEwinArea(ewin);
HintsSetWindowArea(ewin);
EDBUG_RETURN_;
}

View File

@ -1025,6 +1025,7 @@ ArrangeEwin(EWin * ewin)
newrect.w = ewin->w;
newrect.h = ewin->h;
newrect.p = ewin->layer;
#if ENABLE_KDE
if (mode.kde_support)
{
ArrangeRects(fixed, j, &newrect, 1, ret, mode.kde_x1, mode.kde_y1,
@ -1032,9 +1033,12 @@ ArrangeEwin(EWin * ewin)
}
else
{
#endif
ArrangeRects(fixed, j, &newrect, 1, ret, 0, 0, root.w, root.h,
ARRANGE_BY_SIZE, 1);
#if ENABLE_KDE
}
#endif
for (i = 0; i < j + 1; i++)
{
if (ret[i].data == ewin)

View File

@ -666,6 +666,7 @@ AddToFamily(Window win)
newrect.w = ewin->w;
newrect.h = ewin->h;
newrect.p = ewin->layer;
#if ENABLE_KDE
if (mode.kde_support)
{
ArrangeRects(fixed, j, &newrect, 1, ret, mode.kde_x1,
@ -675,9 +676,12 @@ AddToFamily(Window win)
}
else
{
#endif
ArrangeRects(fixed, j, &newrect, 1, ret, 0, 0, root.w,
root.h, ARRANGE_BY_SIZE, 1);
#if ENABLE_KDE
}
#endif
for (i = 0; i < j + 1; i++)
{
if (ret[i].data == ewin)
@ -1505,12 +1509,13 @@ Adopt(Window win)
ICCCM_GetInfo(ewin, 0);
ICCCM_GetColormap(ewin);
ICCCM_GetShapeInfo(ewin);
GNOME_GetHints(ewin, 0);
/* HintsGetWindowHints(ewin); */
ICCCM_GetGeoms(ewin, 0);
SessionGetInfo(ewin, 0);
MatchEwinToSM(ewin);
MatchEwinToSnapInfo(ewin);
ICCCM_GetEInfo(ewin);
HintsGetWindowHints(ewin);
if (!ewin->border)
SetEwinBorder(ewin);
@ -1690,6 +1695,7 @@ CreateEwin()
ewin->skipwinlist = 0;
ewin->skipfocus = 0;
ewin->neverfocus = 0;
ewin->neverraise = 0;
ewin->focusclick = 0;
ewin->internal = 0;
ewin->menu = NULL;
@ -1708,7 +1714,9 @@ CreateEwin()
ewin->snap = NULL;
ewin->icon_pmap = 0;
ewin->icon_mask = 0;
#if ENABLE_KDE
ewin->kde_hint = 0;
#endif
att.event_mask =
StructureNotifyMask | ResizeRedirectMask | ButtonPressMask |
@ -1785,10 +1793,7 @@ FreeEwin(EWin * ewin)
if (mode.context_ewin == ewin)
mode.context_ewin = NULL;
GNOME_DelHints(ewin);
if (mode.kde_support)
KDE_RemoveWindow(ewin);
HintsDelWindowHints(ewin);
if (ewin->client.transient)
{
@ -2063,7 +2068,7 @@ DetermineEwinArea(EWin * ewin)
(desks.desk[ewin->desktop].current_area_y * root.h)) / root.h;
if ((pax != ewin->area_x) || (pay != ewin->area_y))
{
GNOME_SetEwinArea(ewin);
HintsSetWindowArea(ewin);
}
EDBUG_RETURN_;
}
@ -2408,6 +2413,7 @@ RestackEwin(EWin * ewin)
PagerEwinOutsideAreaUpdate(ewin);
ForceUpdatePagersForDesktop(ewin->desktop);
}
HintsSetClientList();
EDBUG_RETURN_;
}
@ -2420,6 +2426,10 @@ RaiseEwin(EWin * ewin)
call_depth++;
if (call_depth > 256)
EDBUG_RETURN_;
if (ewin->neverraise)
EDBUG_RETURN_;
if (ewin->win)
{
if (ewin->floating)
@ -2838,7 +2848,7 @@ InstantShadeEwin(EWin * ewin)
}
PropagateShapes(ewin->win);
queue_up = pq;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
if (mode.mode == MODE_NONE)
{
PagerEwinOutsideAreaUpdate(ewin);
@ -2922,7 +2932,7 @@ InstantUnShadeEwin(EWin * ewin)
}
PropagateShapes(ewin->win);
queue_up = pq;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
if (mode.mode == MODE_NONE)
{
PagerEwinOutsideAreaUpdate(ewin);
@ -3188,7 +3198,7 @@ ShadeEwin(EWin * ewin)
ewin->client.win, ShapeBounding, ShapeSet);
PropagateShapes(ewin->win);
queue_up = pq;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
if (mode.mode == MODE_NONE)
{
PagerEwinOutsideAreaUpdate(ewin);
@ -3459,7 +3469,7 @@ UnShadeEwin(EWin * ewin)
ewin->client.win, ShapeBounding, ShapeSet);
PropagateShapes(ewin->win);
queue_up = pq;
GNOME_SetHint(ewin);
HintsSetWindowState(ewin);
if (mode.mode == MODE_NONE)
{
PagerEwinOutsideAreaUpdate(ewin);

View File

@ -1546,8 +1546,6 @@ HandleComms(XEvent * ev)
ShowDesktopControls();
}
FixFocus();
GNOME_SetDeskCount();
GNOME_SetDeskNames();
GetAreaSize(&ax, &ay);
GetCurrentArea(&a, &b);
if (a >= ax)

View File

@ -796,7 +796,10 @@ Config_Control(FILE * ConfigFile)
sscanf(s, "%*s %d %d ", &mode.dockstartx, &mode.dockstarty);
break;
case CONTROL_KDESUPPORT:
#if ENABLE_KDE
/* Taking out the case causes complaints when starting with old config. */
mode.kde_support = i2;
#endif
break;
case CONTROL_SHOWROOTTOOLTIP:
mode.showroottooltip = i2;
@ -3895,7 +3898,9 @@ SaveUserControlConfig(FILE * autosavefile)
fprintf(autosavefile, "1364 %i\n", (int)mode.group_config.shade);
fprintf(autosavefile, "1365 %i\n", (int)mode.group_config.mirror);
fprintf(autosavefile, "1372 %i\n", (int)mode.group_swapmove);
#if ENABLE_KDE
fprintf(autosavefile, "1366 %i\n", (int)mode.kde_support);
#endif
fprintf(autosavefile, "1367 %i\n", (int)mode.clickalways);
fprintf(autosavefile, "1368 %i\n", (int)mode.showroottooltip);
fprintf(autosavefile, "1369 %i %i %i\n", (int)mode.pager_sel_button,

View File

@ -183,12 +183,7 @@ ChangeNumberOfDesktops(int quantity)
if (desks.current >= mode.numdesktops)
GotoDesktop(mode.numdesktops - 1);
GNOME_SetDeskCount();
GNOME_SetDeskNames();
if (mode.kde_support)
KDE_SetNumDesktops();
HintsSetDesktopConfig();
}
void
@ -1360,7 +1355,7 @@ ConformEwinToDesktop(EWin * ewin)
ewin->y);
ICCCM_Configure(ewin);
StackDesktops();
GNOME_SetEwinDesk(ewin);
HintsSetWindowDesktop(ewin);
EDBUG_RETURN_;
}
if (ewin->floating)
@ -1377,7 +1372,7 @@ ConformEwinToDesktop(EWin * ewin)
XRaiseWindow(disp, ewin->win);
ShowEdgeWindows();
ICCCM_Configure(ewin);
GNOME_SetEwinDesk(ewin);
HintsSetWindowDesktop(ewin);
EDBUG_RETURN_;
}
if (ewin->parent != desks.desk[ewin->desktop].win)
@ -1389,7 +1384,8 @@ ConformEwinToDesktop(EWin * ewin)
RaiseEwin(ewin);
/* ShowEwin(ewin); */
ICCCM_Configure(ewin);
GNOME_SetEwinDesk(ewin);
/* HintsSetWindowDesktop(ewin); */
HintsSetWindowHints(ewin);
StackDesktops();
SetEwinToCurrentArea(ewin);
}
@ -1440,8 +1436,8 @@ MoveStickyWindowsToCurrentDesk(void)
XLowerWindow(disp, ewin->win);
EMoveWindow(disp, ewin->win, ewin->x, ewin->y);
DesktopAddEwinToTop(ewin);
GNOME_SetEwinArea(ewin);
GNOME_SetEwinDesk(ewin);
HintsSetWindowArea(ewin);
HintsSetWindowDesktop(ewin);
last_ewin = ewin;
}
}
@ -1520,10 +1516,7 @@ GotoDesktop(int num)
desks.current = num;
MoveStickyWindowsToCurrentDesk();
GNOME_SetCurrentDesk();
if (mode.kde_support)
KDE_SetRootArea();
HintsSetCurrentDesktop();
if (num > 0)
{
@ -1760,7 +1753,7 @@ RaiseDesktop(int num)
ForceUpdatePagersForDesktop(num);
UpdatePagerSel();
HandleDrawQueue();
GNOME_SetCurrentDesk();
HintsSetCurrentDesktop();
EMapWindow(disp, desks.desk[num].win);
XSync(disp, False);
@ -1791,7 +1784,7 @@ LowerDesktop(int num)
ForceUpdatePagersForDesktop(deskorder[0]);
UpdatePagerSel();
HandleDrawQueue();
GNOME_SetCurrentDesk();
HintsSetCurrentDesktop();
XSync(disp, False);
EDBUG_RETURN_;
@ -2012,8 +2005,6 @@ MoveEwinToDesktop(EWin * ewin, int num)
}
ForceUpdatePagersForDesktop(pdesk);
ForceUpdatePagersForDesktop(ewin->desktop);
if (mode.kde_support)
KDE_UpdateClient(ewin);
EDBUG_RETURN_;
}

View File

@ -23,25 +23,6 @@
*/
#include "E.h"
#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
#define WIN_STATE_STICKY (1<<0) /* everyone knows sticky */
#define WIN_STATE_RESERVED_BIT1 (1<<1) /* removed minimize here */
#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 (NeXT style) */
#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 */
static ToolTip *ttip = NULL;
struct _mdata
{
@ -118,19 +99,19 @@ HandleClientMessage(XEvent * ev)
{
EWin *ewin;
static Atom a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
static Atom a1 = 0, a6 = 0;
#if DEBUG_EWMH
char *name = XGetAtomName(disp, ev->xclient.message_type);
printf("HandleClientMessage: ev_type=%s(%d) ev_win=%#x data[0-3]= %08x %08x %08x %08x\n",
name, ev->xclient.message_type, ev->xclient.window,
ev->xclient.data.l[0], ev->xclient.data.l[1],
ev->xclient.data.l[2], ev->xclient.data.l[3]);
XFree(name);
#endif
EDBUG(5, "HandleClientMessage");
if (!a1)
a1 = XInternAtom(disp, "ENL_MSG", False);
if (!a2)
a2 = XInternAtom(disp, "_WIN_AREA", False);
if (!a3)
a3 = XInternAtom(disp, "_WIN_WORKSPACE", False);
if (!a4)
a4 = XInternAtom(disp, "_WIN_LAYER", False);
if (!a5)
a5 = XInternAtom(disp, "_WIN_STATE", False);
if (!a6)
a6 = XInternAtom(disp, "WM_CHANGE_STATE", False);
if (ev->xclient.message_type == a1)
@ -138,104 +119,31 @@ HandleClientMessage(XEvent * ev)
HandleComms(ev);
EDBUG_RETURN_;
}
if (ev->xclient.message_type == a2)
{
SetCurrentArea(ev->xclient.data.l[0], ev->xclient.data.l[1]);
EDBUG_RETURN_;
}
if (ev->xclient.message_type == a3)
{
GotoDesktop(ev->xclient.data.l[0]);
EDBUG_RETURN_;
}
if (ev->xclient.message_type == a4)
{
ewin =
FindItem(NULL, ev->xclient.window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin)
{
ewin->layer = ev->xclient.data.l[0];
XChangeProperty(disp, ewin->win, a4, XA_CARDINAL, 32,
PropModeReplace,
(unsigned char *)(&(ev->xclient.data.l[0])), 1);
RaiseEwin(ewin);
}
EDBUG_RETURN_;
}
if (ev->xclient.message_type == a5)
{
ewin =
FindItem(NULL, ev->xclient.window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (!ewin)
EDBUG_RETURN_;
if (ev->xclient.data.l[0] & WIN_STATE_FIXED_POSITION)
{
if (ev->xclient.data.l[1] & WIN_STATE_FIXED_POSITION)
ewin->fixedpos = 1;
else
ewin->fixedpos = 0;
}
if (ev->xclient.data.l[0] & WIN_STATE_ARRANGE_IGNORE)
{
if (ev->xclient.data.l[1] & WIN_STATE_ARRANGE_IGNORE)
ewin->ignorearrange = 1;
else
ewin->ignorearrange = 0;
}
if ((ev->xclient.data.l[0] & WIN_STATE_STICKY)
&& (!ewin->ignorearrange))
{
if (ev->xclient.data.l[1] & WIN_STATE_STICKY)
{
if (!(ewin->sticky))
{
ewin->sticky = 1;
RaiseEwin(ewin);
DrawEwin(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_STICK", 0, LIST_FINDBY_NAME,
LIST_TYPE_SCLASS));
}
}
else
{
if (ewin->sticky)
{
ewin->sticky = 0;
RaiseEwin(ewin);
DrawEwin(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_UNSTICK", 0, LIST_FINDBY_NAME,
LIST_TYPE_SCLASS));
}
}
}
if (ev->xclient.data.l[0] & WIN_STATE_SHADED)
{
if (ev->xclient.data.l[1] & WIN_STATE_SHADED)
ShadeEwin(ewin);
else
UnShadeEwin(ewin);
}
GNOME_SetHint(ewin);
EDBUG_RETURN_;
}
if (ev->xclient.message_type == a6)
{
ewin =
FindItem(NULL, ev->xclient.window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if ((ewin) && (ev->xclient.data.l[0] == IconicState)
&& (!(ewin->iconified)))
if (ewin == NULL)
EDBUG_RETURN_;
if (ev->xclient.data.l[0] == IconicState)
{
IconifyEwin(ewin);
EDBUG_RETURN_;
if (!(ewin->iconified))
IconifyEwin(ewin);
}
#if 0
else if (ev->xclient.data.l[0] == NormalState)
{
if (ewin->iconified)
DeIconifyEwin(ewin);
}
HintsSetWindowState(ewin);
#endif
EDBUG_RETURN_;
}
if (mode.kde_support)
KDE_ProcessClientMessage(&(ev->xclient));
HintsProcessClientMessage(&(ev->xclient));
EDBUG_RETURN_;
}
void
@ -300,7 +208,7 @@ HandleFocusWindow(Window win)
{
if (!found_ewin)
ICCCM_Cmap(NULL);
if (found_ewin)
else if (!(found_ewin->focusclick))
FocusToEWin(found_ewin);
mode.mouse_over_win = found_ewin;
}
@ -1170,8 +1078,10 @@ HandleDestroy(XEvent * ev)
mode.context_win = win;
#if ENABLE_KDE
if (mode.kde_support)
KDE_RemoveModule(win);
#endif
if (ewin)
{
@ -1221,7 +1131,7 @@ HandleDestroy(XEvent * ev)
DockDestroy(ewin);
DesktopRemoveEwin(ewin);
FreeEwin(ewin);
GNOME_SetClientList();
HintsSetClientList();
EDBUG_RETURN_;
}
c = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_CLIENT);
@ -1254,13 +1164,9 @@ HandleProperty(XEvent * ev)
if (ewin->client.title)
strncpy(title, ewin->client.title, 10240);
desktop = ewin->desktop;
GNOME_GetHintDesktop(ewin, ev->xproperty.atom);
HintsProcessPropertyChange(ewin, ev->xproperty.atom);
if ((desktop != ewin->desktop) && (!ewin->sticky))
MoveEwinToDesktop(ewin, ewin->desktop);
GNOME_GetHintIcons(ewin, ev->xproperty.atom);
GNOME_GetHintAppState(ewin, ev->xproperty.atom);
GNOME_GetExpandedSize(ewin, ev->xproperty.atom);
GNOME_GetHint(ewin, ev->xproperty.atom);
ICCCM_GetTitle(ewin, ev->xproperty.atom);
ICCCM_GetHints(ewin, ev->xproperty.atom);
ICCCM_GetInfo(ewin, ev->xproperty.atom);
@ -1268,15 +1174,19 @@ HandleProperty(XEvent * ev)
ICCCM_GetGeoms(ewin, ev->xproperty.atom);
SessionGetInfo(ewin, ev->xproperty.atom);
SyncBorderToEwin(ewin);
#if ENABLE_KDE
if (mode.kde_support)
KDE_ClientChange(win, ev->xproperty.atom);
#endif
if (ewin->client.title)
if (strncmp(title, ewin->client.title, 10240))
{
UpdateBorderInfo(ewin);
CalcEwinSizes(ewin);
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateClient(ewin);
#endif
}
if ((ewin->iconified) && (pm != ewin->client.icon_pmap))
{
@ -1308,15 +1218,19 @@ HandleProperty(XEvent * ev)
else if (win == root.win)
{
/* we're in the root window, not in a client */
#if ENABLE_KDE
if (mode.kde_support)
{
KDE_HintChange(ev->xproperty.atom);
}
#endif
}
#if ENABLE_KDE
else if (mode.kde_support)
{
KDE_ClientChange(win, ev->xproperty.atom);
}
#endif
EDBUG_RETURN_;
}
@ -1399,7 +1313,7 @@ HandleReparent(XEvent * ev)
if ((mode.slideout) && (ewin == mode.ewin))
HideSlideout(mode.slideout, mode.context_win);
FreeEwin(ewin);
GNOME_SetClientList();
HintsSetClientList();
}
}
EDBUG_RETURN_;
@ -1606,7 +1520,7 @@ HandleUnmap(XEvent * ev)
RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
DesktopRemoveEwin(ewin);
FreeEwin(ewin);
GNOME_SetClientList();
HintsSetClientList();
}
else
HideEwin(ewin);
@ -1631,7 +1545,8 @@ HandleMapRequest(XEvent * ev)
else
{
AddToFamily(ev->xmap.window);
GNOME_SetClientList();
HintsSetClientList();
#if ENABLE_KDE
if (mode.kde_support)
{
EWin *ewin;
@ -1639,8 +1554,8 @@ HandleMapRequest(XEvent * ev)
ewin =
FindItem(NULL, ev->xmap.window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
KDE_NewWindow(ewin);
}
#endif
}
EDBUG_RETURN_;
}

843
src/ewmh.c Normal file
View File

@ -0,0 +1,843 @@
/*
* Copyright (C) 2003 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Extended Window Manager Hints.
*/
#include "E.h"
#define CONFIG_EWMH_BROKEN_TASKBAR_HACK 0
#if DEBUG_EWMH
#undef EDBUG
#define EDBUG(a,b) printf(b "\n")
#endif
#define _ATOM_INIT(atom) atom = XInternAtom(disp, #atom, False); \
atom_list[atom_count++] = atom
#define _ATOM_SET_STRING(atom, win, string) \
XChangeProperty(disp, win, atom, XA_STRING, 8, PropModeReplace, \
(unsigned char *)string, strlen(string))
#define _ATOM_SET_WINDOW(atom, win, p_wins, cnt) \
XChangeProperty(disp, win, atom, XA_WINDOW, 32, PropModeReplace, \
(unsigned char *)p_wins, cnt)
#define _ATOM_SET_ATOM(atom, win, p_atom, cnt) \
XChangeProperty(disp, win, atom, XA_ATOM, 32, PropModeReplace, \
(unsigned char *)p_atom, cnt)
#define _ATOM_SET_CARD32(atom, win, p_val, cnt) \
XChangeProperty(disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
(unsigned char *)p_val, cnt)
/* These should be global */
static const char wm_name[] = "Enlightenment";
static const char wm_version[] = ENLIGHTENMENT_VERSION;
/* Move to ewmh.h? */
/* Window manager info */
Atom _NET_WM_NAME;
Atom _NET_WM_VERSION;
Atom _NET_SUPPORTED;
Atom _NET_SUPPORTING_WM_CHECK;
/* Desktop status/requests */
Atom _NET_NUMBER_OF_DESKTOPS;
Atom _NET_DESKTOP_GEOMETRY;
Atom _NET_DESKTOP_NAMES;
Atom _NET_CURRENT_DESKTOP;
Atom _NET_DESKTOP_VIEWPORT;
Atom _NET_ACTIVE_WINDOW;
Atom _NET_CLIENT_LIST;
Atom _NET_CLIENT_LIST_STACKING;
/* Misc window ops */
Atom _NET_CLOSE_WINDOW;
/*
* _NET_WM_MOVERESIZE
*
* Client message
*/
Atom _NET_WM_MOVERESIZE;
/* Move/resize actions */
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
#define _NET_WM_MOVERESIZE_MOVE 8
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10
/*
* Application Window Properties
*/
/* _NET_WM_NAME; */
Atom _NET_WM_DESKTOP;
/* _NET_WM_WINDOW_TYPE (window property) */
Atom _NET_WM_WINDOW_TYPE;
Atom _NET_WM_WINDOW_TYPE_DESKTOP;
Atom _NET_WM_WINDOW_TYPE_DOCK;
Atom _NET_WM_WINDOW_TYPE_TOOLBAR;
Atom _NET_WM_WINDOW_TYPE_MENU;
Atom _NET_WM_WINDOW_TYPE_UTILITY;
Atom _NET_WM_WINDOW_TYPE_SPLASH;
Atom _NET_WM_WINDOW_TYPE_DIALOG;
Atom _NET_WM_WINDOW_TYPE_NORMAL;
/* _NET_WM_STATE (window property and client message) */
Atom _NET_WM_STATE;
Atom _NET_WM_STATE_MODAL;
Atom _NET_WM_STATE_STICKY;
Atom _NET_WM_STATE_MAXIMIZED_VERT;
Atom _NET_WM_STATE_MAXIMIZED_HORZ;
Atom _NET_WM_STATE_SHADED;
Atom _NET_WM_STATE_SKIP_TASKBAR;
Atom _NET_WM_STATE_SKIP_PAGER;
Atom _NET_WM_STATE_HIDDEN;
Atom _NET_WM_STATE_FULLSCREEN;
Atom _NET_WM_STATE_ABOVE;
Atom _NET_WM_STATE_BELOW;
/* Window state property change actions */
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2
/* EWMH flags (somewhat messy) */
#define NET_WM_FLAG_MAXIMIZED_VERT 0x01
#define NET_WM_FLAG_MAXIMIZED_HORZ 0x02
Atom _NET_WM_ICON;
/*
* Set/clear Atom in list
*/
static void atom_list_set(Atom *atoms, int size, int *count, Atom atom, int set)
{
int i, n, in_list;
n = *count;
/* Check if atom is in list or not (+get index) */
for (i=0; i<n; i++)
if (atoms[i] == atom)
break;
in_list = i < n;
if (set && !in_list)
{
/* Add it (if space left) */
if (n < size)
atoms[n++] = atom;
*count = n;
}
else if (!set && in_list)
{
/* Remove it */
atoms[i] = atoms[--n];
*count = n;
}
}
/*
* Return index of window in list, -1 if not found.
* Search starts at end (utility to help finding the stacking order).
*/
static int winlist_rindex(Window *wl, int len, Window win)
{
int i;
for (i = len-1; i >= 0; i--)
if (win == wl[i])
break;
return i;
}
/*
* Initialize EWMH stuff
*/
void
EWMH_Init(void)
{
Window win; /* Should be elsewhere ? */
Atom atom_list[64];
int atom_count;
EDBUG(6, "EWMH_Init");
atom_count = 0;
_ATOM_INIT(_NET_WM_NAME);
_ATOM_INIT(_NET_WM_VERSION);
_ATOM_INIT(_NET_SUPPORTED);
_ATOM_INIT(_NET_SUPPORTING_WM_CHECK);
_ATOM_INIT(_NET_NUMBER_OF_DESKTOPS);
_ATOM_INIT(_NET_DESKTOP_GEOMETRY);
_ATOM_INIT(_NET_DESKTOP_NAMES);
_ATOM_INIT(_NET_CURRENT_DESKTOP);
_ATOM_INIT(_NET_DESKTOP_VIEWPORT);
_ATOM_INIT(_NET_ACTIVE_WINDOW);
_ATOM_INIT(_NET_CLIENT_LIST);
_ATOM_INIT(_NET_CLIENT_LIST_STACKING);
_ATOM_INIT(_NET_CLOSE_WINDOW);
_ATOM_INIT(_NET_WM_MOVERESIZE);
_ATOM_INIT(_NET_WM_DESKTOP);
_ATOM_INIT(_NET_WM_ICON);
_ATOM_INIT(_NET_WM_WINDOW_TYPE);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_DESKTOP);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_DOCK);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_TOOLBAR);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_MENU);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_UTILITY);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_SPLASH);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_DIALOG);
_ATOM_INIT(_NET_WM_WINDOW_TYPE_NORMAL);
_ATOM_INIT(_NET_WM_STATE);
_ATOM_INIT(_NET_WM_STATE_MODAL);
_ATOM_INIT(_NET_WM_STATE_STICKY);
_ATOM_INIT(_NET_WM_STATE_MAXIMIZED_VERT);
_ATOM_INIT(_NET_WM_STATE_MAXIMIZED_HORZ);
_ATOM_INIT(_NET_WM_STATE_SHADED);
_ATOM_INIT(_NET_WM_STATE_SKIP_TASKBAR);
_ATOM_INIT(_NET_WM_STATE_HIDDEN);
#if 0
_ATOM_INIT(_NET_WM_STATE_SKIP_PAGER);
_ATOM_INIT(_NET_WM_STATE_FULLSCREEN);
#endif
_ATOM_INIT(_NET_WM_STATE_ABOVE);
_ATOM_INIT(_NET_WM_STATE_BELOW);
_ATOM_SET_ATOM(_NET_SUPPORTED, root.win, atom_list, atom_count);
/* Set WM info properties */
_ATOM_SET_STRING(_NET_WM_NAME, root.win, wm_name);
_ATOM_SET_STRING(_NET_WM_VERSION, root.win, wm_version);
win = ECreateWindow(root.win, -200, -200, 5, 5, 0);
_ATOM_SET_WINDOW(_NET_SUPPORTING_WM_CHECK, root.win, &win, 1);
_ATOM_SET_WINDOW(_NET_SUPPORTING_WM_CHECK, win, &win, 1);
EWMH_SetDesktopCount();
EWMH_SetDesktopNames();
EWMH_SetDesktopSize();
EDBUG_RETURN_;
}
/*
* Desktops
*/
void
EWMH_SetDesktopCount(void)
{
CARD32 val;
EDBUG(6, "EWMH_SetDesktopCount");
val = mode.numdesktops;
_ATOM_SET_CARD32(_NET_NUMBER_OF_DESKTOPS, root.win, &val, 1);
EDBUG_RETURN_;
}
void
EWMH_SetDesktopNames(void)
{
XTextProperty text;
char s[1024], *names[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
int i;
EDBUG(6, "EWMH_SetDesktopNames");
for (i = 0; i < mode.numdesktops; i++)
{
Esnprintf(s, sizeof(s), "%i", i);
names[i] = duplicate(s);
}
if (XStringListToTextProperty(names, mode.numdesktops, &text))
{
XSetTextProperty(disp, root.win, &text, _NET_DESKTOP_NAMES);
XFree(text.value);
}
for (i = 0; i < mode.numdesktops; i++)
if (names[i])
Efree(names[i]);
EDBUG_RETURN_;
}
void
EWMH_SetDesktopSize(void)
{
CARD32 size[2];
int ax, ay;
EDBUG(6, "EWMH_SetDesktopSize");
GetAreaSize(&ax, &ay);
size[0] = ax*root.w;
size[1] = ay*root.h;
_ATOM_SET_CARD32(_NET_DESKTOP_GEOMETRY, root.win, &size, 2);
EDBUG_RETURN_;
}
void
EWMH_SetCurrentDesktop(void)
{
CARD32 val;
EDBUG(6, "EWMH_SetCurrentDesktop");
val = desks.current;
_ATOM_SET_CARD32(_NET_CURRENT_DESKTOP, root.win, &val, 1);
EDBUG_RETURN_;
}
void
EWMH_SetDesktopViewport(void)
{
CARD32 val[2];
int ax, ay;
EDBUG(6, "EWMH_SetDesktopViewport");
GetCurrentArea(&ax, &ay);
val[0] = ax*root.w;
val[1] = ay*root.h;
_ATOM_SET_CARD32(_NET_DESKTOP_VIEWPORT, root.win, val, 2);
#if CONFIG_EWMH_BROKEN_TASKBAR_HACK
EWMH_SetClientList();
#endif
EDBUG_RETURN_;
}
/*
* Window status
*/
void
EWMH_SetClientList(void)
{
Window *wl;
int i, j, k, nwin, num;
EWin **lst;
#if CONFIG_EWMH_BROKEN_TASKBAR_HACK
int ax, ay;
GetCurrentArea(&ax, &ay);
#endif
EDBUG(6, "EWMH_SetClientList");
/* Mapping order */
lst = (EWin**)ListItemType(&num, LIST_TYPE_EWIN);
wl = NULL;
nwin = 0;
if (lst)
{
wl = Emalloc(sizeof(Window) * num);
for (i = 0; i < num; i++)
{
EWin *ewin = lst[i];
if (ewin->menu) continue;
#if 0 /* Not really sure about these. Use _NET_WM_STATE_SKIP_TASKBAR? */
if (ewin->pager) continue;
if (ewin->ibox) continue;
#endif
if (ewin->skiptask) continue;
if (ewin->iconified == 4) continue;
#if CONFIG_EWMH_BROKEN_TASKBAR_HACK
if (!(ewin->sticky || (desks.current == ewin->desktop &&
ewin->area_x == ax && ewin->area_y == ay))) continue;
#endif
wl[nwin++] = ewin->client.win;
}
}
_ATOM_SET_WINDOW(_NET_CLIENT_LIST, root.win, wl, nwin);
if (lst)
Efree(lst);
/*
* Stacking order.
* We will only bother ourselves with the ones on this desktop.
*/
num = desks.desk[desks.current].num;
lst = desks.desk[desks.current].list;
for (i = j = 0; i < num; i++)
{
Window win = lst[i]->client.win;
k = winlist_rindex(wl, nwin-j, win);
if (k < 0)
continue;
/* Swap 'em */
wl[k] = wl[nwin-1-j];
wl[nwin-1-j] = win;
j++;
}
_ATOM_SET_WINDOW(_NET_CLIENT_LIST_STACKING, root.win, wl, nwin);
if (wl)
Efree(wl);
EDBUG_RETURN_;
}
void
EWMH_SetActiveWindow(void)
{
static Window win_last_set;
EWin *ewin;
Window win;
EDBUG(6, "EWMH_SetActiveWindow");
ewin = GetFocusEwin();
win = (ewin) ? ewin->client.win : None;
if (win != win_last_set)
{
_ATOM_SET_WINDOW(_NET_ACTIVE_WINDOW, root.win, &win, 1);
win_last_set = win;
}
EDBUG_RETURN_;
}
/*
* Functions that set X11-properties from E-window internals
*/
void
EWMH_SetWindowDesktop(const EWin *ewin)
{
CARD32 val;
EDBUG(6, "EWMH_SetWindowDesktop");
if (ewin->sticky == 1)
val = 0xFFFFFFFF;
else
val = ewin->desktop;
_ATOM_SET_CARD32(_NET_WM_DESKTOP, ewin->client.win, &val, 1);
EDBUG_RETURN_;
}
void
EWMH_SetWindowState(const EWin *ewin)
{
Atom atom_list[64];
int len = sizeof(atom_list)/sizeof(Atom);
int atom_count;
EDBUG(6, "EWMH_SetWindowState");
atom_count = 0;
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_STICKY, ewin->sticky);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_SHADED, ewin->shaded);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_SKIP_TASKBAR,
ewin->skiptask || ewin->pager || ewin->ibox);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_HIDDEN, ewin->iconified);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_VERT,
ewin->ewmh_flags&NET_WM_FLAG_MAXIMIZED_VERT);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_HORZ,
ewin->ewmh_flags&NET_WM_FLAG_MAXIMIZED_HORZ);
#if 0
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_SKIP_PAGER, ewin->skippager);
#endif
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_ABOVE, ewin->layer >= 6);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_BELOW, ewin->layer <= 2);
_ATOM_SET_ATOM(_NET_WM_STATE, ewin->client.win, atom_list, atom_count);
EDBUG_RETURN_;
}
/*
* Functions that set E-window internals from X11-properties
*/
void
EWMH_GetWindowDesktop(EWin *ewin)
{
CARD32 *val;
int size;
EDBUG(6, "EWMH_GetWindowDesktop");
val = AtomGet(ewin->client.win, _NET_WM_DESKTOP, XA_CARDINAL, &size);
if (!val)
goto exit;
if (val[0] == 0xFFFFFFFF)
ewin->desktop = 0;
else
ewin->desktop = val[0];
Efree(val);
exit:
EDBUG_RETURN_;
}
void
EWMH_GetWindowState(EWin *ewin)
{
Atom *p_atoms, atom;
int i, n_atoms;
EDBUG(6, "EWMH_GetWindowState");
ewin->ewmh_flags = 0;
n_atoms = 0;
p_atoms = AtomGet(ewin->client.win, _NET_WM_STATE, XA_ATOM, &n_atoms);
n_atoms /= sizeof(Atom); /* Silly */
if (!p_atoms)
goto exit;
for (i=0; i<n_atoms; i++)
{
atom = p_atoms[i];
if (atom == _NET_WM_STATE_STICKY)
ewin->sticky = 1;
else if (atom == _NET_WM_STATE_SHADED)
ewin->shaded = 1;
else if (atom == _NET_WM_STATE_SKIP_TASKBAR)
ewin->skiptask = 1;
else if (atom == _NET_WM_STATE_HIDDEN)
ewin->iconified = 1;
else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_VERT;
else if (atom == _NET_WM_STATE_MAXIMIZED_HORZ)
ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_HORZ;
#if 0
else if (atom == _NET_WM_STATE_SKIP_PAGER)
ewin->skippager = 1;
#endif
else if (atom == _NET_WM_STATE_ABOVE)
ewin->layer = 6;
else if (atom == _NET_WM_STATE_BELOW)
ewin->layer = 2;
}
Efree(p_atoms);
exit:
EDBUG_RETURN_;
}
void
EWMH_GetWindowType(EWin *ewin)
{
Atom *p_atoms, atom;
int n_atoms;
EDBUG(6, "EWMH_GetWindowType");
n_atoms = 0;
p_atoms = AtomGet(ewin->client.win, _NET_WM_WINDOW_TYPE, XA_ATOM, &n_atoms);
n_atoms /= sizeof(Atom); /* Silly */
if (!p_atoms)
goto exit;
atom = p_atoms[0];
if (atom == _NET_WM_WINDOW_TYPE_DESKTOP)
{
Border *b;
ewin->layer = 0;
ewin->sticky = 1;
ewin->focusclick = 1;
ewin->neverraise = 1;
ewin->skipfocus = 1;
b = (Border*)FindItem("BORDERLESS", 0, LIST_FINDBY_NAME,
LIST_TYPE_BORDER);
ewin->border_new = 1;
SetEwinToBorder(ewin, b);
}
else if (atom == _NET_WM_WINDOW_TYPE_DOCK)
{
ewin->skiptask = 1;
ewin->skipwinlist = 1;
ewin->focusclick = 1;
ewin->skipfocus = 1;
#if 0 /* I suggest to configure it explicitly if the behavior is desired */
ewin->layer = 5;
#endif
}
#if 0
else if (atom == _NET_WM_WINDOW_TYPE_TOOLBAR)
else if (atom == _NET_WM_WINDOW_TYPE_MENU)
else if (atom == _NET_WM_WINDOW_TYPE_UTILITY)
else if (atom == _NET_WM_WINDOW_TYPE_SPLASH)
else if (atom == _NET_WM_WINDOW_TYPE_DIALOG)
else if (atom == _NET_WM_WINDOW_TYPE_NORMAL)
#endif
Efree(p_atoms);
exit:
EDBUG_RETURN_;
}
void
EWMH_GetWindowHints(EWin *ewin)
{
EDBUG(6, "EWMH_GetWindowHints");
EWMH_GetWindowDesktop(ewin);
EWMH_GetWindowState(ewin);
EWMH_GetWindowType(ewin);
/* EWMH_GetWindowIcons(ewin); TBD */
EDBUG_RETURN_;
}
/*
* Delete all (_NET_...) properties set on window
*/
void
EWMH_DelWindowHints(const EWin *ewin)
{
EDBUG(6, "EWMH_DelWindowHints");
XDeleteProperty(disp, ewin->client.win, _NET_WM_DESKTOP);
XDeleteProperty(disp, ewin->client.win, _NET_WM_STATE);
EDBUG_RETURN_;
}
/*
* Process configuration requests from clients
*/
static int do_set(int is_set, int action)
{
switch (action)
{
case _NET_WM_STATE_REMOVE: return 0; break;
case _NET_WM_STATE_ADD: return 1; break;
case _NET_WM_STATE_TOGGLE: return !is_set; break;
}
}
void
EWMH_ProcessClientMessage(XClientMessageEvent *event)
{
EWin *ewin;
#if DEBUG_EWMH
char *name = XGetAtomName(disp, event->message_type);
printf("EWMH_ProcessClientMessage: ev_type=%s(%d) ev_win=%#x data[0-3]= %08x %08x %08x %08x\n",
name, event->message_type, event->window,
event->data.l[0], event->data.l[1],
event->data.l[2], event->data.l[3]);
XFree(name);
#endif
EDBUG(6, "EWMH_ProcessClientMessage");
/*
* The ones that don't target an application window
*/
if (event->message_type == _NET_CURRENT_DESKTOP)
{
GotoDesktop(event->data.l[0]);
}
/*
* The ones that do target an application window
*/
ewin = FindItem(NULL, event->window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin == NULL)
goto exit;
if (event->message_type == _NET_ACTIVE_WINDOW)
{
if (ewin->iconified)
{
DeIconifyEwin(ewin);
}
else
{
RaiseEwin(ewin);
if (ewin->shaded)
UnShadeEwin(ewin);
FocusToEWin(ewin);
}
}
else if (event->message_type == _NET_CLOSE_WINDOW)
{
KillEwin(ewin);
}
else if (event->message_type == _NET_WM_DESKTOP)
{
MoveEwinToDesktop(ewin, event->data.l[0]);
}
else if (event->message_type == _NET_WM_STATE)
{
/*
* It is assumed(!) that only the MAXIMIZE H/V ones can be set
* in one message.
*/
int action;
Atom atom, atom2;
action = event->data.l[0];
atom = event->data.l[1];
atom2 = event->data.l[2];
if (atom == _NET_WM_STATE_STICKY)
{
action = do_set(ewin->sticky, action);
if (action)
MakeWindowSticky(ewin);
else
MakeWindowUnSticky(ewin);
ewin->sticky = action;
}
else if (atom == _NET_WM_STATE_SHADED)
{
action = do_set(ewin->shaded, action);
if (action)
ShadeEwin(ewin);
else
UnShadeEwin(ewin);
ewin->shaded = action;
}
else if (atom == _NET_WM_STATE_SKIP_TASKBAR)
{
action = do_set(ewin->skiptask, action);
ewin->skiptask = action;
/* Set _NET_WM_STATE ? */
}
#if 0 /* Not Implemented */
else if (atom == _NET_WM_STATE_SKIP_PAGER)
{
action = do_set(ewin->skippager, action);
ewin->skippager = action;
/* Set _NET_WM_STATE ? */
}
#endif
else if (atom == _NET_WM_STATE_MAXIMIZED_VERT ||
atom == _NET_WM_STATE_MAXIMIZED_HORZ)
{
void (*func)(EWin*, char*);
int maskbits;
if (atom2 == _NET_WM_STATE_MAXIMIZED_VERT ||
atom2 == _NET_WM_STATE_MAXIMIZED_HORZ) /* (ok - ok) */
{
func = MaxSize;
maskbits = NET_WM_FLAG_MAXIMIZED_VERT |
NET_WM_FLAG_MAXIMIZED_HORZ;
}
else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
{
func = MaxHeight;
maskbits = NET_WM_FLAG_MAXIMIZED_VERT;
}
else
{
func = MaxWidth;
maskbits = NET_WM_FLAG_MAXIMIZED_HORZ;
}
if (ewin->ewmh_flags & maskbits)
{
if (action != _NET_WM_STATE_ADD) {
ewin->ewmh_flags &= ~maskbits;
ewin->toggle = 1;
}
}
else
{
if (action != _NET_WM_STATE_REMOVE) {
ewin->ewmh_flags |= maskbits;
ewin->toggle = 0;
}
}
func(ewin, "available");
RememberImportantInfoForEwin(ewin);
EWMH_SetWindowState(ewin);
ewin->toggle = 0;
}
#if 0 /* Not yet implemented */
else if (atom == _NET_WM_STATE_FULLSCREEN)
{
}
#endif
else if (atom == _NET_WM_STATE_ABOVE)
{
action = do_set(ewin->layer>=6, action);
if (action)
doSetLayer("6");
else
doSetLayer("4");
}
else if (atom == _NET_WM_STATE_BELOW)
{
action = do_set(ewin->layer<=2, action);
if (action)
doSetLayer("2");
else
doSetLayer("4");
}
}
else if (event->message_type == _NET_WM_MOVERESIZE)
{
switch (event->data.l[2])
{
case _NET_WM_MOVERESIZE_SIZE_KEYBOARD:
doResize(NULL);
break;
case _NET_WM_MOVERESIZE_MOVE_KEYBOARD:
doMove(NULL);
break;
}
}
exit:
EDBUG_RETURN_;
}
/*
* Process received window property change
*/
void
EWMH_ProcessPropertyChange(EWin *ewin, Atom atom_change)
{
#if DEBUG_EWMH
char *name = XGetAtomName(disp, atom_change);
printf("EWMH_ProcessPropertyChange: Atom=%s(%d) id=%#x\n",
name, atom_change, (ewin)?ewin->client.win:0);
XFree(name);
#endif
EDBUG(6, "EWMH_ProcessPropertyChange");
if (atom_change == _NET_WM_DESKTOP)
EWMH_GetWindowDesktop(ewin);
else if (atom_change == _NET_WM_STATE)
EWMH_GetWindowState(ewin);
EDBUG_RETURN_;
}

View File

@ -261,8 +261,7 @@ FocusToEWin(EWin * ewin)
{
if (!mode.cur_menu_mode)
mode.context_ewin = ewin;
if (mode.kde_support)
KDE_UpdateFocusedWindow();
HintsSetActiveWindow();
EDBUG_RETURN_;
}
/* Never focus a window that's not on the current desktop. That's just dumb. -- mej */
@ -282,8 +281,7 @@ FocusToEWin(EWin * ewin)
}
if (!mode.cur_menu_mode)
mode.context_ewin = ewin;
if (mode.kde_support)
KDE_UpdateFocusedWindow();
HintsSetActiveWindow();
EDBUG_RETURN_;
}
mode.windowdestroy = 0;
@ -306,8 +304,7 @@ FocusToEWin(EWin * ewin)
mode.focuswin = NULL;
mode.realfocuswin = NULL;
mode.context_ewin = NULL;
if (mode.kde_support)
KDE_UpdateFocusedWindow();
HintsSetActiveWindow();
EDBUG_RETURN_;
}
else if (!ewin->menu)
@ -364,8 +361,7 @@ FocusToEWin(EWin * ewin)
if (mode.focuswin)
DoIn("REVERSE_FOCUS_TIMEOUT", 0.5, ReverseTimeout,
mode.focuswin->client.win, NULL);
if (mode.kde_support)
KDE_UpdateFocusedWindow();
HintsSetActiveWindow();
EDBUG_RETURN_;
}

View File

@ -769,3 +769,104 @@ GNOME_SetHints(void)
GNOME_SetWMCheck();
EDBUG_RETURN_;
}
void
GNOME_ProcessClientMessage(XClientMessageEvent * event)
{
static Atom a2 = 0, a3 = 0, a4 = 0, a5 = 0;
EWin *ewin;
if (!a2)
a2 = XInternAtom(disp, "_WIN_AREA", False);
if (!a3)
a3 = XInternAtom(disp, "_WIN_WORKSPACE", False);
if (!a4)
a4 = XInternAtom(disp, "_WIN_LAYER", False);
if (!a5)
a5 = XInternAtom(disp, "_WIN_STATE", False);
if (event->message_type == a2)
{
SetCurrentArea(event->data.l[0], event->data.l[1]);
EDBUG_RETURN_;
}
if (event->message_type == a3)
{
GotoDesktop(event->data.l[0]);
EDBUG_RETURN_;
}
if (event->message_type == a4)
{
ewin =
FindItem(NULL, event->window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin)
{
ewin->layer = event->data.l[0];
XChangeProperty(disp, ewin->win, a4, XA_CARDINAL, 32,
PropModeReplace,
(unsigned char *)(&(event->data.l[0])), 1);
RaiseEwin(ewin);
}
EDBUG_RETURN_;
}
if (event->message_type == a5)
{
ewin =
FindItem(NULL, event->window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (!ewin)
EDBUG_RETURN_;
if (event->data.l[0] & WIN_STATE_FIXED_POSITION)
{
if (event->data.l[1] & WIN_STATE_FIXED_POSITION)
ewin->fixedpos = 1;
else
ewin->fixedpos = 0;
}
if (event->data.l[0] & WIN_STATE_ARRANGE_IGNORE)
{
if (event->data.l[1] & WIN_STATE_ARRANGE_IGNORE)
ewin->ignorearrange = 1;
else
ewin->ignorearrange = 0;
}
if ((event->data.l[0] & WIN_STATE_STICKY)
&& (!ewin->ignorearrange))
{
if (event->data.l[1] & WIN_STATE_STICKY)
{
if (!(ewin->sticky))
{
ewin->sticky = 1;
RaiseEwin(ewin);
DrawEwin(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_STICK", 0, LIST_FINDBY_NAME,
LIST_TYPE_SCLASS));
}
}
else
{
if (ewin->sticky)
{
ewin->sticky = 0;
RaiseEwin(ewin);
DrawEwin(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_UNSTICK", 0, LIST_FINDBY_NAME,
LIST_TYPE_SCLASS));
}
}
}
if (event->data.l[0] & WIN_STATE_SHADED)
{
if (event->data.l[1] & WIN_STATE_SHADED)
ShadeEwin(ewin);
else
UnShadeEwin(ewin);
}
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
}

269
src/hints.c Normal file
View File

@ -0,0 +1,269 @@
/*
* Copyright (C) 2003 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Feeble attempt to collect hint stuff in one place
*/
#include "E.h"
/*
* Functions that set X11-properties from E-internals
*/
void HintsInit(void)
{
EDBUG(6, "HintsInit");
#if ENABLE_KDE
/* ??? */
#endif
#if ENABLE_GNOME
GNOME_SetHints();
#endif
#if ENABLE_EWMH
EWMH_Init();
#endif
EDBUG_RETURN_;
}
void HintsSetClientList(void)
{
EDBUG(6, "HintsSetClientList");
#if ENABLE_GNOME
GNOME_SetClientList();
#endif
#if ENABLE_EWMH
EWMH_SetClientList();
#endif
EDBUG_RETURN_;
}
void HintsSetDesktopConfig(void)
{
EDBUG(6, "HintsSetDesktopConfig");
#if ENABLE_KDE
if (mode.kde_support)
KDE_SetNumDesktops();
#endif
#if ENABLE_GNOME
GNOME_SetDeskCount();
GNOME_SetDeskNames();
#endif
#if ENABLE_EWMH
EWMH_SetDesktopCount();
EWMH_SetDesktopNames();
EWMH_SetDesktopSize();
#endif
EDBUG_RETURN_;
}
void HintsSetViewportConfig(void)
{
EDBUG(6, "HintsSetViewportConfig");
#if ENABLE_GNOME
GNOME_SetAreaCount();
#endif
EDBUG_RETURN_;
}
void HintsSetCurrentDesktop(void)
{
EDBUG(6, "HintsSetCurrentDesktop");
#if ENABLE_KDE
if (mode.kde_support)
KDE_SetRootArea();
#endif
#if ENABLE_GNOME
GNOME_SetCurrentDesk();
#endif
#if ENABLE_EWMH
EWMH_SetCurrentDesktop();
#endif
HintsSetDesktopViewport();
EDBUG_RETURN_;
}
void HintsSetDesktopViewport(void)
{
EDBUG(6, "HintsSetDesktopViewport");
#if ENABLE_GNOME
GNOME_SetCurrentArea();
#endif
#if ENABLE_EWMH
EWMH_SetDesktopViewport();
#endif
EDBUG_RETURN_;
}
void HintsSetActiveWindow(void)
{
EDBUG(6, "HintsSetActiveWindow");
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateFocusedWindow();
#endif
#if ENABLE_EWMH
EWMH_SetActiveWindow();
#endif
EDBUG_RETURN_;
}
void HintsSetWindowDesktop(EWin *ewin)
{
EDBUG(6, "HintsSetWindowDesktop");
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateClient(ewin);
#endif
#if ENABLE_GNOME
GNOME_SetEwinDesk(ewin);
#endif
#if ENABLE_EWMH
if (!ewin->menu)
EWMH_SetWindowDesktop(ewin);
#endif
EDBUG_RETURN_;
}
void HintsSetWindowArea(EWin *ewin)
{
EDBUG(6, "HintsSetWindowArea");
#if ENABLE_GNOME
GNOME_SetEwinArea(ewin);
#endif
EDBUG_RETURN_;
}
void HintsSetWindowState(EWin *ewin)
{
EDBUG(6, "HintsSetWindowState");
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateClient(ewin);
#endif
#if ENABLE_GNOME
GNOME_SetHint(ewin);
#endif
#if ENABLE_EWMH
if (!ewin->menu)
EWMH_SetWindowState(ewin);
#endif
EDBUG_RETURN_;
}
void HintsSetWindowHints(EWin *ewin)
{
int kde_support = 0;
EDBUG(6, "HintsSetWindowHints");
#if ENABLE_KDE
kde_support = mode.kde_support;
if (mode.kde_support)
KDE_UpdateClient(ewin);
mode.kde_support = 0;
#endif
HintsSetWindowDesktop(ewin);
HintsSetWindowState(ewin);
#if ENABLE_KDE
mode.kde_support = kde_support;
#endif
EDBUG_RETURN_;
}
/*
* Functions that set E-internals from X11-properties
*/
void HintsGetWindowHints(EWin *ewin)
{
EDBUG(6, "HintsGetWindowHints");
#if ENABLE_GNOME
GNOME_GetHints(ewin, 0);
#endif
#if ENABLE_EWMH
EWMH_GetWindowHints(ewin);
#endif
EDBUG_RETURN_;
}
/*
* Functions that delete X11-properties
*/
void HintsDelWindowHints(EWin *ewin)
{
EDBUG(6, "HintsDelWindowHints");
#if ENABLE_KDE
if (mode.kde_support)
KDE_RemoveWindow(ewin);
#endif
#if ENABLE_GNOME
GNOME_DelHints(ewin);
#endif
#if ENABLE_EWMH
EWMH_DelWindowHints(ewin);
#endif
EDBUG_RETURN_;
}
/*
* Functions processing received X11 messages
*/
void HintsProcessPropertyChange(EWin *ewin, Atom atom_change)
{
EDBUG(6, "HintsHandlePropertyChange");
#if ENABLE_GNOME
GNOME_GetHints(ewin, atom_change);
#endif
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateFocusedWindow();
#endif
#if ENABLE_EWMH
EWMH_ProcessPropertyChange(ewin, atom_change);
#endif
EDBUG_RETURN_;
}
void HintsProcessClientMessage(XClientMessageEvent *event)
{
EDBUG(6, "HintsHandleClientMessage");
#if ENABLE_KDE
if (mode.kde_support)
KDE_ProcessClientMessage(event);
#endif
#if ENABLE_GNOME
GNOME_ProcessClientMessage(event);
#endif
#if ENABLE_EWMH
EWMH_ProcessClientMessage(event);
#endif
EDBUG_RETURN_;
}

View File

@ -272,14 +272,14 @@ IconifyEwin(EWin * ewin)
FocusToEWin(NULL);
}
}
GNOME_SetClientList();
HintsSetClientList();
Efree(lst);
}
}
}
call_depth--;
KDE_UpdateClient(ewin);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
@ -347,16 +347,15 @@ DeIconifyEwin(EWin * ewin)
lst[i]->iconified = 0;
}
}
GNOME_SetClientList();
HintsSetClientList();
Efree(lst);
}
}
}
call_depth--;
KDE_UpdateClient(ewin);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
void

View File

@ -78,7 +78,9 @@ void IPC_ListClassMembers(char *params, Client * c);
void IPC_GeneralInfo(char *params, Client * c);
void IPC_Modules(char *params, Client * c);
void IPC_DockConfig(char *params, Client * c);
#if ENABLE_KDE
void IPC_KDE(char *params, Client * c);
#endif
void IPC_MemDebug(char *params, Client * c);
void IPC_Remember(char *params, Client * c);
void IPC_CurrentTheme(char *params, Client * c);
@ -512,11 +514,13 @@ IPCStruct IPCArray[] = {
" group <groupid> stick <on/off/?>\n"
" group <groupid> shade <on/off/?>\n"
" group <groupid> mirror <on/off/?>\n"},
#if ENABLE_KDE
{
IPC_KDE,
"kde",
"Turns on and off KDE support",
"use \"kde on\" and \"kde off\" to enable/disable support"},
#endif
{
IPC_MemDebug,
"dump_mem_debug",
@ -747,6 +751,7 @@ IPC_Remember(char *params, Client * c)
return;
}
#if ENABLE_KDE
void
IPC_KDE(char *params, Client * c)
{
@ -790,6 +795,7 @@ IPC_KDE(char *params, Client * c)
CommsSend(c, buf);
return;
}
#endif
void
IPC_Modules(char *params, Client * c)

View File

@ -280,8 +280,7 @@ main(int argc, char **argv)
}
Efree(lst);
}
/* gnome hints stuff & session initialization here */
GNOME_SetHints();
HintsInit();
SessionInit();
ShowDesktopControls();
CheckEvent();
@ -291,8 +290,8 @@ main(int argc, char **argv)
if (mode.mapslide)
CreateStartupDisplay(0);
MapUnmap(1);
/* set some more stuff for gnome */
GNOME_SetCurrentArea();
/* set some more hints */
HintsSetDesktopViewport();
desks.current = 0;
/* Set up the internal pagers */
IB_Setup();
@ -308,11 +307,13 @@ main(int argc, char **argv)
XKillClient(disp, init_win_ext);
init_win_ext = 0;
}
GNOME_SetClientList();
HintsSetClientList();
#if ENABLE_KDE
/* start up any kde crap we might need to start up */
if (mode.kde_support)
KDE_Init();
#endif
/* sync just to make sure */
XSync(disp, False);

View File

@ -591,9 +591,11 @@ doSMExit(void *params)
}
else if (!strcmp(s, "restart_wm"))
{
#if ENABLE_KDE
/* kill off kde */
if (mode.kde_support)
KDE_Shutdown();
#endif
AUDIO_PLAY("SOUND_EXIT");
if (sound_fd >= 0)
close(sound_fd);
@ -691,9 +693,11 @@ doSMExit(void *params)
return;
}
}
#if ENABLE_KDE
/* kill off kde */
if (mode.kde_support)
KDE_Shutdown();
#endif
AUDIO_PLAY("SOUND_EXIT");
EExit(0);
}
@ -1299,9 +1303,11 @@ doSMExit(void *params)
else if (!strcmp(s, "restart_wm"))
{
AUDIO_PLAY("SOUND_WAIT");
#if ENABLE_KDE
/* kill off kde */
if (mode.kde_support)
KDE_Shutdown();
#endif
XCloseDisplay(disp);
disp = NULL;
Esnprintf(s, sizeof(s), "exec %s -display %s", atword(params, 2), dstr);
@ -1385,9 +1391,11 @@ doSMExit(void *params)
else if (!strcmp((char *)s, "error"))
EExit(0);
#if ENABLE_KDE
/* kill off kde */
if (mode.kde_support)
KDE_Shutdown();
#endif
restarting = False;
SaveSession(1);
AUDIO_PLAY("SOUND_EXIT");

View File

@ -1786,6 +1786,7 @@ SettingsTooltips(void)
ShowDialog(d);
}
#if ENABLE_KDE
static char tmp_kde;
static void CB_ConfigureKDE(int val, void *data);
static void
@ -1868,6 +1869,7 @@ SettingsKDE(void)
DialogBindKey(d, "Return", CB_ConfigureKDE, 0, d);
ShowDialog(d);
}
#endif
static char tmp_dialog_headers;
static void CB_ConfigureMiscellaneous(int val, void *data);

View File

@ -548,11 +548,13 @@ SetupX()
mode.manual_placement = 0;
mode.raise_on_next_focus = 1;
mode.raise_after_next_focus = 1;
#if ENABLE_KDE
mode.kde_support = 0;
mode.kde_x1 = 0;
mode.kde_y1 = 0;
mode.kde_x2 = root.w;
mode.kde_y2 = root.h;
#endif
#ifdef WITH_TARTY_WARP
mode.display_warp = 1;
#else

View File

@ -48,6 +48,7 @@ MaxHeight(EWin * ewin, char *resize_type)
{
y = ewin->y;
h = ewin->h;
#if ENABLE_KDE
if (mode.kde_support)
{
y1 = mode.kde_y1;
@ -55,9 +56,12 @@ MaxHeight(EWin * ewin, char *resize_type)
}
else
{
#endif
y1 = 0;
y2 = root.h;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -130,6 +134,7 @@ MaxHeight(EWin * ewin, char *resize_type)
{
y = ewin->y;
h = ewin->h;
#if ENABLE_KDE
if (mode.kde_support)
{
y1 = mode.kde_y1;
@ -137,9 +142,12 @@ MaxHeight(EWin * ewin, char *resize_type)
}
else
{
#endif
y1 = 0;
y2 = root.h;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -247,6 +255,7 @@ MaxWidth(EWin * ewin, char *resize_type)
{
x = ewin->x;
w = ewin->w;
#if ENABLE_KDE
if (mode.kde_support)
{
x1 = mode.kde_x1;
@ -254,9 +263,12 @@ MaxWidth(EWin * ewin, char *resize_type)
}
else
{
#endif
x1 = 0;
x2 = root.w;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -329,6 +341,7 @@ MaxWidth(EWin * ewin, char *resize_type)
{
x = ewin->x;
w = ewin->w;
#if ENABLE_KDE
if (mode.kde_support)
{
x1 = mode.kde_x1;
@ -336,9 +349,12 @@ MaxWidth(EWin * ewin, char *resize_type)
}
else
{
#endif
x1 = 0;
x2 = root.w;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -450,6 +466,7 @@ MaxSize(EWin * ewin, char *resize_type)
h = ewin->h;
x = ewin->x;
w = ewin->w;
#if ENABLE_KDE
if (mode.kde_support)
{
x1 = mode.kde_x1;
@ -459,11 +476,14 @@ MaxSize(EWin * ewin, char *resize_type)
}
else
{
#endif
x1 = 0;
x2 = root.w;
y1 = 0;
y2 = root.h;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -568,6 +588,7 @@ MaxSize(EWin * ewin, char *resize_type)
h = ewin->h;
x = ewin->x;
w = ewin->w;
#if ENABLE_KDE
if (mode.kde_support)
{
x1 = mode.kde_x1;
@ -577,11 +598,14 @@ MaxSize(EWin * ewin, char *resize_type)
}
else
{
#endif
x1 = 0;
x2 = root.w;
y1 = 0;
y2 = root.h;
#if ENABLE_KDE
}
#endif
#ifdef HAS_XINERAMA
if (xinerama_active)
{
@ -696,8 +720,10 @@ MaxSize(EWin * ewin, char *resize_type)
ewin->toggle = 0;
}
#if ENABLE_KDE
if (mode.kde_support)
KDE_UpdateClient(ewin);
#endif
return;
}

View File

@ -30,6 +30,8 @@ MakeWindowUnSticky(EWin * ewin)
if (!ewin)
EDBUG_RETURN_;
ewin->sticky = 2; /* Grrr: we are "unsticking" (hack to get the desktop right) */
ewin->desktop = desks.current;
FloatEwinAt(ewin, ewin->x, ewin->y);
DrawEwinShape(ewin, 0, ewin->x, ewin->y, ewin->client.w, ewin->client.h, 0);
MoveEwinToDesktopAt(ewin, desks.current, ewin->x, ewin->y);
@ -37,14 +39,12 @@ MakeWindowUnSticky(EWin * ewin)
RaiseEwin(ewin);
DrawEwin(ewin);
if (mode.kde_support)
KDE_UpdateClient(ewin);
HintsSetWindowState(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_UNSTICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
EDBUG_RETURN_;
}
void
@ -58,8 +58,7 @@ MakeWindowSticky(EWin * ewin)
RaiseEwin(ewin);
DrawEwin(ewin);
if (mode.kde_support)
KDE_UpdateClient(ewin);
HintsSetWindowState(ewin);
ApplySclass(FindItem
("SOUND_WINDOW_STICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));