Репозитории ALT
Группа :: Графические оболочки/Window Maker
Пакет: wmpager
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: wmpager-1.2-alt-EWMH.patch
Скачать
Скачать
--- wmpager-1.2-orig/src/wmpager.c 2005-06-04 16:03:02 +0400
+++ wmpager-1.2/src/wmpager.c 2005-06-04 18:41:59 +0400
@@ -30,13 +30,24 @@
#define BUILD_REV "$Revision: 1.4 $"
#define BUILD_DATE "$Date: 2002/08/16 17:22:26 $"
-#define XA_WIN_WORKSPACE "_WIN_WORKSPACE"
-#define XA_WIN_WORKSPACE_NAMES "_WIN_WORKSPACE_NAMES"
+#define XA_NET_NUMBER_OF_DESKTOPS "_NET_NUMBER_OF_DESKTOPS"
+#define XA_NET_CURRENT_DESKTOP "_NET_CURRENT_DESKTOP"
+#define XA_NET_DESKTOP_NAMES "_NET_DESKTOP_NAMES"
+/*#define XA_NET_DESKTOP_LAYOUT "_NET_DESKTOP_LAYOUT"
+
+#define _NET_WM_ORIENTATION_HORZ 0
+#define _NET_WM_ORIENTATION_VERT 1
+
+#define _NET_WM_TOPLEFT 0
+#define _NET_WM_TOPRIGHT 1
+#define _NET_WM_BOTTOMRIGHT 2
+#define _NET_WM_BOTTOMLEFT 3*/
#define WMPAGER_ENV "WMPAGER"
#define WMPAGER_DEFAULT_INSTALL_DIR "/usr/X11R6/share/wmpager/"
#define WMPAGER_USER_DIR ".wmpager/"
+#if 0
#define TOOLTIP_SUPPORT 1
#define TOOLTIP_FONT "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
#define TOOLTIP_OUTSIDE 0
@@ -48,6 +59,7 @@
#define TOOLTIP_BOTTOM 1
#define TOOLTIP_LEFT 0
#define TOOLTIP_RIGHT 2
+#endif
/*
* Prototypes
@@ -98,6 +110,7 @@
void setCurrentScreen (int nCurrentScreen);
void gotoScreen (int nWorkspace);
+#if 0
void initTooltip (int bTooltipSupport, char* szFontName, int bTooltipOutside);
void destroyTooltip ();
int hasTooltipSupport ();
@@ -106,6 +119,7 @@
int hasTooltip ();
void drawTooltipBalloon (Pixmap pix, GC gc, int x, int y, int w, int h, int side);
Pixmap createTooltipPixmap (int width, int height, int side, Pixmap *mask);
+#endif
/*
* Main
@@ -115,14 +129,18 @@
char* szDisplay= NULL;
char* szTheme= NULL;
char* szInstallDir= NULL;
+#if 0
char* szTooltipFont= TOOLTIP_FONT;
long nTooltipShowDelay= TOOLTIP_SHOW_DELAY;
long nTooltipReshowDelay= TOOLTIP_RESHOW_DELAY;
+#endif
int nWorkspaces= -1;
int bVerbose= 0;
int nSizeX= -1, nSizeY= -1;
+#if 0
int bTooltipSupport= TOOLTIP_SUPPORT;
int bTooltipOutside= TOOLTIP_OUTSIDE;
+#endif
int i;
initApplicationName(szArgv[0]);
/* we no longer use the WMPAGER environment variable
@@ -173,6 +191,7 @@
fprintf(stderr, "%s: display argument expected for '%s'\n\n", getApplicationName(), szArgv[i-1]);
usage(0);
}
+#if 0
} else if (strcmp("--disable-tooltips", szArgv[i]) == 0) {
bTooltipSupport= 0;
} else if (strcmp("--tooltip-outside", szArgv[i]) == 0) {
@@ -213,6 +232,7 @@
fprintf(stderr, "%s: delay argument expected for '%s'\n\n", getApplicationName(), szArgv[i-1]);
usage(0);
}
+#endif
} else if (strcmp("-d", szArgv[i]) == 0 || strcmp("--display", szArgv[i]) == 0) {
i+= 1;
if (i < nArgc) {
@@ -250,21 +270,27 @@
"[ ] - installdir= '%s'\n" \
"[ ] - theme= '%s'\n" \
"[ ] - workspaces= '%d'\n" \
- "[ ] - size= '%dx%d'\n" \
+ "[ ] - size= '%dx%d'\n"
+#if 0
"[ ] - tooltip support= %s\n" \
"[ ] - tooltip font= %s\n" \
"[ ] - tooltip show delay= %ld\n" \
"[ ] - tooltip reshow delay= %ld\n" \
- "[ ] - tooltip outside= %s\n",
+ "[ ] - tooltip outside= %s\n"
+#endif
+ ,
szRealDisplay,
szInstallDir == NULL ? "<undefined>" : szInstallDir,
szTheme == NULL ? "<built-in>" : szTheme,
nWorkspaces,
- nSizeX, nSizeY,
+ nSizeX, nSizeY
+#if 0
+ ,
bTooltipSupport ? "true" : "false",
szTooltipFont,
nTooltipShowDelay, nTooltipReshowDelay,
bTooltipOutside ? "true" : "false"
+#endif
);
}
initTime();
@@ -273,8 +299,12 @@
initScreens();
initButtons(nWorkspaces, nSizeX, nSizeY);
initWindowMask(szInstallDir, szTheme);
+#if 0
initTooltip(bTooltipSupport, szTooltipFont, bTooltipOutside);
loop(nTooltipShowDelay, nTooltipReshowDelay);
+#else
+ loop(-1, -1);
+#endif
return 0;
}
@@ -315,7 +345,8 @@
" -i --installdir <dir> specifies the installation directory location,\n" \
" this location is automatically searched for themes\n" \
" (defaults to the '/usr/X11R6/share/wmpager/'\n" \
- " and the user specific '~/.wmpager' directory)\n" \
+ " and the user specific '~/.wmpager' directory)\n"
+#if 0
" --disable-tooltips do not display any tooltip windows\n" \
" --tooltip-font <font> use the specified font as tooltip font\n" \
" (default is helvetica, bold, roman, 12 point)\n" \
@@ -325,6 +356,7 @@
" when moving from button to button (default is\n" \
" 1500 milliseconds)\n" \
" --tooltip-outside display tooltip window outside of docklet\n"
+#endif
void usage (int bVerbose) {
if (bVerbose) {
@@ -774,14 +806,20 @@
void loop (long nTooltipShowDelay, long nTooltipReshowDelay) {
Display* display= getDisplay();
XEvent event;
+#if 0
long nTooltipTimer= -1, nTooltipHideTimer= -1, nNow;
int nTooltipButton, nTooltipX, nTooltipY;
+#endif
if (isVerbose()) {
fprintf(stdout, "[%8ld] starting event loop\n", currentTimeMillis());
}
for (;;) {
- while (XPending(display) || (nTooltipTimer == -1)) {
+ while (XPending(display)
+#if 0
+ || (nTooltipTimer == -1)
+#endif
+ ) {
XNextEvent(display, &event);
switch (event.type) {
case Expose:
@@ -793,6 +831,7 @@
redrawWindow();
break;
case MotionNotify:
+#if 0
if (hasTooltipSupport()) {
if (!hasTooltip()) {
nTooltipTimer= currentTimeMillis();
@@ -811,13 +850,16 @@
}
}
}
+#endif
break;
case LeaveNotify:
+#if 0
if (hasTooltip()) {
hideTooltip();
nTooltipHideTimer= currentTimeMillis();
}
nTooltipTimer= -1;
+#endif
break;
case ButtonPress:
{
@@ -826,17 +868,19 @@
fprintf(stdout, "[%8ld] button %d pressed\n", currentTimeMillis(), nButton);
}
if (nButton != -1) {
+#if 0
if (hasTooltip()) {
hideTooltip();
nTooltipHideTimer= currentTimeMillis();
}
+#endif
setCurrentScreen(nButton);
gotoScreen(nButton);
}
}
break;
case PropertyNotify:
- if (strcmp(XA_WIN_WORKSPACE, XGetAtomName(getDisplay(), event.xproperty.atom)) == 0) {
+ if (strcmp(XA_NET_CURRENT_DESKTOP, XGetAtomName(getDisplay(), event.xproperty.atom)) == 0) {
setCurrentScreen(-1);
if (isVerbose()) {
fprintf(stdout, "[%8ld] new current workspace (%d= %s)\n",
@@ -849,7 +893,9 @@
if (isVerbose()) {
fprintf(stdout, "[%8ld] quit application\n", currentTimeMillis());
}
+#if 0
destroyTooltip();
+#endif
destroyWindow();
destroyDisplay();
exit(0);
@@ -857,6 +903,7 @@
}
}
usleep(50000);
+#if 0
nNow= currentTimeMillis();
if (
nTooltipTimer != -1 &&
@@ -869,6 +916,7 @@
showTooltip(nTooltipButton, nTooltipX, nTooltipY);
nTooltipTimer= -1;
}
+#endif
}
}
@@ -1027,10 +1075,12 @@
* Screen Handling
*/
-static Atom _xaWinWorkspace;
-static Atom _xaWinWorkspaceNames;
+static Atom _xaNetNumberOfDesktops;
+static Atom _xaNetCurrentDesktop;
+/*static Atom _xaNetDesktopNames;*/
static int _nScreens;
-static char** _szScreenNames;
+static int _nScreenNames = 0;
+static char** _szScreenNames = NULL;
static int _nLastScreen;
int getScreenCount () {
@@ -1038,8 +1088,8 @@
}
char* getScreenName (int nScreen) {
- if (nScreen < 0 || nScreen >= _nScreens) {
- return NULL;
+ if (nScreen < 0 || nScreen >= _nScreenNames) {
+ return "<unnamed>";
}
return _szScreenNames[nScreen];
}
@@ -1049,7 +1099,7 @@
event.type= ClientMessage;
event.xclient.type= ClientMessage;
event.xclient.window= getRootWindow();
- event.xclient.message_type= _xaWinWorkspace;
+ event.xclient.message_type= _xaNetCurrentDesktop;
event.xclient.format= 32;
event.xclient.data.l[0]= nWorkspace;
event.xclient.data.l[1]= currentTimeMillis();
@@ -1069,7 +1119,7 @@
unsigned char* data;
XGetWindowProperty(
- getDisplay(), getRootWindow(), _xaWinWorkspace,
+ getDisplay(), getRootWindow(), _xaNetCurrentDesktop,
0, 8192, False, XA_CARDINAL, &xaType, &nFormat, &nItems, &nBytesAfter, &data
);
if ((nFormat == 32) && (nItems == 1) && (nBytesAfter == 0)) {
@@ -1085,22 +1135,35 @@
}
void initScreens () {
- XTextProperty tp;
+ /*XTextProperty tp;*/
+ Atom xaType;
+ int nFormat;
+ unsigned long nItems, nBytesAfter;
+ unsigned char* data;
if (isVerbose()) {
fprintf(stdout, "[%8ld] initializing window maker communication\n", currentTimeMillis());
}
- _xaWinWorkspace= XInternAtom(getDisplay(), XA_WIN_WORKSPACE, False);
- _xaWinWorkspaceNames= XInternAtom(getDisplay(), XA_WIN_WORKSPACE_NAMES, False);
- XGetTextProperty(getDisplay(), getRootWindow(), &tp, _xaWinWorkspaceNames);
- XTextPropertyToStringList(&tp, &_szScreenNames, &_nScreens);
+ _xaNetCurrentDesktop= XInternAtom(getDisplay(), XA_NET_CURRENT_DESKTOP, False);
+ _xaNetNumberOfDesktops= XInternAtom(getDisplay(), XA_NET_NUMBER_OF_DESKTOPS, False);
+ /*_xaNetDesktopNames= XInternAtom(getDisplay(), XA_NET_DESKTOP_NAMES, False);*/
+ XGetWindowProperty(getDisplay(), getRootWindow(), _xaNetNumberOfDesktops,
+ 0, 8192, False, XA_CARDINAL, &xaType, &nFormat, &nItems, &nBytesAfter, &data);
+ if ((nFormat == 32) && (nItems == 1) && (nBytesAfter == 0)) {
+ _nScreens= *(long*) data;
+ }
+ if (xaType != None) {
+ XFree(data);
+ }
+ /*XGetTextProperty(getDisplay(), getRootWindow(), &tp, _xaNetDesktopNames);
+ XTextPropertyToStringList(&tp, &_szScreenNames, &_nScreenNames);*/
_nLastScreen= -1;
setCurrentScreen(-1);
if (_nLastScreen == -1) {
fprintf(
stderr,
"%s: couldn't determine current workspace.\n" \
- "Make sure your WindowMaker has Gnome support enabled!\n",
+ "Make sure your WindowMaker has EWMH support enabled!\n",
getApplicationName()
);
setCurrentScreen(0);
@@ -1120,6 +1183,7 @@
* Tooltip
*/
+#if 0
int _bTooltip= 0, _bTooltipSupport, _bTooltipOutside;
XFontStruct* _fTooltip;
int _nFontHeight, _nFontY;
@@ -1368,4 +1432,5 @@
return pixmap;
}
+#endif