1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-04-24 01:21:27 +02:00

- Check whether libXft is at least version 2.1.2 else refuse to compile.

- Fixed bug in icon chooser dialog that could cause a segmentation fault
  in some cases (Pascal Hofstee <caelian@gmail.com>)
- Fixed crash in asm code in wrlib, with new versions of gcc.
- Fixed bug in the x86_PseudoColor_32_to_8() function which incorrectly
  used the r, g, b fields in the conversion.
- Fixed x86 ASM code in wrlib to work on 64 bit architectures.
- Fixed the focus flicker seen with some apps (notably gtk2)
  (Alexey Spiridonov <snarkmaster@gmail.com>)
- Fixed all crashing bugs that were generated by wmaker starting with the
  WMState file missing.
- Added NetWM support (a modified version of the patch originaly written
  by Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied patch to enhance the Virtual Desktop behaviour, and to integrate
  it with the NetWM code (Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied a few xinerama and placement fixes (Peter Zijlstra
    <a.p.zijlstra@chello.nl>)
- Fixed memory leak in dock code.
- Fixed and enhanced the text wrapping in WINGs.
- Fixed the layout of some elements in WPrefs.app
- Added workaround for aplications that don't set the required hints on the
  client leader window, but they set them on normal windows (observer with
  KDE 3.3.0 mainly). This will allow these apps to get an appicon again.
  (they should be fixed still)
- Added workaround for applications that do not set a command with
  XSetCommand(), but instead they set the _NET_WM_PID property. This works
  with operating systems that offer a /proc interface similar to what linux
  has. (This also is to fix problems with KDE 3.3.0 apps, but not only them).
- Fixed bug with autostart and exit scripts not being executed if user
  GNUstep path was different from ~/GNUstep (when setting GNUSTEP_USER_ROOT)
- Added utf8 support in WINGs (removed old X core font code)
- Added utility to convert old font names to new font names in style files
This commit is contained in:
dan
2004-10-12 01:34:32 +00:00
parent c7c68c6fe7
commit 9aca0d5f6e
88 changed files with 6638 additions and 3497 deletions
+31 -2
View File
@@ -110,7 +110,6 @@ Changes since version 0.80.2:
(Marcelo E. Magallon <marcelo.magallon@bigfoot.com>)
- Do not use the disabled clip color for the clip's workspace navigation arrows
when the clip is collapsed (it made them look like disabled)
- Fixed the 'focus flicker' problem, seen with GTK2 applications.
- Fixed bug with incorrect un-escaping if there is a dot in wm_class.
- Updated Catalan translations (Ernest Adrogue <eadrogue@gmx.net>)
- Updated Spanish translation of WPrefs (Alberto Gimenez <algibe@teleline.es>)
@@ -123,12 +122,42 @@ Changes since version 0.80.2:
appicon when a KDE3 application opens a config panel.
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)
- Check whether libXft is at least version 2.1.2 else refuse to compile.
- Fixed bug in icon chooser dialog that could cause a segmentation fault
in some cases (Pascal Hofstee <caelian@gmail.com>)
- Fixed crash in asm code in wrlib, with new versions of gcc.
- Fixed bug in the x86_PseudoColor_32_to_8() function which incorrectly
used the r, g, b fields in the conversion.
- Fixed x86 ASM code in wrlib to work on 64 bit architectures.
- Fixed the focus flicker seen with some apps (notably gtk2)
(Alexey Spiridonov <snarkmaster@gmail.com>)
- Fixed all crashing bugs that were generated by wmaker starting with the
WMState file missing.
- Added NetWM support (a modified version of the patch originaly written
by Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied patch to enhance the Virtual Desktop behaviour, and to integrate
it with the NetWM code (Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied a few xinerama and placement fixes (Peter Zijlstra
<a.p.zijlstra@chello.nl>)
- Fixed memory leak in dock code.
- Fixed and enhanced the text wrapping in WINGs.
- Fixed the layout of some elements in WPrefs.app
- Added workaround for aplications that don't set the required hints on the
client leader window, but they set them on normal windows (observer with
KDE 3.3.0 mainly). This will allow these apps to get an appicon again.
(they should be fixed still)
- Added workaround for applications that do not set a command with
XSetCommand(), but instead they set the _NET_WM_PID property. This works
with operating systems that offer a /proc interface similar to what linux
has. (This also is to fix problems with KDE 3.3.0 apps, but not only them).
- Fixed bug with autostart and exit scripts not being executed if user
GNUstep path was different from ~/GNUstep (when setting GNUSTEP_USER_ROOT)
Changes since version 0.80.1:
.............................
- Fixed a buffer overflow when allocating an RImage struct.
- Fixed a buffer overflow when allocating a RImage struct.
Changes since version 0.80.0:
-1
View File
@@ -61,4 +61,3 @@ sample implementation (twm?) it might be supported. Maybe dtwm supports
it? I dont know...
+4 -3
View File
@@ -1,8 +1,8 @@
Changes since wmaker 0.80.1:
............................
- added WMSetConnectionShutdownOnClose()
- added an extra member to the ConnectionDelegate: canResumeSending
- Added WMSetConnectionShutdownOnClose()
- Added an extra member to the ConnectionDelegate: canResumeSending
see NEWS for details.
- WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
arguments. WMDrawImageString() receives 2 colors (text & background).
@@ -49,12 +49,13 @@ Changes since wmaker 0.80.1:
- Fixed a memleak in the file panel.
- Double/triple-click selection in text widgets
(Vitaly Ovtchinnikov <ov@rbcmail.ru>)
- fixed bug in tableview (clicked row callback got incorrect row)
- Fixed bug in tableview (clicked row callback got incorrect row)
(Carlos Torres <vlaadbrain@operamail.com>)
- Fixed bug in resizing a scrollview
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
- Added wmkrect()
- Added xdnd v3 support (Sylvain Reynal <sreynal@nerim.net>)
- Fixed and enhanced text wrapping.
Changes since wmaker 0.80.0:
+7 -4
View File
@@ -21,7 +21,8 @@ int MoveCount;
int WinSize = 120;
Bool CheckWin(void)
Bool
CheckWin(void)
{
int i;
@@ -34,15 +35,17 @@ Bool CheckWin(void)
}
void MoveButton(int button, int x, int y)
void
MoveButton(int button, int x, int y)
{
WMMoveWidget(Button[button], x*(WinSize/Size), y*(WinSize/Size));
}
Bool SlideButton(int button)
Bool
SlideButton(int button)
{
int x, y, done = 0;
int x=0, y=0, done = 0;
/* locate the button */
for (y = 0; y < Size; y++) {
+1
View File
@@ -22,6 +22,7 @@ libExtraWINGs_a_SOURCES = \
wtableview.h \
wtabledelegates.h
AM_CFLAGS = -fno-strict-aliasing
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
+3 -1
View File
@@ -108,7 +108,9 @@ libWUtil_a_SOURCES = \
wutil.c
AM_CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
AM_CFLAGS = -fno-strict-aliasing
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG
+6 -4
View File
@@ -116,14 +116,14 @@ testFrame(WMScreen *scr)
}
static void
/*static void
resizedWindow(void *self, WMNotification *notif)
{
WMView *view = (WMView*)WMGetNotificationObject(notif);
WMSize size = WMGetViewSize(view);
WMResizeWidget((WMWidget*)self, size.width, size.height);
}
}*/
void
testBox(WMScreen *scr)
@@ -609,7 +609,8 @@ testText(WMScreen *scr)
WMFont *font, *ifont;
font = WMDefaultSystemFont(scr);
ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
//ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
ifont = WMCreateFont(scr, "verdana,sans:pixelsize=12:italic");
if (ifont) {
WMSetTextDefaultFont(text, ifont);
WMReleaseFont(ifont);
@@ -619,7 +620,7 @@ testText(WMScreen *scr)
WMReleaseFont(font);
}
if(file) {
if (file) {
char buf[1024];
WMFreezeText(text);
@@ -1042,6 +1043,7 @@ main(int argc, char **argv)
testColorPanel(scr);
testFrame(scr);
#if 0
testBox(scr);
+3 -4
View File
@@ -1834,12 +1834,11 @@ void WMShowFontPanel(WMFontPanel *panel);
void WMHideFontPanel(WMFontPanel *panel);
void WMFreeFontPanel(WMFontPanel *panel);
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
void WMSetFontPanelFont(WMFontPanel *panel, WMFont *font);
/* you can free the returned string */
char* WMGetFontPanelFontName(WMFontPanel *panel);
void WMSetFontPanelFont(WMFontPanel *panel, char *fontName);
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
+3 -8
View File
@@ -22,19 +22,14 @@
extern "C" {
#endif /* __cplusplus */
#define DOUBLE_BUFFER
#define DOUBLE_BUFFER 1
#define WC_UserWidget 128
#define SCROLLER_WIDTH 20
#define SCROLLER_WIDTH 20
#define XDND_VERSION 4
#define XDND_VERSION 4
typedef struct W_Application {
+1 -4
View File
@@ -14,10 +14,6 @@ _WINGsConfiguration WINGsConfiguration;
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
#define XFTSYSTEM_FONT "-*-arial-medium-r-normal-*-%d-*-*-*-*-*-*-*"
#define XFTBOLD_SYSTEM_FONT "-*-arial-bold-r-normal-*-%d-*-*-*-*-*-*-*"
#define FLOPPY_PATH "/floppy"
@@ -45,6 +41,7 @@ getButtonWithName(const char *name, unsigned defaultButton)
}
// fix this
static Bool
missingOrInvalidXLFD(char *xlfd)
{
+7 -6
View File
@@ -193,14 +193,15 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
WMDraggingInfo *info = &scr->dragInfo;
Atom messageType = event->message_type;
char* msgTypeName = XGetAtomName(scr->display, messageType);
#ifdef XDND_DEBUG
{
char* msgTypeName = XGetAtomName(scr->display, messageType);
if (msgTypeName != NULL)
printf("event type = %s\n", msgTypeName);
else
printf("pb with event type !\n");
if (msgTypeName != NULL)
printf("event type = %s\n", msgTypeName);
else
printf("pb with event type !\n");
}
#endif
+2 -3
View File
@@ -79,7 +79,7 @@ createDropDataArray(WMArray *requiredTypes)
static WMArray*
getTypesFromTypeList(WMScreen *scr, Window sourceWin)
{
WMDraggingInfo *info = &scr->dragInfo;
/* // WMDraggingInfo *info = &scr->dragInfo;*/
Atom dataType;
Atom* typeAtomList;
WMArray* typeList;
@@ -365,7 +365,6 @@ W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info,
WMView *toplevel, XClientMessageEvent *event)
{
WMScreen *scr = W_VIEW_SCREEN(toplevel);
int i,j, typesCount;
if (XDND_DEST_INFO(info) == NULL)
initDestinationDragInfo(info);
@@ -609,7 +608,7 @@ static void
sendAllowedAction(WMView *destView, Atom action)
{
WMScreen *scr = W_VIEW_SCREEN(destView);
WMPoint destPos = WMGetViewScreenPosition(destView);
/* // WMPoint destPos = WMGetViewScreenPosition(destView); */
WMSize destSize = WMGetViewSize(destView);
int destX, destY;
Window foo;
+4 -2
View File
@@ -425,6 +425,8 @@ sendEnterMessage(WMDraggingInfo *info)
}
// this functon doesn't return something in all cases.
// control reaches end of non-void function. fix this -Dan
static Bool
sendPositionMessage(WMDraggingInfo *info, WMPoint *mousePos)
{
@@ -740,7 +742,6 @@ isXdndAware(WMScreen *scr, Window win)
int format;
unsigned long count, remain;
unsigned char *winXdndVersion;
unsigned char *proxy;
if (win == None)
return False;
@@ -876,7 +877,7 @@ initMotionProcess(WMView *view, WMDraggingInfo *info,
static void
processMotion(WMDraggingInfo *info, Window windowUnderDrag, WMPoint *mousePos)
{
WMScreen *scr = sourceScreen(info);
/* // WMScreen *scr = sourceScreen(info); */
Window newDestination = findDestination(info, mousePos);
W_DragSourceStopTimer();
@@ -1058,6 +1059,7 @@ traceStatusMsg(Display *dpy, XClientMessageEvent *statusEvent)
#endif
static void
storeDropAction(WMDraggingInfo *info, Atom destAction)
{
WMView* sourceView = XDND_SOURCE_VIEW(info);
+8 -6
View File
@@ -26,10 +26,11 @@ class WMTimer:
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
else:
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
self.__WMDeleteTimerHandler = wings.pyWMDeleteTimerHandler
def __del__(self):
wings.pyWMDeleteTimerHandler(self._o)
#delete = __del__
self.__WMDeleteTimerHandler(self._o)
class WMPersistentTimer(WMTimer):
def __init__(self, milliseconds, callback, cdata=None):
@@ -87,14 +88,15 @@ class WMView:
class WMWidget(WMView):
def __init__(self):
self._o = None
if self.__class__ == WMWidget:
raise Error, "a WMWidget can't be instantiated directly"
self._o = None
self.__WMDestroyWidget = wings.WMDestroyWidget
def __del__(self):
if (self._o != None):
wings.WMDestroyWidget(self._o)
if self._o is not None:
self.__WMDestroyWidget(self._o)
def resize(self, width, height):
wings.WMResizeWidget(self._o, width, height)
+5 -5
View File
@@ -272,7 +272,7 @@ WMGetStandardUserDefaults(void)
defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
defaults->defaults = WMCreatePLDictionary(NULL, NULL);
defaults->searchList = wmalloc(sizeof(WMPropList*)*3);
@@ -293,7 +293,7 @@ WMGetStandardUserDefaults(void)
domain = WMReadPropListFromFile(path);
if (!domain)
domain = WMCreatePLDictionary(NULL, NULL, NULL);
domain = WMCreatePLDictionary(NULL, NULL);
if (path)
wfree(path);
@@ -314,7 +314,7 @@ WMGetStandardUserDefaults(void)
wfree(path);
if (!domain)
domain = WMCreatePLDictionary(NULL, NULL, NULL);
domain = WMCreatePLDictionary(NULL, NULL);
if (domain)
WMPutInPLDictionary(defaults->defaults, key, domain);
@@ -367,7 +367,7 @@ WMGetDefaultsFromPath(char *path)
defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
defaults->defaults = WMCreatePLDictionary(NULL, NULL);
defaults->searchList = wmalloc(sizeof(WMPropList*)*2);
@@ -387,7 +387,7 @@ WMGetDefaultsFromPath(char *path)
domain = WMReadPropListFromFile(path);
if (!domain)
domain = WMCreatePLDictionary(NULL, NULL, NULL);
domain = WMCreatePLDictionary(NULL, NULL);
defaults->path = wstrdup(path);
+2 -2
View File
@@ -66,8 +66,8 @@ static WMEventHook *extraEventHandler=NULL;
*
*/
void
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
void *clientData)
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
void *clientData)
{
W_EventHandler *hPtr;
WMArrayIterator iter;
+79 -1351
View File
File diff suppressed because it is too large Load Diff
+769
View File
@@ -0,0 +1,769 @@
#include "wconfig.h"
#ifndef XFT
#include "WINGsP.h"
#include <wraster.h>
#include <assert.h>
#include <X11/Xlocale.h>
static char *makeFontSetOfSize(char *fontset, int size);
/* XLFD pattern matching */
static char*
getElementFromXLFD(const char *xlfd, int index)
{
const char *p = xlfd;
while (*p != 0) {
if (*p == '-' && --index == 0) {
const char *end = strchr(p + 1, '-');
char *buf;
size_t len;
if (end == 0) end = p + strlen(p);
len = end - (p + 1);
buf = wmalloc(len);
memcpy(buf, p + 1, len);
buf[len] = 0;
return buf;
}
p++;
}
return strdup("*");
}
/* XLFD pattern matching */
static char*
generalizeXLFD(const char *xlfd)
{
char *buf;
int len;
char *weight = getElementFromXLFD(xlfd, 3);
char *slant = getElementFromXLFD(xlfd, 4);
char *pxlsz = getElementFromXLFD(xlfd, 7);
#define Xstrlen(A) ((A)?strlen(A):0)
len = Xstrlen(xlfd)+Xstrlen(weight)+Xstrlen(slant)+Xstrlen(pxlsz)*2+60;
#undef Xstrlen
buf = wmalloc(len + 1);
snprintf(buf, len + 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
xlfd, weight, slant, pxlsz, pxlsz);
wfree(pxlsz);
wfree(slant);
wfree(weight);
return buf;
}
/* XLFD pattern matching */
static XFontSet
W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
int *nmissing, char **def_string)
{
XFontSet fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
if (fs != NULL && *nmissing == 0) return fs;
/* for non-iso8859-1 language and iso8859-1 specification
(this fontset is only for pattern analysis) */
if (fs == NULL) {
if (*nmissing != 0) XFreeStringList(*missing);
setlocale(LC_CTYPE, "C");
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
setlocale(LC_CTYPE, "");
}
/* make XLFD font name for pattern analysis */
if (fs != NULL) {
XFontStruct **fontstructs;
char **fontnames;
if (XFontsOfFontSet(fs, &fontstructs, &fontnames) > 0)
xlfd = fontnames[0];
}
xlfd = generalizeXLFD(xlfd);
if (*nmissing != 0) XFreeStringList(*missing);
if (fs != NULL) XFreeFontSet(dpy, fs);
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
wfree(xlfd);
return fs;
}
static char*
xlfdFromFontName(char *fontName)
{
char *systemFont, *boldSystemFont;
char *font;
int size;
systemFont = WINGsConfiguration.systemFont;
boldSystemFont = WINGsConfiguration.boldSystemFont;
size = WINGsConfiguration.defaultFontSize;
if (strcmp(fontName, "SystemFont")==0) {
font = systemFont;
} else if (strncmp(fontName, "SystemFont-", 11)==0) {
font = systemFont;
if (sscanf(&fontName[11], "%i", &size)!=1) {
size = WINGsConfiguration.defaultFontSize;
wwarning(_("Invalid size specification '%s' in %s. "
"Using default %d\n"), &fontName[11], fontName, size);
}
} else if (strcmp(fontName, "BoldSystemFont")==0) {
font = boldSystemFont;
} else if (strncmp(fontName, "BoldSystemFont-", 15)==0) {
font = boldSystemFont;
if (sscanf(&fontName[15], "%i", &size)!=1) {
size = WINGsConfiguration.defaultFontSize;
wwarning(_("Invalid size specification '%s' in %s. "
"Using default %d\n"), &fontName[15], fontName, size);
}
} else {
font = NULL;
}
return (font!=NULL ? makeFontSetOfSize(font, size) : wstrdup(fontName));
}
WMFont*
WMCreateFontSet(WMScreen *scrPtr, char *fontName)
{
WMFont *font;
Display *display = scrPtr->display;
char **missing;
int nmissing = 0;
char *defaultString;
char *fname;
XFontSetExtents *extents;
fname = xlfdFromFontName(fontName);
font = WMHashGet(scrPtr->fontSetCache, fname);
if (font) {
WMRetainFont(font);
wfree(fname);
return font;
}
font = wmalloc(sizeof(WMFont));
memset(font, 0, sizeof(WMFont));
font->notFontSet = 0;
font->screen = scrPtr;
font->font.set = W_CreateFontSetWithGuess(display, fname, &missing,
&nmissing, &defaultString);
if (nmissing > 0 && font->font.set) {
int i;
wwarning(_("the following character sets are missing in %s:"), fname);
for (i = 0; i < nmissing; i++) {
wwarning(missing[i]);
}
XFreeStringList(missing);
if (defaultString)
wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
defaultString);
}
if (!font->font.set) {
wfree(font);
wfree(fname);
return NULL;
}
extents = XExtentsOfFontSet(font->font.set);
font->height = extents->max_logical_extent.height;
font->y = font->height - (font->height + extents->max_logical_extent.y);
font->refCount = 1;
font->name = fname;
assert(WMHashInsert(scrPtr->fontSetCache, font->name, font)==NULL);
return font;
}
WMFont*
WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
{
WMFont *font;
Display *display = scrPtr->display;
char *fname, *ptr;
fontName = xlfdFromFontName(fontName);
if ((ptr = strchr(fontName, ','))) {
fname = wmalloc(ptr - fontName + 1);
strncpy(fname, fontName, ptr - fontName);
fname[ptr - fontName] = 0;
} else {
fname = wstrdup(fontName);
}
wfree(fontName);
font = WMHashGet(scrPtr->fontCache, fname);
if (font) {
WMRetainFont(font);
wfree(fname);
return font;
}
font = wmalloc(sizeof(WMFont));
memset(font, 0, sizeof(WMFont));
font->notFontSet = 1;
font->screen = scrPtr;
font->font.normal = XLoadQueryFont(display, fname);
if (!font->font.normal) {
wfree(font);
wfree(fname);
return NULL;
}
font->height = font->font.normal->ascent+font->font.normal->descent;
font->y = font->font.normal->ascent;
font->refCount = 1;
font->name = fname;
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
return font;
}
WMFont*
WMCreateFont(WMScreen *scrPtr, char *fontName)
{
return WMCreateFontWithFlags(scrPtr, fontName, WFDefaultFont);
}
WMFont*
WMCreateFontWithFlags(WMScreen *scrPtr, char *fontName, WMFontFlags flags)
{
Bool multiByte = scrPtr->useMultiByte;
WMFont *font;
if (flags & WFFontSet) {
multiByte = True;
} else if (flags & WFNormalFont) {
multiByte = False;
}
} else if (multiByte) {
font = WMCreateFontSet(scrPtr, fontName);
} else {
font = WMCreateNormalFont(scrPtr, fontName);
}
return font;
}
WMFont*
WMRetainFont(WMFont *font)
{
wassertrv(font!=NULL, NULL);
font->refCount++;
return font;
}
void
WMReleaseFont(WMFont *font)
{
wassertr(font!=NULL);
font->refCount--;
if (font->refCount < 1) {
if (font->notFontSet) {
XFreeFont(font->screen->display, font->font.normal);
} else {
XFreeFontSet(font->screen->display, font->font.set);
}
if (font->name) {
if (font->notFontSet) {
WMHashRemove(font->screen->fontCache, font->name);
} else {
WMHashRemove(font->screen->fontSetCache, font->name);
}
wfree(font->name);
}
wfree(font);
}
}
Bool
WMIsAntialiasingEnabled(WMScreen *scrPtr)
{
return False;
}
unsigned int
WMFontHeight(WMFont *font)
{
wassertrv(font!=NULL, 0);
return font->height;
}
char*
WMGetFontName(WMFont *font)
{
wassertrv(font!=NULL, NULL);
return font->name;
}
WMFont*
WMDefaultSystemFont(WMScreen *scrPtr)
{
return WMRetainFont(scrPtr->normalFont);
}
WMFont*
WMDefaultBoldSystemFont(WMScreen *scrPtr)
{
return WMRetainFont(scrPtr->boldFont);
}
static WMFont*
makeSystemFontOfSize(WMScreen *scrPtr, int size, Bool bold)
{
WMFont *font;
char *fontSpec;
#define WConf WINGsConfiguration
if (bold) {
fontSpec = makeFontSetOfSize(WConf.boldSystemFont, size);
} else {
fontSpec = makeFontSetOfSize(WConf.systemFont, size);
}
#undef WConf
if (scrPtr->useMultiByte) {
font = WMCreateFontSet(scrPtr, fontSpec);
} else {
font = WMCreateNormalFont(scrPtr, fontSpec);
}
if (!font) {
if (scrPtr->useMultiByte) {
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else {
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
return NULL;
}
}
wfree(fontSpec);
return font;
}
WMFont*
WMSystemFontOfSize(WMScreen *scrPtr, int size)
{
return makeSystemFontOfSize(scrPtr, size, False);
}
WMFont*
WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
{
return makeSystemFontOfSize(scrPtr, size, True);
}
XFontSet
WMGetFontFontSet(WMFont *font)
{
wassertrv(font!=NULL, NULL);
if (!font->notFontSet && !font->antialiased)
return font->font.set;
return NULL;
}
int
WMWidthOfString(WMFont *font, char *text, int length)
{
wassertrv(font!=NULL, 0);
wassertrv(text!=NULL, 0);
if (font->notFontSet) {
return XTextWidth(font->font.normal, text, length);
} else {
XRectangle rect;
XRectangle AIXsucks;
XmbTextExtents(font->font.set, text, length, &AIXsucks, &rect);
return rect.width;
}
}
void
WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int x, int y, char *text, int length)
{
wassertr(font!=NULL);
if (font->notFontSet) {
XSetFont(scr->display, scr->drawStringGC, font->font.normal->fid);
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
XDrawString(scr->display, d, scr->drawStringGC, x, y + font->y,
text, length);
} else {
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
XmbDrawString(scr->display, d, font->font.set, scr->drawStringGC,
x, y + font->y, text, length);
}
}
void
WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background,
WMFont *font, int x, int y, char *text, int length)
{
wassertr(font!=NULL);
if (font->notFontSet) {
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
XSetFont(scr->display, scr->drawImStringGC, font->font.normal->fid);
XDrawImageString(scr->display, d, scr->drawImStringGC,
x, y + font->y, text, length);
} else {
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
XmbDrawImageString(scr->display, d, font->font.set, scr->drawImStringGC,
x, y + font->y, text, length);
}
}
static char*
makeFontSetOfSize(char *fontset, int size)
{
char font[300], *f;
char *newfs = NULL;
char *ptr;
do {
char *tmp;
int end;
f = fontset;
ptr = strchr(fontset, ',');
if (ptr) {
int count = ptr-fontset;
if (count > 255) {
wwarning(_("font description %s is too large."), fontset);
} else {
memcpy(font, fontset, count);
font[count] = 0;
f = (char*)font;
}
}
if (newfs)
end = strlen(newfs);
else
end = 0;
tmp = wmalloc(end + strlen(f) + 8);
if (end != 0) {
sprintf(tmp, "%s,", newfs);
sprintf(tmp + end + 1, f, size);
} else {
sprintf(tmp + end, f, size);
}
if (newfs)
wfree(newfs);
newfs = tmp;
fontset = ptr+1;
} while (ptr!=NULL);
return newfs;
}
#define FONT_PROPS 14
typedef struct {
char *props[FONT_PROPS];
} W_FontAttributes;
static void
changeFontProp(char *buf, char *newprop, int position)
{
char buf2[512];
char *ptr, *pptr, *rptr;
int count;
if (buf[0]!='-') {
/* // remove warning later. or maybe not */
wwarning(_("Invalid font specification: '%s'\n"), buf);
return;
}
ptr = pptr = rptr = buf;
count = 0;
while (*ptr && *ptr!=',') {
if (*ptr == '-') {
count++;
if (count-1==position+1) {
rptr = ptr;
break;
}
if (count-1==position) {
pptr = ptr+1;
}
}
ptr++;
}
if (position==FONT_PROPS-1) {
rptr = ptr;
}
*pptr = 0;
snprintf(buf2, 512, "%s%s%s", buf, newprop, rptr);
strcpy(buf, buf2);
}
static WMArray*
getOptions(char *options)
{
char *ptr, *ptr2, *str;
WMArray *result;
int count;
result = WMCreateArrayWithDestructor(2, (WMFreeDataProc*)wfree);
ptr = options;
while (1) {
ptr2 = strchr(ptr, ',');
if (!ptr2) {
WMAddToArray(result, wstrdup(ptr));
break;
} else {
count = ptr2 - ptr;
str = wmalloc(count+1);
memcpy(str, ptr, count);
str[count] = 0;
WMAddToArray(result, str);
ptr = ptr2 + 1;
}
}
return result;
}
#define WFAUnchanged (NULL)
/* Struct for font change operations */
typedef struct WMFontAttributes {
char *foundry;
char *family;
char *weight;
char *slant;
char *setWidth;
char *addStyle;
char *pixelSize;
char *pointSize;
char *resolutionX;
char *resolutionY;
char *spacing;
char *averageWidth;
char *registry;
char *encoding;
} WMFontAttributes;
WMFont*
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
const WMFontAttributes *changes)
{
int index[FONT_PROPS], count[FONT_PROPS];
int totalProps, i, j, carry;
char fname[512];
WMFontFlags fFlags;
WMBag *props;
WMArray *options;
WMFont *result;
char *prop;
snprintf(fname, 512, "%s", font->name);
fFlags = (font->antialiased ? WFAntialiased : WFNotAntialiased);
fFlags |= (font->notFontSet ? WFNormalFont : WFFontSet);
props = WMCreateBagWithDestructor(1, (WMFreeDataProc*)WMFreeArray);
totalProps = 0;
for (i=0; i<FONT_PROPS; i++) {
prop = ((W_FontAttributes*)changes)->props[i];
count[i] = index[i] = 0;
if (!prop) {
/* No change for this property */
continue;
} else if (strchr(prop, ',')==NULL) {
/* Simple option */
changeFontProp(fname, prop, i);
} else {
/* Option with fallback alternatives */
if ((changes==WFAEmphasized || changes==WFABoldEmphasized) &&
font->antialiased && strcmp(prop, "o,i")==0) {
options = getOptions("i,o");
} else {
options = getOptions(prop);
}
WMInsertInBag(props, i, options);
count[i] = WMGetArrayItemCount(options);
if (totalProps==0)
totalProps = 1;
totalProps = totalProps * count[i];
}
}
if (totalProps == 0) {
/* No options with fallback alternatives at all */
WMFreeBag(props);
return WMCreateFontWithFlags(scrPtr, fname, fFlags);
}
for (i=0; i<totalProps; i++) {
for (j=0; j<FONT_PROPS; j++) {
if (count[j]!=0) {
options = WMGetFromBag(props, j);
prop = WMGetFromArray(options, index[j]);
if (prop) {
changeFontProp(fname, prop, j);
}
}
}
result = WMCreateFontWithFlags(scrPtr, fname, fFlags);
if (result) {
WMFreeBag(props);
return result;
}
for (j=FONT_PROPS-1, carry=1; j>=0; j--) {
if (count[j]!=0) {
index[j] += carry;
carry = (index[j]==count[j]);
index[j] %= count[j];
}
}
}
WMFreeBag(props);
return NULL;
}
// should WFANormal also set "normal" or leave it alone?
static const WMFontAttributes W_FANormal = {
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
static const WMFontAttributes W_FABold = {
WFAUnchanged, WFAUnchanged, "bold", WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
static const WMFontAttributes W_FANotBold = {
WFAUnchanged, WFAUnchanged, "medium,normal,regular", WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
static const WMFontAttributes W_FAEmphasized = {
WFAUnchanged, WFAUnchanged, WFAUnchanged, "o,i",
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
static const WMFontAttributes W_FANotEmphasized = {
WFAUnchanged, WFAUnchanged, WFAUnchanged, "r",
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
static const WMFontAttributes W_FABoldEmphasized = {
WFAUnchanged, WFAUnchanged, "bold", "o,i",
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
};
const WMFontAttributes *WFANormal = &W_FANormal;
const WMFontAttributes *WFABold = &W_FABold;
const WMFontAttributes *WFANotBold = &W_FANotBold;
const WMFontAttributes *WFAEmphasized = &W_FAEmphasized;
const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized;
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
#endif
+599
View File
@@ -0,0 +1,599 @@
#include "wconfig.h"
#ifdef XFT
#include <X11/Xft/Xft.h>
#include <fontconfig/fontconfig.h>
#if defined(HAVE_MBSNRTOWCS)
# define __USE_GNU
#endif
#ifdef HAVE_WCHAR_H
# include <wchar.h>
#endif
#include <stdlib.h>
#include "WINGsP.h"
#include <wraster.h>
#include <assert.h>
#include <X11/Xlocale.h>
// && defined(HAVE_MBSTATE_T___COUNT)
// in configure.ac use AC_CHECK_MEMBER(struct mbstate_t.__count,
// have=1, have=0, [#include <wchar.h>])
#if defined(HAVE_MBSNRTOWCS)
static size_t
wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len)
{
mbstate_t ps;
size_t n;
memset(&ps, 0, sizeof(mbstate_t));
n = mbsnrtowcs(dest, src, nbytes, len, &ps);
if (n!=(size_t)-1 && *src) {
*src -= ps.__count;
}
return n;
}
#elif defined(HAVE_MBRTOWC)
// This is 8 times slower than the version above.
static size_t
wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len)
{
mbstate_t ps;
const char *ptr;
size_t n;
int nb;
if (nbytes==0)
return 0;
memset(&ps, 0, sizeof(mbstate_t));
if (dest == NULL) {
for (ptr=*src, n=0; nbytes>0; n++) {
nb = mbrtowc(NULL, ptr, nbytes, &ps);
if (nb == -1) {
return ((size_t)-1);
} else if (nb==0 || nb==-2) {
return n;
}
ptr += nb;
nbytes -= nb;
}
}
for (ptr=*src, n=0; n<len && nbytes>0; n++, dest++) {
nb = mbrtowc(dest, ptr, nbytes, &ps);
if (nb == -2) {
*src = ptr;
return n;
} else if (nb == -1) {
*src = ptr;
return ((size_t)-1);
} else if (nb == 0) {
*src = NULL;
return n;
}
ptr += nb;
nbytes -= nb;
}
*src = ptr;
return n;
}
#else
// Not only 8 times slower than the version based on mbsnrtowcs
// but also this version is not thread safe nor reentrant
static size_t
wmbsnrtowcs(wchar_t *dest, const char **src, size_t nbytes, size_t len)
{
const char *ptr;
size_t n;
int nb;
if (nbytes==0)
return 0;
mbtowc(NULL, NULL, 0); /* reset shift state */
if (dest == NULL) {
for (ptr=*src, n=0; nbytes>0; n++) {
nb = mbtowc(NULL, ptr, nbytes);
if (nb == -1) {
mbtowc(NULL, NULL, 0);
nb = mbtowc(NULL, ptr, strlen(ptr));
return (nb == -1 ? (size_t)-1 : n);
} else if (nb==0) {
return n;
}
ptr += nb;
nbytes -= nb;
}
}
for (ptr=*src, n=0; n<len && nbytes>0; n++, dest++) {
nb = mbtowc(dest, ptr, nbytes);
if (nb == -1) {
mbtowc(NULL, NULL, 0);
nb = mbtowc(NULL, ptr, strlen(ptr));
*src = ptr;
return (nb == -1 ? (size_t)-1 : n);
} else if (nb == 0) {
*src = NULL;
return n;
}
ptr += nb;
nbytes -= nb;
}
*src = ptr;
return n;
}
#endif
#define DEFAULT_SIZE 12
static char*
fixXLFD(char *xlfd, int size)
{
char *fname, *ptr;
fname = wmalloc(strlen(xlfd) + 20);
if (strstr(xlfd, "%d")!=NULL)
sprintf(fname, xlfd, size ? size : DEFAULT_SIZE);
else
strcpy(fname, xlfd);
if ((ptr = strchr(fname, ','))) {
*ptr = 0;
}
return fname;
}
static Bool
hasProperty(FcPattern *pattern, const char *property)
{
FcValue val;
if (FcPatternGet(pattern, property, 0, &val)==FcResultMatch) {
return True;
}
return False;
}
static Bool
hasPropertyWithStringValue(FcPattern *pattern, const char *object, char *value)
{
FcChar8 *str;
int id;
if (!value || value[0]==0)
return True;
id = 0;
while (FcPatternGetString(pattern, object, id, &str)==FcResultMatch) {
if (strcasecmp(value, (char*)str) == 0) {
return True;
}
id++;
}
return False;
}
// also handle an xlfd with %d for size?
static char*
makeFontOfSize(char *font, int size, char *fallback)
{
FcPattern *pattern;
char *result;
if (font[0]=='-') {
char *fname;
fname = fixXLFD(font, size);
pattern = XftXlfdParse(fname, False, False);
wfree(fname);
} else {
pattern = FcNameParse(font);
}
//FcPatternPrint(pattern);
if (size > 0) {
FcPatternDel(pattern, "pixelsize");
FcPatternAddDouble(pattern, "pixelsize", (double)size);
} else if (size==0 && !hasProperty(pattern, "size") &&
!hasProperty(pattern, "pixelsize")) {
FcPatternAddDouble(pattern, "pixelsize", (double)DEFAULT_SIZE);
}
if (fallback && !hasPropertyWithStringValue(pattern, "family", fallback)) {
FcPatternAddString(pattern, "family", fallback);
}
result = FcNameUnparse(pattern);
FcPatternDestroy(pattern);
return result;
}
WMFont*
WMCreateFont(WMScreen *scrPtr, char *fontName)
{
WMFont *font;
Display *display = scrPtr->display;
char *fname, *ptr;
/* This is for back-compat (to allow reading of old xlfd descriptions) */
if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) {
// warn for deprecation
fname = wmalloc(ptr - fontName + 1);
strncpy(fname, fontName, ptr - fontName);
fname[ptr - fontName] = 0;
} else {
fname = wstrdup(fontName);
}
font = WMHashGet(scrPtr->fontCache, fname);
if (font) {
WMRetainFont(font);
wfree(fname);
return font;
}
font = wmalloc(sizeof(WMFont));
memset(font, 0, sizeof(WMFont));
font->screen = scrPtr;
// remove
printf("WMCreateFont: %s\n", fname);
if (fname[0] == '-') {
// Backward compat thing. Remove in a later version
font->font = XftFontOpenXlfd(display, scrPtr->screen, fname);
} else {
font->font = XftFontOpenName(display, scrPtr->screen, fname);
}
if (!font->font) {
wfree(font);
wfree(fname);
return NULL;
}
font->height = font->font->ascent+font->font->descent;
font->y = font->font->ascent;
font->refCount = 1;
font->name = fname;
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
return font;
}
WMFont*
WMRetainFont(WMFont *font)
{
wassertrv(font!=NULL, NULL);
font->refCount++;
return font;
}
void
WMReleaseFont(WMFont *font)
{
wassertr(font!=NULL);
font->refCount--;
if (font->refCount < 1) {
XftFontClose(font->screen->display, font->font);
if (font->name) {
WMHashRemove(font->screen->fontCache, font->name);
wfree(font->name);
}
wfree(font);
}
}
Bool
WMIsAntialiasingEnabled(WMScreen *scrPtr)
{
return scrPtr->antialiasedText;
}
unsigned int
WMFontHeight(WMFont *font)
{
wassertrv(font!=NULL, 0);
return font->height;
}
char*
WMGetFontName(WMFont *font)
{
wassertrv(font!=NULL, NULL);
return font->name;
}
WMFont*
WMDefaultSystemFont(WMScreen *scrPtr)
{
return WMRetainFont(scrPtr->normalFont);
}
WMFont*
WMDefaultBoldSystemFont(WMScreen *scrPtr)
{
return WMRetainFont(scrPtr->boldFont);
}
WMFont*
WMSystemFontOfSize(WMScreen *scrPtr, int size)
{
WMFont *font;
char *fontSpec;
fontSpec = makeFontOfSize(WINGsConfiguration.systemFont, size, "sans");
font = WMCreateFont(scrPtr, fontSpec);
if (!font) {
wwarning(_("could not load font %s."), fontSpec);
}
wfree(fontSpec);
return font;
}
WMFont*
WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
{
WMFont *font;
char *fontSpec;
fontSpec = makeFontOfSize(WINGsConfiguration.boldSystemFont, size, "sans");
font = WMCreateFont(scrPtr, fontSpec);
if (!font) {
wwarning(_("could not load font %s."), fontSpec);
}
wfree(fontSpec);
return font;
}
int
WMWidthOfString(WMFont *font, char *text, int length)
{
XGlyphInfo extents;
wassertrv(font!=NULL, 0);
wassertrv(text!=NULL, 0);
if (font->screen->useWideChar) {
wchar_t *wtext;
const char *mtext;
int len;
wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1));
mtext = text;
len = wmbsnrtowcs(wtext, &mtext, length, length);
if (len>0) {
wtext[len] = L'\0'; /* not really necessary here */
XftTextExtents32(font->screen->display, font->font,
(XftChar32 *)wtext, len, &extents);
} else {
if (len==-1) {
wwarning(_("Conversion to widechar failed (possible "
"invalid multibyte sequence): '%s':(pos %d)\n"),
text, mtext-text+1);
}
extents.xOff = 0;
}
wfree(wtext);
} else if (font->screen->useMultiByte) {
XftTextExtentsUtf8(font->screen->display, font->font,
(XftChar8 *)text, length, &extents);
} else {
XftTextExtents8(font->screen->display, font->font,
(XftChar8 *)text, length, &extents);
}
return extents.xOff; /* don't ask :P */
}
void
WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int x, int y, char *text, int length)
{
XftColor xftcolor;
wassertr(font!=NULL);
xftcolor.color.red = color->color.red;
xftcolor.color.green = color->color.green;
xftcolor.color.blue = color->color.blue;
xftcolor.color.alpha = color->alpha;;
xftcolor.pixel = W_PIXEL(color);
XftDrawChange(scr->xftdraw, d);
if (font->screen->useWideChar) {
wchar_t *wtext;
const char *mtext;
int len;
wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1));
mtext = text;
len = wmbsnrtowcs(wtext, &mtext, length, length);
if (len>0) {
XftDrawString32(scr->xftdraw, &xftcolor, font->font,
x, y + font->y, (XftChar32*)wtext, len);
} else if (len==-1) {
wwarning(_("Conversion to widechar failed (possible invalid "
"multibyte sequence): '%s':(pos %d)\n"),
text, mtext-text+1);
/* we can draw normal text, or we can draw as much widechar
* text as was already converted until the error. go figure */
/*XftDrawString8(scr->xftdraw, &xftcolor, font->font,
x, y + font->y, (XftChar8*)text, length);*/
}
wfree(wtext);
} else if (font->screen->useMultiByte) {
XftDrawStringUtf8(scr->xftdraw, &xftcolor, font->font,
x, y + font->y, (XftChar8*)text, length);
} else {
XftDrawString8(scr->xftdraw, &xftcolor, font->font,
x, y + font->y, (XftChar8*)text, length);
}
}
void
WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background,
WMFont *font, int x, int y, char *text, int length)
{
XftColor textColor;
XftColor bgColor;
wassertr(font!=NULL);
textColor.color.red = color->color.red;
textColor.color.green = color->color.green;
textColor.color.blue = color->color.blue;
textColor.color.alpha = color->alpha;;
textColor.pixel = W_PIXEL(color);
bgColor.color.red = background->color.red;
bgColor.color.green = background->color.green;
bgColor.color.blue = background->color.blue;
bgColor.color.alpha = background->alpha;;
bgColor.pixel = W_PIXEL(background);
XftDrawChange(scr->xftdraw, d);
XftDrawRect(scr->xftdraw, &bgColor, x, y,
WMWidthOfString(font, text, length),
font->height);
if (font->screen->useWideChar) {
wchar_t *wtext;
const char *mtext;
int len;
mtext = text;
wtext = (wchar_t *)wmalloc(sizeof(wchar_t)*(length+1));
len = wmbsnrtowcs(wtext, &mtext, length, length);
if (len>0) {
XftDrawString32(scr->xftdraw, &textColor, font->font,
x, y + font->y, (XftChar32*)wtext, len);
} else if (len==-1) {
wwarning(_("Conversion to widechar failed (possible invalid "
"multibyte sequence): '%s':(pos %d)\n"),
text, mtext-text+1);
/* we can draw normal text, or we can draw as much widechar
* text as was already converted until the error. go figure */
/*XftDrawString8(scr->xftdraw, &textColor, font->font,
x, y + font->y, (XftChar8*)text, length);*/
}
wfree(wtext);
} else if (font->screen->useMultiByte) {
XftDrawStringUtf8(scr->xftdraw, &textColor, font->font,
x, y + font->y, (XftChar8*)text, length);
} else {
XftDrawString8(scr->xftdraw, &textColor, font->font,
x, y + font->y, (XftChar8*)text, length);
}
}
WMFont*
WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
{
FcPattern *pattern;
WMFont *copy;
char *name;
if (!font)
return NULL;
pattern = FcNameParse(WMGetFontName(font));
switch (style) {
case WFSNormal:
FcPatternDel(pattern, "weight");
FcPatternDel(pattern, "slant");
FcPatternAddString(pattern, "weight", "regular");
FcPatternAddString(pattern, "weight", "medium");
FcPatternAddString(pattern, "slant", "roman");
break;
case WFSBold:
FcPatternDel(pattern, "weight");
FcPatternAddString(pattern, "weight", "bold");
break;
case WFSEmphasized:
FcPatternDel(pattern, "slant");
FcPatternAddString(pattern, "slant", "italic");
FcPatternAddString(pattern, "slant", "oblique");
break;
case WFSBoldEmphasized:
FcPatternDel(pattern, "weight");
FcPatternDel(pattern, "slant");
FcPatternAddString(pattern, "weight", "bold");
FcPatternAddString(pattern, "slant", "italic");
FcPatternAddString(pattern, "slant", "oblique");
break;
}
name = FcNameUnparse(pattern);
copy = WMCreateFont(scrPtr, name);
FcPatternDestroy(pattern);
wfree(name);
return copy;
}
#endif /* XFT */
+604 -337
View File
File diff suppressed because it is too large Load Diff
+6 -7
View File
@@ -149,6 +149,7 @@ paintFrame(Frame *fPtr)
drawTitle = True;
} else {
tw = tx = 0;
drawTitle = False;
}
@@ -160,6 +161,11 @@ paintFrame(Frame *fPtr)
region = XCreateRegion();
rect.x = 0;
rect.y = 0;
rect.width = view->size.width;
rect.height = view->size.height;
XUnionRectWithRegion(&rect, region, region);
if (drawTitle) {
tmp = XCreateRegion();
rect.x = tx;
@@ -167,13 +173,6 @@ paintFrame(Frame *fPtr)
rect.width = tw;
rect.height = th;
XUnionRectWithRegion(&rect, tmp, tmp);
}
rect.x = 0;
rect.y = 0;
rect.width = view->size.width;
rect.height = view->size.height;
XUnionRectWithRegion(&rect, region, region);
if (drawTitle) {
XSubtractRegion(region, tmp, region);
XDestroyRegion(tmp);
}
+12 -5
View File
@@ -12,6 +12,8 @@
#include <X11/keysym.h>
#include <X11/cursorfont.h>
#include <X11/Xlocale.h>
/********** data ************/
@@ -591,6 +593,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
"WM_STATE"
};
Atom atoms[sizeof(atomNames)/sizeof(char*)];
char *locale;
int i;
if (!initialized) {
@@ -756,16 +759,20 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->stipple = stipple;
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
scrPtr->useMultiByte = 0;
scrPtr->useWideChar = 1;
locale = setlocale(LC_CTYPE, NULL);
//printf("LC_CTYPE=%s\n", locale);
if (!locale || strcmp(locale, "C")==0 || strcmp(locale, "POSIX")==0)
scrPtr->useWideChar = 0;
else
scrPtr->useWideChar = 1;
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
WINGsConfiguration.defaultFontSize);
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 0);
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
WINGsConfiguration.defaultFontSize);
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 0);
if (!scrPtr->boldFont)
scrPtr->boldFont = scrPtr->normalFont;
+12 -7
View File
@@ -22,7 +22,8 @@ typedef struct W_ICContext {
Bool W_InitIMStuff(WMScreen *scr)
Bool
W_InitIMStuff(WMScreen *scr)
{
WMIMContext *ctx;
@@ -38,7 +39,8 @@ Bool W_InitIMStuff(WMScreen *scr)
}
void W_CloseIMStuff(WMScreen *scr)
void
W_CloseIMStuff(WMScreen *scr)
{
if (!scr->imctx)
return;
@@ -51,7 +53,8 @@ void W_CloseIMStuff(WMScreen *scr)
WMICContext *W_CreateIC(WMView *view)
WMICContext*
W_CreateIC(WMView *view)
{
WMScreen *scr = W_VIEW_SCREEN(view);
WMICContext *ctx;
@@ -60,11 +63,12 @@ WMICContext *W_CreateIC(WMView *view)
ctx->next = scr->imctx->icList;
if (scr->imctx->icList)
scr->imctx->icList->prev = ctx;
scr->imctx = ctx;
//scr->imctx = ctx;
}
void W_DestroyIC(WMICContext *ctx)
void
W_DestroyIC(WMICContext *ctx)
{
XDestroyIC(ctx->xic);
@@ -72,8 +76,9 @@ void W_DestroyIC(WMICContext *ctx)
}
int W_LookupString(WMView *view, XKeyEvent *event,
char buffer, int bufsize, KeySym ksym)
int
W_LookupString(WMView *view, XKeyEvent *event,
char buffer, int bufsize, KeySym ksym)
{
}
+88 -28
View File
@@ -30,26 +30,26 @@ W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
case WRSimple:
XDrawRectangle(dpy, d, black, x, y, width-1, height-1);
return;
case WRRaised:
bgc = black;
dgc = dark;
wgc = white;
lgc = light;
break;
case WRSunken:
wgc = dark;
lgc = black;
bgc = white;
dgc = light;
break;
case WRPushed:
lgc = wgc = black;
dgc = bgc = white;
break;
case WRRidge:
lgc = bgc = dark;
dgc = wgc = white;
@@ -59,7 +59,7 @@ W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
wgc = dgc = dark;
lgc = bgc = white;
break;
default:
return;
}
@@ -68,12 +68,12 @@ W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
if (width > 2 && relief != WRRaised && relief!=WRPushed) {
XDrawLine(dpy, d, lgc, x+1, y+1, x+width-3, y+1);
}
XDrawLine(dpy, d, wgc, x, y, x, y+height-1);
if (height > 2 && relief != WRRaised && relief!=WRPushed) {
XDrawLine(dpy, d, lgc, x+1, y+1, x+1, y+height-3);
}
/* bottom right */
XDrawLine(dpy, d, bgc, x, y+height-1, x+width-1, y+height-1);
if (width > 2 && relief!=WRPushed) {
@@ -87,22 +87,82 @@ W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
}
static int
findNextWord(char *text, int limit)
{
int pos, len;
len = strcspn(text, " \t\n\r");
pos = len + strspn(text+len, " \t\n\r");
if (pos > limit)
pos = limit;
return pos;
}
static int
fitText(char *text, WMFont *font, int width, int wrap)
{
int i, w, beforecrlf, word1, word2;
/* text length before first cr/lf */
beforecrlf = strcspn(text, "\n\r");
if (!wrap || beforecrlf==0)
return beforecrlf;
w = WMWidthOfString(font, text, beforecrlf);
if (w <= width) {
/* text up to first crlf fits */
return beforecrlf;
}
word1 = 0;
while (1) {
word2 = word1 + findNextWord(text+word1, beforecrlf-word1);
if (word2 >= beforecrlf)
break;
w = WMWidthOfString(font, text, word2);
if (w > width)
break;
word1 = word2;
}
for (i=word1; i<word2; i++) {
w = WMWidthOfString(font, text, i);
if (w > width) {
break;
}
}
/* keep words complete if possible */
if (!isspace(text[i]) && word1>0) {
i = word1;
} else if (isspace(text[i]) && i<beforecrlf) {
/* keep space on current row, so new row has next word in column 1 */
i++;
}
return i;
}
#ifdef OLD_CODE
static int
fitText(char *text, WMFont *font, int width, int wrap)
{
int i, j;
int w;
if (text[0]==0)
return 0;
i = 0;
if (wrap) {
if (text[0]=='\n')
return 0;
do {
i++;
w = WMWidthOfString(font, text, i);
@@ -110,7 +170,7 @@ fitText(char *text, WMFont *font, int width, int wrap)
if (text[i]=='\n')
return i;
/* keep words complete */
if (!isspace(text[i])) {
j = i;
@@ -120,11 +180,11 @@ fitText(char *text, WMFont *font, int width, int wrap)
i = j;
}
} else {
while (text[i]!='\n' && text[i]!=0)
i++;
i = strcspn(text, "\n\r");
}
return i;
}
#endif
int
@@ -203,7 +263,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
#ifdef DOUBLE_BUFFER
d = XCreatePixmap(screen->display, view->window,
d = XCreatePixmap(screen->display, view->window,
view->size.width, view->size.height, screen->depth);
#endif
@@ -215,7 +275,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
#ifndef DOUBLE_BUFFER
XClearWindow(screen->display, d);
#else
XSetForeground(screen->display, screen->copyGC,
XSetForeground(screen->display, screen->copyGC,
view->attribs.background_pixel);
XFillRectangle(screen->display, d, screen->copyGC, 0, 0,
view->size.width, view->size.height);
@@ -232,7 +292,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
x = 1;
y = 1;
w = view->size.width - 3;
h = view->size.height - 3;
h = view->size.height - 3;
}
/* calc. image alignment */
@@ -247,7 +307,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
y = 0;
*/
break;
case WIPLeft:
ix = x;
iy = y + (h - image->height) / 2;
@@ -255,20 +315,20 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
y = 0;
w -= image->width + 5;
break;
case WIPRight:
ix = view->size.width - image->width - x;
iy = y + (h - image->height) / 2;
w -= image->width + 5;
break;
case WIPBelow:
ix = (view->size.width - image->width) / 2;
iy = h - image->height;
y = 0;
h -= image->height;
break;
default:
case WIPAbove:
ix = (view->size.width - image->width) / 2;
@@ -277,7 +337,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
h -= image->height;
break;
}
ix += ofs;
iy += ofs;
@@ -295,7 +355,7 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
/* draw text */
if (position != WIPImageOnly && text!=NULL) {
int textHeight;
textHeight = W_GetTextHeight(font, text, w-8, wrap);
W_PaintText(view, d, font, x+ofs+4, y+ofs + (h-textHeight)/2, w-8,
alignment, textColor, wrap, text, strlen(text));
@@ -314,26 +374,26 @@ W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor, W_Font *font,
WMPoint
WMPoint
wmkpoint(int x, int y)
{
WMPoint point;
point.x = x;
point.y = y;
return point;
}
WMSize
WMSize
wmksize(unsigned int width, unsigned int height)
{
WMSize size;
size.width = width;
size.height = height;
return size;
}
+3 -4
View File
@@ -306,10 +306,9 @@ paintArrow(WMScroller *sPtr, Drawable d, int part)
gc = scr->whiteGC;
#endif
}
if (sPtr->flags.horizontal) {
/* paint button */
#ifndef DOUBLE_BUFFER
XFillRectangle(scr->display, d, gc,
@@ -326,7 +325,7 @@ paintArrow(WMScroller *sPtr, Drawable d, int part)
XSetClipOrigin(scr->display, scr->clipGC,
ofs + (BUTTON_SIZE - arrow->width) / 2,
2 + (BUTTON_SIZE - arrow->height) / 2);
XCopyArea(scr->display, arrow->pixmap, d, scr->clipGC,
0, 0, arrow->width, arrow->height,
ofs + (BUTTON_SIZE - arrow->width) / 2,
+1 -1
View File
@@ -2026,7 +2026,7 @@ insertTextInteractively(Text *tPtr, char *text, int len)
int s = tb->used - tPtr->tpos;
if (!tb->blank && nlen>0) {
char *save;
char *save=NULL;
if (s > 0) {
save = wmalloc(s);
+2 -2
View File
@@ -109,9 +109,9 @@ typedef struct _Panel {
char oldTabItem;
char menuStyle;
int menuStyle;
char titleAlignment;
int titleAlignment;
Pixmap preview;
Pixmap previewNoText;
+1 -1
View File
@@ -84,7 +84,7 @@ createPanel(Panel *p)
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
WMSetButtonEnabled(panel->swi[7], False);
WMSetButtonEnabled(panel->swi[7], True);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
+12 -12
View File
@@ -219,7 +219,7 @@ createPanel(Panel *p)
WMSetBoxHorizontal(box, False);
panel->kfocB[0] = WMCreateRadioButton(box);
WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set "\
WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set "\
"keyboard input focus"));
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True,
20, 0, 0);
@@ -243,13 +243,13 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->cfocF, _("Install colormap in the window..."));
panel->manB = WMCreateRadioButton(panel->cfocF);
WMResizeWidget(panel->manB, 220, 20);
WMMoveWidget(panel->manB, 15, 18);
WMResizeWidget(panel->manB, 225, 20);
WMMoveWidget(panel->manB, 10, 18);
WMSetButtonText(panel->manB, _("...that has the input focus."));
panel->autB = WMCreateRadioButton(panel->cfocF);
WMResizeWidget(panel->autB, 220, 20);
WMMoveWidget(panel->autB, 15, 40);
WMResizeWidget(panel->autB, 225, 20);
WMMoveWidget(panel->autB, 10, 43);
WMSetButtonText(panel->autB, _("...that is under the mouse pointer."));
WMGroupButtons(panel->manB, panel->autB);
@@ -331,15 +331,15 @@ createPanel(Panel *p)
WMMoveWidget(panel->optF, 265, 95);
panel->ignB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->ignB, 210, 50);
WMMoveWidget(panel->ignB, 15, 10);
WMSetButtonText(panel->ignB, _("Do not let applications receive\n"
"the click used to focus windows."));
WMResizeWidget(panel->ignB, 225, 50);
WMMoveWidget(panel->ignB, 10, 10);
WMSetButtonText(panel->ignB, _("Do not let applications receive "
"the click used to focus windows."));
panel->newB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->newB, 210, 35);
WMMoveWidget(panel->newB, 15, 70);
WMSetButtonText(panel->newB, _("Automatically focus new\nwindows."));
WMResizeWidget(panel->newB, 225, 35);
WMMoveWidget(panel->newB, 10, 70);
WMSetButtonText(panel->newB, _("Automatically focus new windows."));
WMMapSubwidgets(panel->optF);
+30 -36
View File
@@ -23,7 +23,7 @@
#include "WPrefs.h"
#include <X11/Xlocale.h>
#include <ctype.h>
typedef struct _Panel {
WMBox *box;
@@ -358,7 +358,7 @@ paintItems(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int l = strlen(text);
int x = previewPositions[part].pos.x;
int y = previewPositions[part].pos.y;
int w = previewPositions[part].size.width;
//int w = previewPositions[part].size.width;
int h = previewPositions[part].size.height/4;
int i;
for( i = 0; i < 4 ; i++) {
@@ -443,7 +443,7 @@ dumpRImage(char *path, RImage *image)
}
}
static int
/*static int
isPixmap(WMPropList *prop)
{
WMPropList *p;
@@ -455,7 +455,7 @@ isPixmap(WMPropList *prop)
return 1;
else
return 0;
}
}*/
static Pixmap
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
@@ -669,7 +669,7 @@ renderMenu(_Panel *panel, WMPropList *texture, int width, int iheight)
WMScreen *scr = WMWidgetScreen(panel->parent);
Display *dpy = WMScreenDisplay(scr);
Pixmap pix, tmp;
RContext *rc = WMScreenRContext(scr);
//RContext *rc = WMScreenRContext(scr);
GC gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
int i;
@@ -835,7 +835,7 @@ paintPreviewBox(Panel *panel, int elements)
{
WMScreen *scr = WMWidgetScreen(panel->parent);
Display *dpy = WMScreenDisplay(scr);
int refresh = 0;
//int refresh = 0;
GC gc;
WMColor *black = WMBlackColor(scr);
Pixmap mitem;
@@ -926,7 +926,7 @@ static void
paintTextField(void *data, int section)
{
_Panel *panel = (_Panel*)data;
char *sample = NULL;
//char *sample = NULL;
int encoding;
encoding = WMGetPopUpButtonSelectedItem(panel->langP);
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
@@ -1072,7 +1072,7 @@ refillFontSetList(void *data)
char *encoding = getFontEncoding(panel);
int section = WMGetPopUpButtonSelectedItem(panel->fontSel);
int i;
int pos;
//int pos;
WMClearList(panel->fsetLs);
if(!encoding) {
array = getCurrentFontProp(panel, section);
@@ -1259,7 +1259,7 @@ static void
changeLanguageAction(WMWidget *w, void *data)
{
Panel *panel = (Panel*)data;
WMScreen *scr = WMWidgetScreen(panel->box);
//WMScreen *scr = WMWidgetScreen(panel->box);
int section;
section = WMGetPopUpButtonSelectedItem(w);
@@ -1314,7 +1314,7 @@ static char*
getFontSampleString(void *data)
{
_Panel *panel = (_Panel*)data;
WMScreen *scr = WMWidgetScreen(panel->box);
//WMScreen *scr = WMWidgetScreen(panel->box);
WMMenuItem *mi;
WMPropList *pl;
int section;
@@ -1336,7 +1336,7 @@ static char*
getFontEncoding(void *data)
{
_Panel *panel = (_Panel*)data;
WMScreen *scr = WMWidgetScreen(panel->box);
//WMScreen *scr = WMWidgetScreen(panel->box);
WMMenuItem *mi;
WMPropList *pl;
int section;
@@ -1358,7 +1358,7 @@ static Bool
isEncodingMultiByte(void *data)
{
_Panel *panel = (_Panel*)data;
WMScreen *scr = WMWidgetScreen(panel->box);
//WMScreen *scr = WMWidgetScreen(panel->box);
WMMenuItem *mi;
WMPropList *pl;
int section;
@@ -1473,26 +1473,20 @@ getDefaultSystemFont(void *data, int element)
{
_Panel *panel = (_Panel*)data;
WMScreen *scr = WMWidgetScreen(panel->box);
switch(element) {
case 0:
return WMBoldSystemFontOfSize(scr, 12);
break;
case 1:
return WMBoldSystemFontOfSize(scr, 24);
break;
case 2:
return WMBoldSystemFontOfSize(scr, 12);
break;
case 3:
return WMSystemFontOfSize(scr, 12);
break;
case 4:
return WMSystemFontOfSize(scr, 8);
break;
case 5:
return WMSystemFontOfSize(scr, 8);
break;
}
switch(element) {
case 0:
case 2:
return WMBoldSystemFontOfSize(scr, 12);
case 1:
return WMBoldSystemFontOfSize(scr, 24);
case 4:
case 5:
return WMSystemFontOfSize(scr, 8);
case 3:
default:
return WMSystemFontOfSize(scr, 12);
}
}
static void
@@ -1515,7 +1509,7 @@ static void
toggleAA(WMWidget *w, void *data)
{
_Panel *panel = (_Panel*)data;
int section;
//int section;
if(panel->AntialiasedText)
panel->AntialiasedText = False;
else
@@ -1622,7 +1616,7 @@ addButtonAction(WMWidget *w, void *data)
array = getDefaultFontProp(panel, encoding, section);
WMHideFontPanel(panel->fontPanel);
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
string = WMCreatePLString(chosenFont);
pos = WMGetListSelectedItemRow(panel->fsetLs);
WMInsertListItem(panel->fsetLs, pos+1, chosenFont);
@@ -1651,7 +1645,7 @@ changeButtonAction(WMWidget *w, void *data)
WMHideFontPanel(panel->fontPanel);
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
string = WMCreatePLString(chosenFont);
pos = WMGetListSelectedItemRow(panel->fsetLs);
@@ -1720,7 +1714,7 @@ removeButtonClick(WMWidget *w, void *data)
static void
showData(_Panel *panel)
{
WMScreen *scr = WMWidgetScreen(panel->parent);
//WMScreen *scr = WMWidgetScreen(panel->parent);
char *str;
int i;
+14 -2
View File
@@ -112,6 +112,12 @@ static char *keyOptions[] = {
"WindowShortcut9Key",
"WindowShortcut10Key",
"ScreenSwitchKey",
#ifdef VIRTUAL_DESKTOP
"VirtualEdgeLeftKey",
"VirtualEdgeRightKey",
"VirtualEdgeUpKey",
"VirtualEdgeDownKey",
#endif
"ClipRaiseKey",
"ClipLowerKey",
#ifndef XKB_MODELOCK
@@ -326,7 +332,7 @@ captureClick(WMWidget *w, void *data)
}
panel->capturing = 0;
WMSetButtonText(w, _("Capture"));
WMSetLabelText(panel->instructionsL, _("Click Capture to interactively define the shortcut key."));
WMSetLabelText(panel->instructionsL, _("Click on Capture to interactively define the shortcut key."));
XUngrabKeyboard(dpy, CurrentTime);
}
@@ -537,6 +543,12 @@ createPanel(Panel *p)
WMAddListItem(panel->actLs, _("Shortcut for window 9"));
WMAddListItem(panel->actLs, _("Shortcut for window 10"));
WMAddListItem(panel->actLs, _("Switch to Next Screen/Monitor"));
#ifdef VIRTUAL_DESKTOP
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next left edge"));
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next right edge"));
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next top edge"));
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next bottom edge"));
#endif
WMAddListItem(panel->actLs, _("Raise Clip"));
WMAddListItem(panel->actLs, _("Lower Clip"));
WMAddListItem(panel->actLs, _("Raise/Lower Clip"));
@@ -580,7 +592,7 @@ createPanel(Panel *p)
WMMoveWidget(panel->instructionsL, 15, 140);
WMSetLabelTextAlignment(panel->instructionsL, WACenter);
WMSetLabelWraps(panel->instructionsL, True);
WMSetLabelText(panel->instructionsL, _("Click Capture to interactively define the shortcut key."));
WMSetLabelText(panel->instructionsL, _("Click on Capture to interactively define the shortcut key."));
WMMapSubwidgets(panel->shoF);
+3 -1
View File
@@ -42,7 +42,9 @@ WPrefs_SOURCES = \
imagebrowser.h \
xmodifier.c
AM_CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
AM_CFLAGS = -fno-strict-aliasing
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs @HEADER_SEARCH_PATH@
+2 -2
View File
@@ -845,10 +845,10 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
}
if (!db) {
db = WMCreatePLDictionary(NULL, NULL, NULL);
db = WMCreatePLDictionary(NULL, NULL);
}
if (!gdb) {
gdb = WMCreatePLDictionary(NULL, NULL, NULL);
gdb = WMCreatePLDictionary(NULL, NULL);
}
GlobalDB = gdb;
+5 -7
View File
@@ -397,18 +397,16 @@ createPanel(Panel *p)
WMMoveWidget(panel->resL, 95, 20);
panel->resaB = WMCreateRadioButton(panel->resF);
WMMoveWidget(panel->resaB, 130, 14);
WMResizeWidget(panel->resaB, 70, 26);
WMMoveWidget(panel->resaB, 130, 15);
WMResizeWidget(panel->resaB, 70, 25);
WMSetButtonText(panel->resaB, _("Resist"));
panel->resrB = WMCreateRadioButton(panel->resF);
WMMoveWidget(panel->resrB, 200, 12);
WMResizeWidget(panel->resrB, 65, 30);
WMMoveWidget(panel->resrB, 200, 15);
WMResizeWidget(panel->resrB, 70, 25);
WMSetButtonText(panel->resrB, _("Attract"));
WMGroupButtons(panel->resrB, panel->resaB);
WMMapSubwidgets(panel->resF);
/**************** Transients on Parent Workspace ****************/
@@ -420,7 +418,7 @@ createPanel(Panel *p)
panel->tranB = WMCreateSwitchButton(panel->tranF);
WMMoveWidget(panel->tranB, 10, 5);
WMResizeWidget(panel->tranB, 250, 30);
WMSetButtonText(panel->tranB, _("Open dialogs in same workspace\nas their owners"));
WMSetButtonText(panel->tranB, _("Open dialogs in the same workspace\nas their owners"));
WMMapSubwidgets(panel->tranF);
+3 -3
View File
@@ -180,7 +180,7 @@ createPanel(Panel *p)
WMResizeWidget(panel->cyclB, 280, 34);
WMMoveWidget(panel->cyclB, 75, 30);
WMSetButtonText(panel->cyclB,
_("wrap to the first workspace after the\nlast workspace."));
_("Wrap to the first workspace from the last workspace."));
panel->cyclL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->cyclL, 60, 60);
@@ -202,7 +202,7 @@ createPanel(Panel *p)
WMResizeWidget(panel->linkB, 280, 34);
WMMoveWidget(panel->linkB, 75, 75);
WMSetButtonText(panel->linkB,
_("switch workspaces while dragging windows."));
_("Switch workspaces while dragging windows."));
panel->linkL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->linkL, 60, 40);
@@ -224,7 +224,7 @@ createPanel(Panel *p)
WMResizeWidget(panel->newB, 280, 34);
WMMoveWidget(panel->newB, 75, 120);
WMSetButtonText(panel->newB,
_("automatically create new workspaces."));
_("Automatically create new workspaces."));
panel->newL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->newL, 60, 20);
@@ -75,6 +75,9 @@
DontSaveSession = Yes;
Unfocusable = Yes;
};
kio_uiserver = {NoAppIcon = Yes;};
kcmshell = {NoAppIcon = Yes;};
kded = {NoAppIcon = Yes;};
"." = {NoAppIcon = Yes;};
"*" = {Icon = defaultAppIcon.#extension#;SharedAppIcon = Yes;};
}
+36
View File
@@ -24,6 +24,42 @@ CPPFLAGS="$CPPFLAGS_old"
])
dnl
dnl WM_CHECK_XFT_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
dnl
dnl # $XFTFLAGS should be defined before calling this macro,
dnl # else it will not be able to find Xft.h
dnl
AC_DEFUN(WM_CHECK_XFT_VERSION,
[
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $XFTFLAGS $inc_search_path"
xft_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
xft_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
xft_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_MSG_CHECKING([whether libXft is at least version $1])
AC_CACHE_VAL(ac_cv_lib_xft_version_ok,
[AC_TRY_LINK(
[/* Test version of libXft we have */
#include <X11/Xft/Xft.h>
#if !defined(XFT_VERSION) || XFT_VERSION < $xft_major_version*10000 + $xft_minor_version*100 + $xft_micro_version
#error libXft on this system is too old. Consider upgrading to at least $1
#endif
], [],
eval "ac_cv_lib_xft_version_ok=yes",
eval "ac_cv_lib_xft_version_ok=no")])
if eval "test \"`echo '$ac_cv_lib_xft_version_ok'`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , , [$3])
fi
CPPFLAGS="$CPPFLAGS_old"
])
dnl
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
dnl
+94 -34
View File
@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
AM_INIT_AUTOMAKE(WindowMaker, 0.90.0)
AM_INIT_AUTOMAKE(WindowMaker, 0.85.0)
AC_PROG_LIBTOOL
@@ -224,7 +224,7 @@ if test "$ac_cv_prog_gcc" = yes; then
AC_CACHE_CHECK(whether gcc supports MMX(tm) inline asm,
ac_cv_c_inline_mmx,
[AC_TRY_LINK(,[asm ("movq %mm0, %mm1");],
[AC_TRY_LINK(,[__asm__ ("movq %mm0, %mm1");],
ac_cv_c_inline_mmx=yes,
ac_cv_c_inline_mmx=no)])
@@ -295,7 +295,7 @@ dnl ==================
dnl List of supported locales
dnl -------------------------
supported_locales="be bg ca cs da de el es et fi fr gl hr hu it ja ko ms nl no pl pt ro ru sk sv tr zh_CN zh_TW.Big5"
supported_locales="be bg bs ca cs da de el es et fi fr gl hr hu it ja ko ms nl no pl pt ro ru sk sv tr zh_CN zh_TW.Big5"
supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko pt ru sk zh_CN zh_TW.Big5"
supported_wings_locales="bg ca cs de fr sk"
@@ -376,6 +376,12 @@ AC_SUBST(supported_locales)
dnl Support for various hint things
dnl ===============================
gnome_on="no"
kde_on="no"
openlook_on="no"
netwm_on="no"
vdesktop_on="no"
AC_ARG_ENABLE(gnome,
[ --enable-gnome enable stuff needed for GNOME ],
@@ -401,6 +407,22 @@ AC_ARG_ENABLE(openlook,
fi])
AC_ARG_ENABLE(netwm,
[ --enable-netwm enable support for FreeDesktop hints ],
[if test x$enableval = xyes; then
AC_DEFINE(NETWM_HINTS, 1, [define if you want NETWM hints support])
netwm_on=yes
fi])
AC_ARG_ENABLE(vdesktop,
[ --enable-vdesktop enable virtual desktop],
[if test x$enableval = xyes; then
AC_DEFINE(VIRTUAL_DESKTOP, 1, [define if you want virtual desktop support])
vdesktop_on=yes
fi])
dnl
dnl Disable some stuff that are duplicated in kde
dnl ---------------------------------------------
@@ -519,35 +541,54 @@ fi
dnl Xft antialiased font support
dnl ============================
xft=yes
XFTLIBS=""
AC_ARG_ENABLE(xft,
[ --disable-xft disable Xft antialiased font support],
xft=$enableval, xft=yes)
if test "$xft" = yes; then
if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
XFTCONFIG="$PKGCONFIG xft"
pkgconfig_xft=yes
else
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
fi
AC_MSG_CHECKING([for the Xft2 library])
if test "x$XFTCONFIG" != x; then
XFTLIBS=`$XFTCONFIG --libs`
XFTFLAGS=`$XFTCONFIG --cflags`
AC_MSG_RESULT([found])
else
xft=no
AC_MSG_RESULT([not found])
fi
if test "$xft" = yes; then
AC_SUBST(XFTFLAGS)
AC_SUBST(XFTLIBS)
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])
fi
if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
XFTCONFIG="$PKGCONFIG xft"
pkgconfig_xft=yes
else
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
fi
AC_MSG_CHECKING([for the Xft2 library])
if test "x$XFTCONFIG" != x; then
XFTLIBS=`$XFTCONFIG --libs`
XFTFLAGS=`$XFTCONFIG --cflags`
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([not found])
echo
echo "ERROR!!! libXft2 is not installed or could not be found."
echo " Xft2 is a requirement for building Window Maker."
echo " Please install it (along with fontconfig) before continuing."
echo
exit 1
fi
minXFT="2.1.2"
goodxft="no"
dnl
dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
dnl
WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
if test "$goodxft" = no; then
echo
echo "ERROR!!! libXft on this system is an old version."
echo " Please consider upgrading to at least version ${minXFT}."
echo
exit 1
fi
AC_SUBST(XFTFLAGS)
AC_SUBST(XFTLIBS)
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])
dnl XINERAMA support
dnl ================
xinerama=no
@@ -845,14 +886,14 @@ AC_ARG_WITH(appspath,
[ --with-appspath=PATH specify the directory for GNUstep applications], appspath=$withval )
if test "x$appspath" = "x"; then
gnustepdir='$(prefix)/GNUstep'
gnustepdir='${prefix}/GNUstep'
if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
fi
with_appspath=$gnustepdir/Apps
with_appspath=$gnustepdir/Applications
fi
wprefsdir=$with_appspath/WPrefs.app
@@ -1075,29 +1116,48 @@ dnl ==========================
supported_gfx="$supported_gfx builtin-PPM"
if test "x$MOFILES" = "x"; then
mof=none
mof=None
else
mof=`echo $MOFILES`
fi
if test "x$MOFILES" = "x"; then
languages=none
languages=None
else
languages=`echo $MOFILES | sed 's/.mo//g'`
fi
extrasupport=''
if test "$openlook_on" = "yes"; then
extrasupport="OpenLook $extrasupport"
fi
if test "$gnome_on" = "yes"; then
extrasupport="Gnome $extrasupport"
fi
if test "$kde_on" = "yes"; then
extrasupport="KDE $extrasupport"
fi
if test "$netwm_on" = "yes"; then
extrasupport="NetWM $extrasupport"
fi
if test "x$extrasupport" = "x"; then
extrasupport="None"
fi
echo
echo "Window Maker was configured as follows:"
echo
echo "Installation path prefix : $prefix"
echo "Installation path for binaries : $_bindir"
echo "Installation path for WPrefs.app : $wprefsdir" | sed -e 's|\$(prefix)|'"$prefix|"
echo "Installation path for WPrefs.app : $with_appspath" | sed -e 's|\${prefix}|'"$prefix|"
echo "Supported graphic format libraries : $supported_gfx"
echo "Antialiased text support for WINGs : $xft"
echo "Xinerama extension support : $xinerama"
echo "Use assembly routines for wrlib : $asm_support"
echo "Use inline MMX(tm) x86 assembly : $mmx_support"
echo "Antialiased text support in WINGs : $xft"
echo "Xinerama extension support : $xinerama"
echo "Virtual desktop support : $vdesktop_on"
echo "Additionally supported environments : $extrasupport"
echo "Translated message files to install : $mof"
dnl echo "Supported languages beside English : $languages"
if test "x$MOFILES" != "x"; then
+5 -1
View File
@@ -96,6 +96,8 @@ wmaker_SOURCES = \
winmenu.c \
winspector.h \
winspector.c \
wmspec.h \
wmspec.c \
workspace.c \
workspace.h \
wsound.c \
@@ -104,7 +106,9 @@ wmaker_SOURCES = \
text.h
AM_CPPFLAGS = @CPPFLAGS@ $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
AM_CPPFLAGS = $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
AM_CFLAGS = -fno-strict-aliasing
INCLUDES = \
+32 -30
View File
@@ -70,6 +70,7 @@ enum {
WMSubmenuLevel = 6,
WMMainMenuLevel = 20,
WMStatusLevel = 21,
WMFullscreenLevel = 50,
WMModalLevel = 100,
WMPopUpLevel = 101,
WMScreensaverLevel = 1000,
@@ -118,40 +119,41 @@ typedef enum {
#define WBUT_ICONIFY 2
#define WBUT_KILL 3
#ifdef XKB_BUTTON_HINT
#define WBUT_XKBGROUP1 4
#define WBUT_XKBGROUP2 5
#define WBUT_XKBGROUP3 6
#define WBUT_XKBGROUP4 7
#define WBUT_XKBGROUP1 4
#define WBUT_XKBGROUP2 5
#define WBUT_XKBGROUP3 6
#define WBUT_XKBGROUP4 7
#define PRED_BPIXMAPS 8 /* reserved for 4 groups */
#else
#define PRED_BPIXMAPS 4 /* count of WBUT icons */
#endif /* XKB_BUTTON_HINT */
/* cursors */
#define WCUR_DEFAULT 0
#define WCUR_NORMAL 0
#define WCUR_MOVE 1
#define WCUR_RESIZE 2
#define WCUR_DEFAULT 0
#define WCUR_NORMAL 0
#define WCUR_MOVE 1
#define WCUR_RESIZE 2
#define WCUR_TOPLEFTRESIZE 3
#define WCUR_TOPRIGHTRESIZE 4
#define WCUR_BOTTOMLEFTRESIZE 5
#define WCUR_BOTTOMRIGHTRESIZE 6
#define WCUR_VERTICALRESIZE 7
#define WCUR_HORIZONRESIZE 8
#define WCUR_WAIT 9
#define WCUR_ARROW 10
#define WCUR_QUESTION 11
#define WCUR_TEXT 12
#define WCUR_SELECT 13
#define WCUR_ROOT 14
#define WCUR_LAST 15
#define WCUR_VERTICALRESIZE 7
#define WCUR_HORIZONRESIZE 8
#define WCUR_WAIT 9
#define WCUR_ARROW 10
#define WCUR_QUESTION 11
#define WCUR_TEXT 12
#define WCUR_SELECT 13
#define WCUR_ROOT 14
#define WCUR_EMPTY 15
#define WCUR_LAST 16
/* geometry displays */
#define WDIS_NEW 0 /* new style */
#define WDIS_CENTER 1 /* center of screen */
#define WDIS_TOPLEFT 2 /* top left corner of screen */
#define WDIS_FRAME_CENTER 3 /* center of the frame */
#define WDIS_NONE 4
#define WDIS_NEW 0 /* new style */
#define WDIS_CENTER 1 /* center of screen */
#define WDIS_TOPLEFT 2 /* top left corner of screen */
#define WDIS_FRAME_CENTER 3 /* center of the frame */
#define WDIS_NONE 4
/* keyboard input focus mode */
#define WKF_CLICK 0
@@ -181,10 +183,10 @@ typedef enum {
#define WIS_RANDOM 4 /* secret */
/* switchmenu actions */
#define ACTION_ADD 0
#define ACTION_REMOVE 1
#define ACTION_CHANGE 2
#define ACTION_CHANGE_WORKSPACE 3
#define ACTION_ADD 0
#define ACTION_REMOVE 1
#define ACTION_CHANGE 2
#define ACTION_CHANGE_WORKSPACE 3
#define ACTION_CHANGE_STATE 4
@@ -202,8 +204,8 @@ typedef enum {
#define WS_PFOCUSED 2
/* clip title colors */
#define CLIP_NORMAL 0
#define CLIP_COLLAPSED 1
#define CLIP_NORMAL 0
#define CLIP_COLLAPSED 1
/* icon yard position */
@@ -420,8 +422,8 @@ typedef struct WPreferences {
unsigned int vedge_bordersize;
unsigned int vedge_hscrollspeed;
unsigned int vedge_vscrollspeed;
unsigned int vedge_maxheight;
unsigned int vedge_maxwidth;
unsigned int vedge_resistance;
unsigned int vedge_attraction;
#endif
char ws_cycle; /* Cycle existing workspaces */
+220 -127
View File
@@ -69,6 +69,8 @@ extern WPreferences wPreferences;
extern Atom _XA_WM_TAKE_FOCUS;
extern void ProcessPendingEvents();
/******* Local Variables *******/
static struct {
@@ -85,37 +87,6 @@ static struct {
#define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
static int ignoreTimestamp=0;
#ifdef ANIMATIONS
static void
processEvents(int event_count)
{
XEvent event;
/*
* This is a hack. When animations are enabled, processing of
* events ocurred during a animation are delayed until it's end.
* Calls that consider the TimeStamp, like XSetInputFocus(), will
* fail because the TimeStamp is too old. Then, for example, if
* the user changes window focus while a miniaturize animation is
* in course, the window will not get focus properly after the end
* of the animation. This tries to workaround it by passing CurrentTime
* as the TimeStamp for XSetInputFocus() for all events ocurred during
* the animation.
*/
ignoreTimestamp=1;
while (XPending(dpy) && event_count--) {
WMNextEvent(dpy, &event);
WMHandleEvent(&event);
}
ignoreTimestamp=0;
}
#endif /* ANIMATIONS */
/*
*----------------------------------------------------------------------
* wSetFocusTo--
@@ -139,33 +110,21 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
int timestamp=LastTimestamp;
WApplication *oapp=NULL, *napp=NULL;
int wasfocused;
if (scr->flags.ignore_focus_events || LastFocusChange > timestamp)
return;
if (!old_scr)
old_scr=scr;
old_focused=old_scr->focused_window;
/*
* Safeguard: make sure the timestamp is monotonically increasing
* (very unlikely that this will be needed, still a safeguard)
*/
if (timestamp <= LastFocusChange)
timestamp = LastFocusChange + 1;
LastFocusChange = timestamp;
/*
* This is a hack, because XSetInputFocus() should have a proper
* timestamp instead of CurrentTime but it seems that some times
* clients will not receive focus properly that way.
*/
if (ignoreTimestamp)
timestamp = CurrentTime;
if (old_focused)
oapp = wApplicationOf(old_focused->main_window);
if (wwin == NULL) {
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
if (old_focused) {
wWindowUnfocus(old_focused);
}
@@ -199,12 +158,12 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
/* set input focus */
switch (wwin->focus_mode) {
case WFM_NO_INPUT:
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
break;
case WFM_PASSIVE:
case WFM_LOCALLY_ACTIVE:
XSetInputFocus(dpy, wwin->client_win, RevertToParent, timestamp);
XSetInputFocus(dpy, wwin->client_win, RevertToParent, CurrentTime);
break;
case WFM_GLOBALLY_ACTIVE:
@@ -216,7 +175,7 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
}
XSync(dpy, False);
} else {
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
}
if (WFLAGP(wwin, no_focusable))
return;
@@ -333,9 +292,8 @@ wShadeWindow(WWindow *wwin)
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup) {
/* Look at processEvents() for reason of this code. */
XSync(dpy, 0);
processEvents(XPending(dpy));
/* Catch up with events not processed while animation was running */
ProcessPendingEvents();
}
#endif
}
@@ -419,7 +377,7 @@ wMaximizeWindow(WWindow *wwin, int directions)
int changed_h, changed_v, shrink_h, shrink_v;
WArea usableArea, totalArea;
if (WFLAGP(wwin, no_resizable))
if (!IS_RESIZABLE(wwin))
return;
totalArea.x1 = 0;
@@ -550,6 +508,65 @@ wUnmaximizeWindow(WWindow *wwin)
wSoundPlay(WSOUND_UNMAXIMIZE);
}
void
wFullscreenWindow(WWindow *wwin)
{
int head;
WMRect rect;
if (wwin->flags.fullscreen)
return;
wwin->flags.fullscreen = True;
wWindowConfigureBorders(wwin);
ChangeStackingLevel(wwin->frame->core, WMFullscreenLevel);
wwin->bfs_geometry.x = wwin->frame_x;
wwin->bfs_geometry.y = wwin->frame_y;
wwin->bfs_geometry.width = wwin->frame->core->width;
wwin->bfs_geometry.height = wwin->frame->core->height;
head = wGetHeadForWindow(wwin);
rect = wGetRectForHead(wwin->screen_ptr, head);
wWindowConfigure(wwin, rect.pos.x, rect.pos.y,
rect.size.width, rect.size.height);
WMPostNotificationName(WMNChangedState, wwin, "fullscreen");
}
void
wUnfullscreenWindow(WWindow *wwin)
{
if (!wwin->flags.fullscreen)
return;
wwin->flags.fullscreen = False;
if (wwin->frame->core->stacking->window_level == WMFullscreenLevel) {
if (WFLAGP(wwin, sunken)) {
ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
} else if (WFLAGP(wwin, floating)) {
ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
} else {
ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
}
}
wWindowConfigure(wwin, wwin->bfs_geometry.x, wwin->bfs_geometry.y,
wwin->bfs_geometry.width, wwin->bfs_geometry.height);
wWindowConfigureBorders(wwin);
// seems unnecessary, but also harmless (doesn't generate flicker) -Dan
wFrameWindowPaint(wwin->frame);
WMPostNotificationName(WMNChangedState, wwin, "fullscreen");
}
#ifdef ANIMATIONS
static void
animateResizeFlip(WScreen *scr, int x, int y, int w, int h,
@@ -943,7 +960,11 @@ wIconifyWindow(WWindow *wwin)
GrabModeAsync, None, None, CurrentTime);
}
if (!wPreferences.disable_miniwindows) {
if (!wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
) {
if (!wwin->flags.icon_moved) {
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, &wwin->icon_y, wGetHeadForWindow(wwin));
}
@@ -968,7 +989,11 @@ wIconifyWindow(WWindow *wwin)
* something before the animation starts (and the server is grabbed) */
XSync(dpy, 0);
if (wPreferences.disable_miniwindows)
if (wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
|| wwin->flags.net_handle_icon
#endif
)
wClientSetState(wwin, IconicState, None);
else
wClientSetState(wwin, IconicState, wwin->icon->icon_win);
@@ -979,7 +1004,11 @@ wIconifyWindow(WWindow *wwin)
&& !wPreferences.no_animations) {
int ix, iy, iw, ih;
if (!wPreferences.disable_miniwindows) {
if (!wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon->core->width;
@@ -995,6 +1024,14 @@ wIconifyWindow(WWindow *wwin)
ih = area.y2 - iy;
} else
#endif /* KWM_HINTS */
#ifdef NETWM_HINTS
if (wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon_w;
ih = wwin->icon_h;
} else
#endif
{
ix = 0;
iy = 0;
@@ -1011,7 +1048,11 @@ wIconifyWindow(WWindow *wwin)
wwin->flags.skip_next_animation = 0;
if (!wPreferences.disable_miniwindows) {
if (!wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
) {
if (wwin->screen_ptr->current_workspace==wwin->frame->workspace ||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
@@ -1051,20 +1092,27 @@ wIconifyWindow(WWindow *wwin)
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup) {
/* Catch up with events not processed while animation was running */
Window clientwin = wwin->client_win;
XSync(dpy, 0);
processEvents(XPending(dpy));
ProcessPendingEvents();
/* the window can disappear while doing the processEvents() */
if (!wWindowFor(clientwin))
/* the window can disappear while ProcessPendingEvents() runs */
if (!wWindowFor(clientwin)) {
return;
}
}
#endif
}
if (wwin->flags.selected && !wPreferences.disable_miniwindows)
/* maybe we want to do this regardless of net_handle_icon
* it seems to me we might break behaviour this way.
*/
if (wwin->flags.selected && !wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
)
wIconSelect(wwin->icon);
WMPostNotificationName(WMNChangedState, wwin, "iconify");
@@ -1076,7 +1124,16 @@ wIconifyWindow(WWindow *wwin)
void
wDeiconifyWindow(WWindow *wwin)
{
wWindowChangeWorkspace(wwin, wwin->screen_ptr->current_workspace);
#ifdef NETWM_HINTS
/* we're hiding for show_desktop */
int netwm_hidden = wwin->flags.net_show_desktop &&
wwin->frame->workspace!=wwin->screen_ptr->current_workspace;
#else
int netwm_hidden = False;
#endif
if (!netwm_hidden)
wWindowChangeWorkspace(wwin, wwin->screen_ptr->current_workspace);
if (!wwin->flags.miniaturized)
return;
@@ -1094,86 +1151,121 @@ wDeiconifyWindow(WWindow *wwin)
}
wwin->flags.miniaturized = 0;
if (!wwin->flags.shaded)
if (!netwm_hidden && !wwin->flags.shaded) {
wwin->flags.mapped = 1;
if (!wPreferences.disable_miniwindows && wwin->icon != NULL) {
if (wwin->icon->selected)
wIconSelect(wwin->icon);
XUnmapWindow(dpy, wwin->icon->core->window);
}
wSoundPlay(WSOUND_DEICONIFY);
if (!netwm_hidden || wPreferences.sticky_icons) {
/* maybe we want to do this regardless of net_handle_icon
* it seems to me we might break behaviour this way.
*/
if (!wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
&& wwin->icon != NULL) {
if (wwin->icon->selected)
wIconSelect(wwin->icon);
XUnmapWindow(dpy, wwin->icon->core->window);
}
}
if (!netwm_hidden)
wSoundPlay(WSOUND_DEICONIFY);
/* if the window is in another workspace, do it silently */
if (!netwm_hidden) {
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
int ix, iy, iw, ih;
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
int ix, iy, iw, ih;
if (!wPreferences.disable_miniwindows) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon->core->width;
ih = wwin->icon->core->height;
} else {
if (!wPreferences.disable_miniwindows
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon->core->width;
ih = wwin->icon->core->height;
} else {
#ifdef KWM_HINTS
WArea area;
WArea area;
if (wKWMGetIconGeometry(wwin, &area)) {
ix = area.x1;
iy = area.y1;
iw = area.x2 - ix;
ih = area.y2 - iy;
} else
if (wKWMGetIconGeometry(wwin, &area)) {
ix = area.x1;
iy = area.y1;
iw = area.x2 - ix;
ih = area.y2 - iy;
} else
#endif /* KWM_HINTS */
{
ix = 0;
iy = 0;
iw = wwin->screen_ptr->scr_width;
ih = wwin->screen_ptr->scr_height;
}
}
animateResize(wwin->screen_ptr, ix, iy, iw, ih,
wwin->frame_x, wwin->frame_y,
wwin->frame->core->width, wwin->frame->core->height,
False);
}
#ifdef NETWM_HINTS
if (wwin->flags.net_handle_icon) {
ix = wwin->icon_x;
iy = wwin->icon_y;
iw = wwin->icon_w;
ih = wwin->icon_h;
} else
#endif
{
ix = 0;
iy = 0;
iw = wwin->screen_ptr->scr_width;
ih = wwin->screen_ptr->scr_height;
}
}
animateResize(wwin->screen_ptr, ix, iy, iw, ih,
wwin->frame_x, wwin->frame_y,
wwin->frame->core->width, wwin->frame->core->height,
False);
}
#endif /* ANIMATIONS */
wwin->flags.skip_next_animation = 0;
XGrabServer(dpy);
if (!wwin->flags.shaded) {
XMapWindow(dpy, wwin->client_win);
wwin->flags.skip_next_animation = 0;
XGrabServer(dpy);
if (!wwin->flags.shaded) {
XMapWindow(dpy, wwin->client_win);
}
XMapWindow(dpy, wwin->frame->core->window);
wRaiseFrame(wwin->frame->core);
if (!wwin->flags.shaded) {
wClientSetState(wwin, NormalState, None);
}
mapTransientsFor(wwin);
}
XMapWindow(dpy, wwin->frame->core->window);
wRaiseFrame(wwin->frame->core);
if (!wwin->flags.shaded) {
wClientSetState(wwin, NormalState, None);
}
mapTransientsFor(wwin);
if (!wPreferences.disable_miniwindows && wwin->icon != NULL) {
if (!wPreferences.disable_miniwindows && wwin->icon != NULL
#ifdef NETWM_HINTS
&& !wwin->flags.net_handle_icon
#endif
) {
RemoveFromStackList(wwin->icon->core);
/* removeIconGrabs(wwin->icon);*/
wIconDestroy(wwin->icon);
wwin->icon = NULL;
}
XUngrabServer(dpy);
wSetFocusTo(wwin->screen_ptr, wwin);
if (!netwm_hidden) {
XUngrabServer(dpy);
wSetFocusTo(wwin->screen_ptr, wwin);
#ifdef ANIMATIONS
if (!wwin->screen_ptr->flags.startup) {
Window clientwin = wwin->client_win;
if (!wwin->screen_ptr->flags.startup) {
/* Catch up with events not processed while animation was running */
Window clientwin = wwin->client_win;
XSync(dpy, 0);
processEvents(XPending(dpy));
ProcessPendingEvents();
if (!wWindowFor(clientwin))
return;
}
/* the window can disappear while ProcessPendingEvents() runs */
if (!wWindowFor(clientwin)) {
return;
}
}
#endif
}
if (wPreferences.auto_arrange_icons) {
wArrangeIcons(wwin->screen_ptr, True);
@@ -1182,7 +1274,8 @@ wDeiconifyWindow(WWindow *wwin)
WMPostNotificationName(WMNChangedState, wwin, "iconify");
/* In case we were shaded and iconified, also unshade */
wUnshadeWindow(wwin);
if (!netwm_hidden)
wUnshadeWindow(wwin);
}
@@ -1618,9 +1711,9 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
while (aicon) {
if (!aicon->docked) {
/* XXX: can: icon == NULL ? */
/* The intention here is to place the AppIcon on the head that contains most of the applications _main_ window. */
/* printf("appicon: %x %x\n", aicon->icon->core->window, aicon->main_window); */
/* CHECK: can icon be NULL here ? */
/* The intention here is to place the AppIcon on the head that
* contains most of the applications _main_ window. */
head = wGetHeadForWindow(aicon->icon->owner);
if (aicon->x_pos != X || aicon->y_pos != Y) {
@@ -1847,7 +1940,7 @@ wSelectWindow(WWindow *wwin, Bool flag)
wwin->flags.selected = 1;
XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel);
if (WFLAGP(wwin, no_border)) {
if (!HAS_BORDER(wwin)) {
XSetWindowBorderWidth(dpy, wwin->frame->core->window,
FRAME_BORDER_WIDTH);
}
@@ -1860,7 +1953,7 @@ wSelectWindow(WWindow *wwin, Bool flag)
XSetWindowBorder(dpy, wwin->frame->core->window,
scr->frame_border_pixel);
if (WFLAGP(wwin, no_border)) {
if (!HAS_BORDER(wwin)) {
XSetWindowBorderWidth(dpy, wwin->frame->core->window, 0);
}
+4
View File
@@ -65,4 +65,8 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll);
void wMakeWindowVisible(WWindow *wwin);
void wFullscreenWindow(WWindow *wwin);
void wUnfullscreenWindow(WWindow *wwin);
#endif
+1 -1
View File
@@ -407,7 +407,7 @@ setIconCallback(WMenu *menu, WMenuEntry *entry)
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
if (result && !icon->destroyed) {
if (file[0]==0) {
if (file && *file==0) {
wfree(file);
file = NULL;
}
+18 -11
View File
@@ -50,6 +50,8 @@
#include "dock.h"
#include "wsound.h"
#include "xinerama.h"
/******** Global variables ********/
@@ -123,16 +125,14 @@ findDockIconFor(WDock *dock, Window main_window)
static void
extractIcon(WWindow *wwin)
{
int argc;
char **argv;
if (!XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc < 1)
return;
char *progname;
wApplicationExtractDirPackIcon(wwin->screen_ptr,argv[0],
wwin->wm_instance,
wwin->wm_class);
XFreeStringList(argv);
progname = GetProgramNameForWindow(wwin->client_win);
if (progname) {
wApplicationExtractDirPackIcon(wwin->screen_ptr, progname,
wwin->wm_instance, wwin->wm_class);
wfree(progname);
}
}
@@ -172,7 +172,7 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
val = WMGetFromPLDictionary(adict, iconk);
} else {
/* no dictionary for app, so create one */
adict = WMCreatePLDictionary(NULL, NULL, NULL);
adict = WMCreatePLDictionary(NULL, NULL);
WMPutInPLDictionary(dict, key, adict);
WMReleasePropList(adict);
val = NULL;
@@ -246,8 +246,10 @@ extractClientIcon(WAppIcon *icon)
WApplication*
wApplicationCreate(WScreen *scr, Window main_window)
wApplicationCreate(WWindow *wwin)
{
WScreen *scr = wwin->screen_ptr;
Window main_window = wwin->main_window;
WApplication *wapp;
WWindow *leader;
@@ -295,6 +297,11 @@ wApplicationCreate(WScreen *scr, Window main_window)
return NULL;
}
wapp->main_window_desc->fake_group = wwin->fake_group;
#ifdef NETWM_HINTS
wapp->main_window_desc->net_icon_image = RRetainImage(wwin->net_icon_image);
#endif
extractIcon(wapp->main_window_desc);
leader = wWindowFor(main_window);
+1 -1
View File
@@ -50,7 +50,7 @@ typedef struct WApplication {
} WApplication;
WApplication *wApplicationCreate(WScreen *scr, Window main_window);
WApplication *wApplicationCreate(struct WWindow *wwin);
void wApplicationDestroy(WApplication *wapp);
WApplication *wApplicationOf(Window window);
+27 -22
View File
@@ -46,6 +46,9 @@
#ifdef KWM_HINTS
#include "kwm.h"
#endif
#ifdef NETWM_HINTS
# include "wmspec.h"
#endif
/****** Global Variables ******/
@@ -239,7 +242,7 @@ wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
/* If the window is shaded, wrong height will be set for the window */
if (xcre->value_mask & CWX) {
nx = xcre->x;
if (!WFLAGP(wwin, no_border))
if (HAS_BORDER(wwin))
nx -= FRAME_BORDER_WIDTH;
}
else
@@ -247,7 +250,7 @@ wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
if (xcre->value_mask & CWY) {
ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
if (!WFLAGP(wwin, no_border))
if (HAS_BORDER(wwin))
ny -= FRAME_BORDER_WIDTH;
}
else
@@ -353,22 +356,17 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
case XA_WM_COMMAND:
if (wwin->main_window!=None) {
WApplication *wapp = wApplicationOf(wwin->main_window);
char **argv;
int argc;
char *command;
if (!wapp || !wapp->app_icon)
if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
break;
if (XGetCommand(dpy, wwin->main_window, &argv, &argc)) {
if (argc > 0 && argv != NULL) {
if (wapp->app_icon->command)
wfree(wapp->app_icon->command);
wapp->app_icon->command = wtokenjoin(argv, argc);
}
if (argv) {
XFreeStringList(argv);
}
}
command = GetCommandForWindow(wwin->main_window);
if (command) {
if (wapp->app_icon->command)
wfree(wapp->app_icon->command);
wapp->app_icon->command = command;
}
}
break;
@@ -457,7 +455,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
wApplicationDestroy(wApplicationOf(wwin->main_window));
wwin->main_window = wwin->client_leader;
wwin->group_id = None;
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
wApplicationCreate(wwin);
break;
/* 1,2,4 - change leader to new value of window_group */
@@ -467,7 +465,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
wApplicationDestroy(wApplicationOf(wwin->main_window));
wwin->main_window = new_hints->window_group;
wwin->group_id = wwin->main_window;
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
wApplicationCreate(wwin);
break;
/* 5 - destroy application */
@@ -481,7 +479,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
case 6:
wwin->main_window = new_hints->window_group;
wwin->group_id = wwin->main_window;
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
wApplicationCreate(wwin);
break;
/* 7 - we have a fake window group id, so just ignore anything else */
case 7:
@@ -630,7 +628,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
else
foo->main_window = None;
if (foo->main_window) {
wapp = wApplicationCreate(scr, foo->main_window);
wapp = wApplicationCreate(foo);
}
}
foo = foo->prev;
@@ -665,11 +663,18 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
XFree(attr);
} else {
#if defined(KWM_HINTS) || defined(NETWM_HINTS)
Bool done = False;
#endif
#ifdef KWM_HINTS
Bool done;
done = wKWMCheckClientHintChange(wwin, event);
if (!done)
done = wKWMCheckClientHintChange(wwin, event);
#endif /* KWM_HINTS */
#ifdef NETWM_HINTS
if (!done) {
done = wNETWMCheckClientHintChange(wwin, event);
}
#endif
}
}
}
+19 -9
View File
@@ -198,7 +198,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
if (hasModifier) {
keymap = XGetModifierMapping(dpy);
#ifdef DEBUG
printf("Grabbing keyboard\n");
#endif
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
CurrentTime);
}
@@ -223,11 +225,6 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
wWindowFocus(newFocused, scr->focused_window);
oldFocused = newFocused;
if (hasModifier)
done = False;
else
done = True;
#if 0
if (wPreferences.popup_switchmenu &&
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
@@ -236,8 +233,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
openedSwitchMenu = True;
}
#endif
while (!done) {
WMMaskEvent(dpy,KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
while (hasModifier && !done) {
WMMaskEvent(dpy, KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
if (ev.type != KeyRelease && ev.type != KeyPress) {
WMHandleEvent(&ev);
@@ -247,7 +245,10 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
modifiers = ev.xkey.state & ValidModMask;
if (ev.type == KeyPress) {
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
#ifdef DEBUG
printf("Got key press\n");
#endif
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
newFocused = nextToFocusAfter(newFocused);
@@ -274,12 +275,18 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
}
} else {
#ifdef DEBUG
printf("Got something else\n");
#endif
somethingElse = True;
done = True;
}
} else if (ev.type == KeyRelease) {
int i;
#ifdef DEBUG
printf("Got key release\n");
#endif
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
if (keymap->modifiermap[i] == ev.xkey.keycode &&
wKeyBindings[WKBD_FOCUSNEXT].modifier
@@ -294,6 +301,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
XFreeModifiermap(keymap);
if (hasModifier) {
#ifdef DEBUG
printf("Ungrabbing keyboard\n");
#endif
XUngrabKeyboard(dpy, CurrentTime);
}
wSetFocusTo(scr, newFocused);
+32 -7
View File
@@ -155,6 +155,9 @@ static int setUTitleBack();
static int setResizebarBack();
static int setWorkspaceBack();
static int setWorkspaceSpecificBack();
#ifdef VIRTUAL_DESKTOP
static int setVirtualEdgeThickness();
#endif
static int setMenuTitleColor();
static int setMenuTextColor();
static int setMenuDisabledColor();
@@ -436,22 +439,34 @@ WDefaultEntry optionList[] = {
},
#ifdef VIRTUAL_DESKTOP
{"VirtualEdgeThickness", "1", NULL,
&wPreferences.vedge_thickness, getInt, NULL
&wPreferences.vedge_thickness, getInt, setVirtualEdgeThickness
},
{"VirtualEdgeExtendSpace", "0", NULL,
&wPreferences.vedge_bordersize, getInt, NULL
},
{"VirtualEdgeHorizonScrollSpeed", "1", NULL,
{"VirtualEdgeHorizonScrollSpeed", "30", NULL,
&wPreferences.vedge_hscrollspeed, getInt, NULL
},
{"VirtualEdgeVerticalScrollSpeed", "1", NULL,
{"VirtualEdgeVerticalScrollSpeed", "30", NULL,
&wPreferences.vedge_vscrollspeed, getInt, NULL
},
{"VirtualEdgeMaximumWidth", "3000", NULL,
&wPreferences.vedge_maxwidth, getInt, NULL
{"VirtualEdgeResistance", "30", NULL,
&wPreferences.vedge_resistance, getInt, NULL
},
{"VirtualEdgeMaximumHeight", "3000", NULL,
&wPreferences.vedge_maxheight, getInt, NULL
{"VirtualEdgeAttraction", "30", NULL,
&wPreferences.vedge_attraction, getInt, NULL
},
{"VirtualEdgeLeftKey", "None", (void*)WKBD_VDESK_LEFT,
NULL, getKeybind, setKeyGrab
},
{"VirtualEdgeRightKey", "None", (void*)WKBD_VDESK_RIGHT,
NULL, getKeybind, setKeyGrab
},
{"VirtualEdgeUpKey", "None", (void*)WKBD_VDESK_UP,
NULL, getKeybind, setKeyGrab
},
{"VirtualEdgeDownKey", "None", (void*)WKBD_VDESK_DOWN,
NULL, getKeybind, setKeyGrab
},
#endif
{"StickyIcons", "NO", NULL,
@@ -3352,6 +3367,16 @@ setWorkspaceBack(WScreen *scr, WDefaultEntry *entry, WMPropList *value,
}
#ifdef VIRTUAL_DESKTOP
static int
setVirtualEdgeThickness(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
{
wWorkspaceUpdateEdge(scr);
return 0;
}
#endif
static int
setWidgetColor(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
{
+26 -8
View File
@@ -785,7 +785,7 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
/* check if the file the user selected is not the one that
* would be loaded by default with the current search path */
*file = WMGetListSelectedItem(panel->iconList)->text;
if ((*file)[0]==0) {
if (**file==0) {
wfree(*file);
*file = NULL;
} else {
@@ -804,6 +804,8 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
*file = NULL;
}
result = panel->result;
WMReleaseFont(panel->normalfont);
WMUnmapWidget(panel->win);
@@ -812,8 +814,6 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
wUnmanageWindow(wwin, False, False);
result= panel->result;
wfree(panel);
XDestroyWindow(dpy, parent);
@@ -862,8 +862,8 @@ typedef struct {
#define COPYRIGHT_TEXT \
"Copyright © 1997-2004 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
"Copyright © 1998-2004 Dan Pascu <dan@windowmaker.org>"
"Copyright \xc2\xa9 1997-2004 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
"Copyright \xc2\xa9 1998-2004 Dan Pascu <dan@windowmaker.org>"
@@ -1314,8 +1314,6 @@ wShowInfoPanel(WScreen *scr)
WMMoveWidget(panel->copyrL, 15, 185);
WMSetLabelTextAlignment(panel->copyrL, WALeft);
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
/* we want the (c) character in the font, so don't use a FontSet here */
// fix this -Dan font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
font = WMSystemFontOfSize(scr->wmscreen, 11);
if (font) {
WMSetLabelFont(panel->copyrL, font);
@@ -1368,7 +1366,7 @@ wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("\nAdditional support for: "));
{
char *list[8];
char *list[9];
char buf[80];
int j = 0;
@@ -1384,6 +1382,9 @@ wShowInfoPanel(WScreen *scr)
#ifdef OLWM_HINTS
list[j++] = "OLWM";
#endif
#ifdef NETWM_HINTS
list[j++] = "WMSPEC";
#endif
buf[0] = 0;
for (i = 0; i < j; i++) {
@@ -1408,6 +1409,23 @@ wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("; Antialiased text"));
#endif
#ifdef VIRTUAL_DESKTOP
strbuf = wstrappend(strbuf, _("; VirtualDesktop"));
#endif
#ifdef XINERAMA
strbuf = wstrappend(strbuf, _("\n"));
#ifdef SOLARIS_XINERAMA
strbuf = wstrappend(strbuf, _("Solaris "));
#endif
strbuf = wstrappend(strbuf, _("Xinerama: "));
{
char tmp[128];
snprintf(tmp, sizeof(tmp)-1, "%d heads found.", scr->xine_info.count);
strbuf = wstrappend(strbuf, tmp);
}
#endif
panel->infoL = WMCreateLabel(panel->win);
WMResizeWidget(panel->infoL, 350, 75);
+62 -75
View File
@@ -956,9 +956,8 @@ launchDockedApplication(WAppIcon *btn, Bool withSelection)
btn->drop_launch = 0;
btn->paste_launch = withSelection;
scr->last_dock = btn->dock;
btn->pid = execCommand(btn,
withSelection ? btn->paste_command : btn->command,
NULL);
btn->pid = execCommand(btn, (withSelection ? btn->paste_command :
btn->command), NULL);
if (btn->pid>0) {
if (btn->buggy_app) {
/* give feedback that the app was launched */
@@ -972,8 +971,9 @@ launchDockedApplication(WAppIcon *btn, Bool withSelection)
} else {
wwarning(_("could not launch application %s\n"), btn->command);
btn->launching = 0;
if (!btn->relaunching)
if (!btn->relaunching) {
btn->running = 0;
}
}
}
}
@@ -1386,13 +1386,13 @@ make_icon_state(WAppIcon *btn)
position = WMCreatePLString(buffer);
node = WMCreatePLDictionary(dCommand, command,
dName, name,
dAutoLaunch, autolaunch,
dLock, lock,
dForced, forced,
dBuggyApplication, buggy,
dPosition, position,
NULL);
dName, name,
dAutoLaunch, autolaunch,
dLock, lock,
dForced, forced,
dBuggyApplication, buggy,
dPosition, position,
NULL);
WMReleasePropList(command);
WMReleasePropList(name);
WMReleasePropList(position);
@@ -1450,8 +1450,7 @@ dockSaveState(WDock *dock)
}
}
dock_state = WMCreatePLDictionary(dApplications, list,
NULL);
dock_state = WMCreatePLDictionary(dApplications, list, NULL);
if (dock->type == WM_DOCK) {
snprintf(buffer, sizeof(buffer), "Applications%i", dock->screen_ptr->scr_height);
@@ -1512,9 +1511,8 @@ wDockSaveState(WScreen *scr, WMPropList *old_state)
if (strncasecmp(WMGetFromPLString(tmp), "applications", 12) == 0
&& !WMGetFromPLDictionary(dock_state, tmp)) {
WMPutInPLDictionary(dock_state,
tmp,
WMGetFromPLDictionary(old_state, tmp));
WMPutInPLDictionary(dock_state, tmp,
WMGetFromPLDictionary(old_state, tmp));
}
}
WMReleasePropList(keys);
@@ -1774,9 +1772,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dPosition);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("Position");
else {
} else {
WMRect rect;
int flags;
@@ -1795,12 +1793,13 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
wScreenKeepInside(scr, &x, &dock->y_pos, ICON_SIZE, ICON_SIZE);
}
/* This is no more needed. ??? */
/* Is this needed any more? */
if (type == WM_CLIP) {
if (dock->x_pos < 0)
if (dock->x_pos < 0) {
dock->x_pos = 0;
else if (dock->x_pos > scr->scr_width-ICON_SIZE)
} else if (dock->x_pos > scr->scr_width-ICON_SIZE) {
dock->x_pos = scr->scr_width-ICON_SIZE;
}
} else {
if (dock->x_pos >= 0) {
dock->x_pos = DOCK_EXTRA_SPACE;
@@ -1820,11 +1819,12 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dLowered);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("Lowered");
else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
} else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->lowered = 1;
}
}
}
@@ -1836,11 +1836,12 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dCollapsed);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("Collapsed");
else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
} else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->collapsed = 1;
}
}
}
@@ -1850,9 +1851,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dAutoCollapse);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("AutoCollapse");
else {
} else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->auto_collapse = 1;
dock->collapsed = 1;
@@ -1866,9 +1867,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dAutoRaiseLower);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("AutoRaiseLower");
else {
} else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->auto_raise_lower = 1;
}
@@ -1882,11 +1883,12 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
value = WMGetFromPLDictionary(dock_state, dAutoAttractIcons);
if (value) {
if (!WMIsPLString(value))
if (!WMIsPLString(value)) {
COMPLAIN("AutoAttractIcons");
else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
} else {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->attract_icons = 1;
}
}
}
@@ -2136,21 +2138,19 @@ Bool
wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
{
WWindow *wwin;
char **argv;
int argc;
int index;
wwin = icon->icon->owner;
if (icon->command==NULL) {
icon->editing = 0;
if (XGetCommand(dpy, wwin->client_win, &argv, &argc) && argc>0) {
char *command;
icon->command = wtokenjoin(argv, argc);
XFreeStringList(argv);
icon->editing = 0;
command = GetCommandForWindow(wwin->client_win);
if (command) {
icon->command = command;
} else {
char *command=NULL;
/* icon->forced_dock = 1;*/
/* icon->forced_dock = 1;*/
if (dock->type!=WM_CLIP || !icon->attracted) {
icon->editing = 1;
if (wInputDialog(dock->screen_ptr, _("Dock Icon"),
@@ -2181,7 +2181,7 @@ wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
}
}
}
}
}
} else {
icon->editing = 0;
}
@@ -2266,8 +2266,7 @@ Bool
moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
{
WWindow *wwin;
char **argv;
int argc;
char *command;
int index;
if (src == dest)
@@ -2285,15 +2284,12 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
* moved icons it applies. -Dan
*/
if ((dest->type==WM_DOCK /*|| dest->keep_attracted*/) && icon->command==NULL) {
if (XGetCommand(dpy, wwin->client_win, &argv, &argc) && argc>0) {
icon->command = wtokenjoin(argv, argc);
XFreeStringList(argv);
command = GetCommandForWindow(wwin->client_win);
if (command) {
icon->command = command;
} else {
char *command=NULL;
icon->editing = 1;
/* icon->forced_dock = 1;*/
/* icon->forced_dock = 1;*/
if (wInputDialog(src->screen_ptr, _("Dock Icon"),
_("Type the command used to launch the application"),
&command)) {
@@ -3177,22 +3173,15 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
Bool found = False;
char *command = NULL;
{
int argc;
char **argv;
if (XGetCommand(dpy, window, &argv, &argc)) {
if (argc > 0 && argv != NULL)
command = wtokenjoin(argv, argc);
if (argv) {
XFreeStringList(argv);
}
}
}
command = GetCommandForWindow(window);
if (!PropGetWMClass(window, &wm_class, &wm_instance) ||
(!wm_class && !wm_instance))
return;
(!wm_class && !wm_instance)) {
if (command)
wfree(command);
return;
}
retry:
for (i=0; i<dock->max_icons; i++) {
@@ -3232,9 +3221,9 @@ retry:
icon->forced_dock = 1;
icon->running = 0;
}
if (!icon->forced_dock)
icon->main_window = window;
if (!icon->forced_dock) {
icon->main_window = window;
}
}
found = True;
if (!wPreferences.no_animations && !icon->launching &&
@@ -3598,8 +3587,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
wWorkspaceChange(dock->screen_ptr, wapp->last_workspace);
}
wUnhideApplication(wapp, event->xbutton.button==Button2,
unhideHere);
wUnhideApplication(wapp, event->xbutton.button==Button2, unhideHere);
if (event->xbutton.state & MOD_MASK) {
wHideOtherApplications(btn->icon->owner);
@@ -3620,9 +3608,8 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
(!btn->running || (event->xbutton.state & ControlMask))) {
launchDockedApplication(btn, False);
}
} else if (btn->xindex == 0 && btn->yindex == 0
&& btn->dock->type == WM_DOCK) {
} else if (btn->xindex==0 && btn->yindex==0 &&
btn->dock->type==WM_DOCK) {
wShowGNUstepPanel(dock->screen_ptr);
}
}
+84 -40
View File
@@ -66,9 +66,13 @@
#ifdef KWM_HINTS
# include "kwm.h"
#endif
#ifdef NETWM_HINTS
# include "wmspec.h"
#endif
/******** Global Variables **********/
extern XContext wWinContext;
extern XContext wVEdgeContext;
extern Cursor wCursor[WCUR_LAST];
@@ -323,7 +327,7 @@ void
EventLoop()
{
XEvent event;
for(;;) {
WMNextEvent(dpy, &event);
WMHandleEvent(&event);
@@ -331,6 +335,39 @@ EventLoop()
}
/*
*----------------------------------------------------------------------
* ProcessPendingEvents --
* Processes the events that are currently pending (at the time
* this function is called) in the display's queue.
*
* Returns:
* After the pending events that were present at the function call
* are processed.
*
* Side effects:
* Many -- whatever handling events may involve.
*
*----------------------------------------------------------------------
*/
void
ProcessPendingEvents()
{
XEvent event;
int count;
XSync(dpy, False);
/* Take a snapshot of the event count in the queue */
count = XPending(dpy);
while (count>0 && XPending(dpy)) {
WMNextEvent(dpy, &event);
WMHandleEvent(&event);
count--;
}
}
Bool
IsDoubleClick(WScreen *scr, XEvent *event)
@@ -478,7 +515,7 @@ handleMapRequest(XEvent *ev)
Window window = ev->xmaprequest.window;
#ifdef DEBUG
L("got map request for %x\n", (unsigned)window);
printf("got map request for %x\n", (unsigned)window);
#endif
if ((wwin = wWindowFor(window))) {
if (wwin->flags.shaded) {
@@ -553,7 +590,7 @@ handleDestroyNotify(XEvent *event)
int index;
#ifdef DEBUG
L("got destroy notify");
printf("got destroy notify\n");
#endif
wwin = wWindowFor(window);
if (wwin) {
@@ -607,7 +644,7 @@ handleExpose(XEvent *event)
XEvent ev;
#ifdef DEBUG
L("got expose");
printf("got expose\n");
#endif
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
@@ -662,7 +699,7 @@ handleButtonPress(XEvent *event)
WScreen *scr;
#ifdef DEBUG
L("got button press");
printf("got button press\n");
#endif
scr = wScreenForRootWindow(event->xbutton.root);
@@ -749,7 +786,7 @@ handleMapNotify(XEvent *event)
{
WWindow *wwin;
#ifdef DEBUG
L("got map");
printf("got map\n");
#endif
wwin = wWindowFor(event->xmap.event);
if (wwin && wwin->client_win == event->xmap.event) {
@@ -772,7 +809,7 @@ handleUnmapNotify(XEvent *event)
XEvent ev;
Bool withdraw = False;
#ifdef DEBUG
L("got unmap");
printf("got unmap\n");
#endif
/* only process windows with StructureNotify selected
* (ignore SubstructureNotify) */
@@ -824,7 +861,7 @@ handleConfigureRequest(XEvent *event)
{
WWindow *wwin;
#ifdef DEBUG
L("got configure request");
printf("got configure request\n");
#endif
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
/*
@@ -847,7 +884,7 @@ handlePropertyNotify(XEvent *event)
unsigned int ju;
WScreen *scr;
#ifdef DEBUG
L("got property notify");
printf("got property notify\n");
#endif
if ((wwin=wWindowFor(event->xproperty.window))) {
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
@@ -876,7 +913,7 @@ handleClientMessage(XEvent *event)
WWindow *wwin;
WObjDescriptor *desc;
#ifdef DEBUG
L("got client message");
printf("got client message\n");
#endif
/* handle transition from Normal to Iconic state */
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
@@ -962,6 +999,10 @@ handleClientMessage(XEvent *event)
wFrameWindowChangeState(wwin->frame, WS_FOCUSED);
break;
}
#ifdef NETWM_HINTS
} else if (wNETWMProcessClientMessage(&event->xclient)) {
/* do nothing */
#endif
#ifdef GNOME_STUFF
} else if (wGNOMEProcessClientMessage(&event->xclient)) {
/* do nothing */
@@ -1035,34 +1076,19 @@ handleEnterNotify(XEvent *event)
{
WWindow *wwin;
WObjDescriptor *desc = NULL;
#ifdef VIRTUAL_DESKTOP
void (*vdHandler)(XEvent * event);
#endif
XEvent ev;
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
#ifdef DEBUG
L("got enter notify");
printf("got enter notify\n");
#endif
#ifdef VIRTUAL_DESKTOP
/* TODO: acceleration code */
if (wPreferences.vedge_thickness) {
int x,y;
if (event->xcrossing.window == scr->virtual_edge_r) {
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, scr->scr_width - wPreferences.vedge_thickness - 1, event->xcrossing.y_root);
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x + VIRTUALEDGE_SCROLL_HSTEP, y);
} else if (event->xcrossing.window == scr->virtual_edge_l) {
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, wPreferences.vedge_thickness + 1, event->xcrossing.y_root);
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x - VIRTUALEDGE_SCROLL_HSTEP, y);
} else if (event->xcrossing.window == scr->virtual_edge_u) {
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, event->xcrossing.x_root, wPreferences.vedge_thickness + 1);
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y - VIRTUALEDGE_SCROLL_VSTEP);
} else if (event->xcrossing.window == scr->virtual_edge_d) {
printf("enter bottom\n");
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, event->xcrossing.x_root, scr->scr_height - wPreferences.vedge_thickness - 1);
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y + VIRTUALEDGE_SCROLL_VSTEP);
}
if (XFindContext(dpy, event->xcrossing.window, wVEdgeContext,
(XPointer *)&vdHandler)!=XCNOENT) {
(*vdHandler)( event);
}
#endif
@@ -1178,7 +1204,7 @@ handleShapeNotify(XEvent *event)
WWindow *wwin;
XEvent ev;
#ifdef DEBUG
L("got shape notify");
printf("got shape notify\n");
#endif
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
XShapeEvent *sev = (XShapeEvent*)&ev;
@@ -1446,7 +1472,7 @@ handleKeyPress(XEvent *event)
}
break;
case WKBD_MAXIMIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_resizable)) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
int newdir = (MAX_VERTICAL|MAX_HORIZONTAL);
CloseWindowMenu(scr);
@@ -1459,7 +1485,7 @@ handleKeyPress(XEvent *event)
}
break;
case WKBD_VMAXIMIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_resizable)) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
int newdir = (MAX_VERTICAL ^ wwin->flags.maximized);
CloseWindowMenu(scr);
@@ -1472,7 +1498,7 @@ handleKeyPress(XEvent *event)
}
break;
case WKBD_HMAXIMIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_resizable)) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
int newdir = (MAX_HORIZONTAL ^ wwin->flags.maximized);
CloseWindowMenu(scr);
@@ -1515,7 +1541,8 @@ handleKeyPress(XEvent *event)
}
break;
case WKBD_MOVERESIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
if (ISMAPPED(wwin) && ISFOCUSED(wwin) &&
(IS_RESIZABLE(wwin) || IS_MOVABLE(wwin))) {
CloseWindowMenu(scr);
wKeyboardMoveResizeWindow(wwin);
@@ -1718,6 +1745,23 @@ handleKeyPress(XEvent *event)
}
break;
#endif /* KEEP_XKB_LOCK_STATUS */
#ifdef VIRTUAL_DESKTOP
case WKBD_VDESK_LEFT:
wWorkspaceKeyboardMoveDesktop(scr, VEC_LEFT);
break;
case WKBD_VDESK_RIGHT:
wWorkspaceKeyboardMoveDesktop(scr, VEC_RIGHT);
break;
case WKBD_VDESK_UP:
wWorkspaceKeyboardMoveDesktop(scr, VEC_UP);
break;
case WKBD_VDESK_DOWN:
wWorkspaceKeyboardMoveDesktop(scr, VEC_DOWN);
break;
#endif
}
}
@@ -1739,7 +1783,7 @@ handleMotionNotify(XEvent *event)
p.y >= (rect.pos.y + rect.size.height - 2)) {
WMenu *menu;
#ifdef DEBUG
L("pointer at screen edge");
printf("pointer at screen edge\n");
#endif
menu = wMenuUnderPointer(scr);
if (menu!=NULL)
@@ -1773,13 +1817,13 @@ handleMotionNotify(XEvent *event)
&& event->xmotion.x_root >= wwin->frame_x
&& event->xmotion.x_root <= wwin->frame_x + wwin->frame->core->width) {
if (!WFLAGP(wwin, no_titlebar)
if (HAS_BORDER(wwin)
&& wwin->frame_y <= - wwin->frame->top_width) {
wWindowMove(wwin, wwin->frame_x, 0);
wwin->flags.dragged_while_fmaximized = 0;
} else if (!WFLAGP(wwin, no_resizebar)
} else if (HAS_RESIZEBAR(wwin)
&& wwin->frame_y + wwin->frame->core->height >=
scr->scr_height + wwin->frame->bottom_width) {
+9 -6
View File
@@ -1488,11 +1488,13 @@ titlebarMouseDown(WObjDescriptor *desc, XEvent *event)
WCoreWindow *titlebar = desc->self;
if (IsDoubleClick(fwin->core->screen_ptr, event)) {
if (fwin->on_dblclick_titlebar)
(*fwin->on_dblclick_titlebar)(titlebar, fwin->child, event);
if (fwin->on_dblclick_titlebar) {
(*fwin->on_dblclick_titlebar)(titlebar, fwin->child, event);
}
} else {
if (fwin->on_mousedown_titlebar)
(*fwin->on_mousedown_titlebar)(titlebar, fwin->child, event);
if (fwin->on_mousedown_titlebar) {
(*fwin->on_mousedown_titlebar)(titlebar, fwin->child, event);
}
}
}
@@ -1534,8 +1536,9 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
}
#ifdef XKB_BUTTON_HINT
if (button == fwin->language_button) {
if (!wPreferences.modelock) return;
image = fwin->languagebutton_image;
if (!wPreferences.modelock)
return;
image = fwin->languagebutton_image;
}
#endif
+12
View File
@@ -152,6 +152,18 @@ void ExecExitScript();
Bool wFetchName(Display *dpy, Window win, char **winname);
Bool wGetIconName(Display *dpy, Window win, char **iconname);
/* Free returned string it when done. (applies to the next 2 functions) */
char* GetCommandForWindow(Window win);
char* GetProgramNameForWindow(Window win);
Bool GetCommandForPid(int pid, char ***argv, int *argc);
#ifdef NETWM_HINTS
#include "wmspec.h"
#define GetPidForWindow(win) wNETWMGetPidForWindow(win)
#else
int GetPidForWindow(Window win);
#endif
#endif
+10 -1
View File
@@ -165,6 +165,11 @@ wIconCreate(WWindow *wwin)
icon->show_title = 0;
#else
icon->show_title = 1;
#endif
#ifdef NETWM_HINTS
if (!icon->image && !WFLAGP(wwin, always_user_icon))
icon->image = RRetainImage(wwin->net_icon_image);
if (!icon->image)
#endif
icon->image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class);
@@ -631,7 +636,11 @@ wIconUpdate(WIcon *icon)
icon->pixmap = None;
if (wwin && WFLAGP(wwin, always_user_icon))
if (wwin && (WFLAGP(wwin, always_user_icon)
#ifdef NETWM_HINTS
|| wwin->net_icon_image
#endif
))
goto user_icon;
/* use client specified icon window */
+14 -4
View File
@@ -79,11 +79,21 @@
#define WKBD_SWITCH_SCREEN 45
#ifdef KEEP_XKB_LOCK_STATUS
# define WKBD_TOGGLE 46
# define WKBD_LAST 47
# define WKBD_TOGGLE 46
# define WKBD_TMP 47
#else
# define WKBD_LAST 46
#endif /* KEEP_XKB_LOCK_STATUS */
# define WKBD_TMP 46
#endif
#ifdef VIRTUAL_DESKTOP
# define WKBD_VDESK_LEFT WKBD_TMP
# define WKBD_VDESK_RIGHT (WKBD_TMP+1)
# define WKBD_VDESK_UP (WKBD_TMP+2)
# define WKBD_VDESK_DOWN (WKBD_TMP+3)
# define WKBD_LAST (WKBD_TMP+4)
#else
# define WKBD_LAST WKBD_TMP
#endif /* VIRTUAL_DESKTOP */
typedef struct WShortKey {
+22 -14
View File
@@ -85,6 +85,7 @@ WDDomain *WDRootMenu = NULL;
XContext wWinContext;
XContext wAppWinContext;
XContext wStackContext;
XContext wVEdgeContext;
/* Atoms */
Atom _XA_WM_STATE;
@@ -123,9 +124,9 @@ Atom _XA_DND_SELECTION;
Cursor wCursor[WCUR_LAST];
/* last event timestamp for XSetInputFocus */
Time LastTimestamp;
Time LastTimestamp = CurrentTime;
/* timestamp on the last time we did XSetInputFocus() */
Time LastFocusChange;
Time LastFocusChange = CurrentTime;
#ifdef SHAPE
Bool wShapeSupported;
@@ -494,8 +495,10 @@ check_defaults()
static void
execInitScript()
{
char *file;
char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
char *file, *paths;
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
paths = wstrappend(paths, ":"DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_INIT_SCRIPT);
wfree(paths);
@@ -519,8 +522,10 @@ execInitScript()
void
ExecExitScript()
{
char *file;
char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
char *file, *paths;
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
paths = wstrappend(paths, ":"DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_EXIT_SCRIPT);
wfree(paths);
@@ -717,22 +722,25 @@ main(int argc, char **argv)
}
if (!Locale) {
Locale = getenv("LC_ALL");
}
if (!Locale) {
Locale = getenv("LANG");
if (Locale) {
/* return of wstrconcat should not be free-ed! read putenv man page */
putenv(wstrconcat("LANG=", Locale));
} else {
Locale = getenv("LC_ALL");
if (!Locale) {
Locale = getenv("LANG");
}
}
setlocale(LC_ALL, "");
if (!Locale || strcmp(Locale, "C")==0 || strcmp(Locale, "POSIX")==0)
Locale = NULL;
Locale = NULL;
#ifdef I18N
if (getenv("NLSPATH"))
bindtextdomain("WindowMaker", getenv("NLSPATH"));
bindtextdomain("WindowMaker", getenv("NLSPATH"));
else
bindtextdomain("WindowMaker", LOCALEDIR);
bindtextdomain("WindowMaker", LOCALEDIR);
textdomain("WindowMaker");
if (!XSupportsLocale()) {
+2 -3
View File
@@ -43,6 +43,7 @@
#include "stacking.h"
#include "text.h"
#include "xinerama.h"
#include "workspace.h"
/****** Global Variables ******/
@@ -2259,9 +2260,7 @@ byebye:
((WMenu*)desc->parent)->flags.inside_handler = 0;
#ifdef VIRTUAL_DESKTOP
if (wPreferences.vedge_thickness) {
wWorkspaceRaiseEdge(scr);
}
#endif
}
@@ -2510,7 +2509,7 @@ wMenuSaveState(WScreen *scr)
WMPropList *menus, *key;
int save_menus = 0;
menus = WMCreatePLDictionary(NULL, NULL, NULL);
menus = WMCreatePLDictionary(NULL, NULL);
#ifndef LITE
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
+186 -69
View File
@@ -1,8 +1,8 @@
/*
/*
* Window Maker window manager
*
*
* Copyright (c) 1997-2003 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
@@ -15,7 +15,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include "wconfig.h"
@@ -52,8 +52,6 @@
/**** global variables *****/
extern char *DisplayName;
extern WPreferences wPreferences;
extern Time LastTimestamp;
@@ -91,7 +89,7 @@ static char*
username()
{
char *tmp;
tmp = getlogin();
if (!tmp) {
struct passwd *user;
@@ -109,7 +107,7 @@ username()
}
return tmp;
}
char *
MakeCPPArgs(char *path)
{
@@ -117,7 +115,7 @@ MakeCPPArgs(char *path)
char buffer[MAXLINE], *buf, *line;
Visual *visual;
char *tmp;
line = wmalloc(MAXLINE);
*line = 0;
i=1;
@@ -125,13 +123,13 @@ MakeCPPArgs(char *path)
if (buf[0]=='(') {
wwarning(_("your machine is misconfigured. HOSTNAME is set to %s"),
buf);
} else
} else
putdef(line, " -DHOST=", buf);
} else if ((buf=getenv("HOST"))!=NULL) {
if (buf[0]=='(') {
wwarning(_("your machine is misconfigured. HOST is set to %s"),
buf);
} else
} else
putdef(line, " -DHOST=", buf);
}
buf = username();
@@ -141,14 +139,14 @@ MakeCPPArgs(char *path)
buf = XDisplayName(DisplayString(dpy));
putdef(line, " -DDISPLAY=", buf);
putdef(line, " -DWM_VERSION=", VERSION);
visual = DefaultVisual(dpy, DefaultScreen(dpy));
putidef(line, " -DVISUAL=", visual->class);
putidef(line, " -DDEPTH=", DefaultDepth(dpy, DefaultScreen(dpy)));
putidef(line, " -DSCR_WIDTH=", WidthOfScreen(DefaultScreenOfDisplay(dpy)));
putidef(line, " -DSCR_HEIGHT=",
putidef(line, " -DSCR_HEIGHT=",
HeightOfScreen(DefaultScreenOfDisplay(dpy)));
/* put the dir where the menu is being read from to the
@@ -181,7 +179,7 @@ MakeCPPArgs(char *path)
char * wgethomedir();
/* home is statically allocated. Don't free it! */
char *home = wgethomedir();
strcpy(fullpath, home);
strcat(fullpath, &(buf[1]));
}
@@ -189,7 +187,7 @@ MakeCPPArgs(char *path)
putdef(line, " -I", fullpath);
} while ((buf = strtok(NULL, ":"))!=NULL);
#undef arg
#ifdef DEBUG
puts("CPP ARGS");
@@ -211,14 +209,14 @@ isBelow(WWindow *win1, WWindow *win2)
{
int i;
WCoreWindow *tmp;
tmp = win1->frame->core->stacking->under;
while (tmp) {
if (tmp == win2->frame->core)
return True;
tmp = tmp->stacking->under;
}
for (i=win1->frame->core->stacking->window_level-1; i>=0; i--) {
tmp = win1->screen_ptr->stacking_list[i];
while (tmp) {
@@ -272,7 +270,7 @@ char **winname;
} else {
/* the hint is probably not set */
*winname = NULL;
return False;
}
}
@@ -291,7 +289,7 @@ char **iconname;
XTextProperty text_prop;
char **list;
int num;
if (XGetWMIconName(dpy, win, &text_prop) != 0 && text_prop.value
&& text_prop.nitems > 0) {
if (text_prop.encoding == XA_STRING)
@@ -313,20 +311,20 @@ char **iconname;
}
static void
static void
eatExpose()
{
XEvent event, foo;
/* compress all expose events into a single one */
if (XCheckMaskEvent(dpy, ExposureMask, &event)) {
/* ignore other exposure events for this window */
while (XCheckWindowEvent(dpy, event.xexpose.window, ExposureMask,
&foo));
/* eat exposes for other windows */
eatExpose();
event.xexpose.count = 0;
XPutBackEvent(dpy, &event);
}
@@ -351,8 +349,8 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
{ICON_SLIDE_DELAY_M, ICON_SLIDE_STEPS_M, ICON_SLIDE_SLOWDOWN_M},
{ICON_SLIDE_DELAY_S, ICON_SLIDE_STEPS_S, ICON_SLIDE_SLOWDOWN_S},
{ICON_SLIDE_DELAY_US, ICON_SLIDE_STEPS_US, ICON_SLIDE_SLOWDOWN_US}};
dx = (float)(to_x-from_x);
dy = (float)(to_y-from_y);
@@ -477,7 +475,7 @@ ShrinkString(WMFont *font, char *string, int width)
} else if (w<width) {
p1 = t;
t = p1+(p2-p1)/2;
} else
} else
p2=p1=t;
}
strcat(text, &string[p-p1]);
@@ -516,7 +514,7 @@ static char*
getTextSelection(WScreen *screen, Atom selection)
{
int buffer = -1;
switch (selection) {
case XA_CUT_BUFFER0:
buffer = 0;
@@ -559,21 +557,21 @@ getTextSelection(WScreen *screen, Atom selection)
int timeout = 0;
XEvent ev;
static Atom clipboard = 0;
if (!clipboard)
if (!clipboard)
clipboard = XInternAtom(dpy, "CLIPBOARD", False);
XDeleteProperty(dpy, screen->info_window, clipboard);
XConvertSelection(dpy, selection, XA_STRING,
clipboard, screen->info_window,
CurrentTime);
timer = WMAddTimerHandler(1000, timeoutHandler, &timeout);
while (!XCheckTypedWindowEvent(dpy, screen->info_window,
SelectionNotify, &ev) && !timeout);
if (!timeout) {
WMDeleteTimerHandler(timer);
} else {
@@ -607,7 +605,7 @@ static char*
getselection(WScreen *scr)
{
char *tmp;
tmp = getTextSelection(scr, XA_PRIMARY);
if (!tmp)
tmp = getTextSelection(scr, XA_CUT_BUFFER0);
@@ -623,10 +621,10 @@ getuserinput(WScreen *scr, char *line, int *ptr)
char *prompt;
int j, state;
int begin = 0;
#define BUFSIZE 512
#define BUFSIZE 512
char tbuffer[BUFSIZE], pbuffer[BUFSIZE];
title = _("Program Arguments");
prompt = _("Enter command arguments:");
ret = NULL;
@@ -716,17 +714,17 @@ get_dnd_selection(WScreen *scr)
char **list;
char *flat_string;
int count;
result=XGetTextProperty(dpy, scr->root_win, &text_ret, _XA_DND_SELECTION);
if (result==0 || text_ret.value==NULL || text_ret.encoding==None
|| text_ret.format==0 || text_ret.nitems == 0) {
wwarning(_("unable to get dropped data from DND drop"));
return NULL;
}
XTextPropertyToStringList(&text_ret, &list, &count);
if (!list || count<1) {
XFree(text_ret.value);
wwarning(_("error getting dropped data from DND drop"));
@@ -737,7 +735,7 @@ get_dnd_selection(WScreen *scr)
if (!flat_string) {
wwarning(_("out of memory while getting data from DND drop"));
}
XFreeStringList(list);
XFree(text_ret.value);
return flat_string;
@@ -749,7 +747,7 @@ get_dnd_selection(WScreen *scr)
#define S_ESCAPE 1
#define S_OPTION 2
/*
/*
* state input new-state output
* NORMAL % OPTION <nil>
* NORMAL \ ESCAPE <nil>
@@ -808,15 +806,15 @@ ExpandOptions(WScreen *scr, char *cmdline)
case 'n':
out[optr++]=10;
break;
case 'r':
out[optr++]=13;
break;
case 't':
out[optr++]=9;
break;
default:
out[optr++]=cmdline[ptr];
}
@@ -828,7 +826,7 @@ ExpandOptions(WScreen *scr, char *cmdline)
case 'w':
if (scr->focused_window
&& scr->focused_window->flags.focused) {
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
(unsigned int)scr->focused_window->client_win);
slen = strlen(tmpbuf);
olen += slen;
@@ -844,9 +842,9 @@ ExpandOptions(WScreen *scr, char *cmdline)
out[optr++]=' ';
}
break;
case 'W':
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
(unsigned int)scr->current_workspace + 1);
slen = strlen(tmpbuf);
olen += slen;
@@ -859,10 +857,10 @@ ExpandOptions(WScreen *scr, char *cmdline)
strcat(out,tmpbuf);
optr+=slen;
break;
case 'a':
ptr++;
user_input = getuserinput(scr, cmdline, &ptr);
user_input = getuserinput(scr, cmdline, &ptr);
if (user_input) {
slen = strlen(user_input);
olen += slen;
@@ -907,7 +905,7 @@ ExpandOptions(WScreen *scr, char *cmdline)
optr+=slen;
break;
#endif /* OFFIX_DND */
case 's':
if (!selection) {
selection = getselection(scr);
@@ -940,7 +938,7 @@ ExpandOptions(WScreen *scr, char *cmdline)
if (selection)
XFree(selection);
return out;
error:
wfree(out);
if (selection)
@@ -1007,21 +1005,21 @@ GetShortcutString(char *text)
/* KeySym ksym;*/
int control = 0;
char *tmp;
tmp = text = wstrdup(text);
/* get modifiers */
while ((k = strchr(text, '+'))!=NULL) {
int mod;
*k = 0;
mod = wXModifierFromKey(text);
if (mod<0) {
return wstrdup("bug");
}
modmask |= mod;
if (strcasecmp(text, "Meta")==0) {
buffer = wstrappend(buffer, "M+");
} else if (strcasecmp(text, "Alt")==0) {
@@ -1029,15 +1027,15 @@ GetShortcutString(char *text)
} else if (strcasecmp(text, "Shift")==0) {
buffer = wstrappend(buffer, "Sh+");
} else if (strcasecmp(text, "Mod1")==0) {
buffer = wstrappend(buffer, "M1+");
buffer = wstrappend(buffer, "M1+");
} else if (strcasecmp(text, "Mod2")==0) {
buffer = wstrappend(buffer, "M2+");
buffer = wstrappend(buffer, "M2+");
} else if (strcasecmp(text, "Mod3")==0) {
buffer = wstrappend(buffer, "M3+");
} else if (strcasecmp(text, "Mod4")==0) {
buffer = wstrappend(buffer, "M4+");
buffer = wstrappend(buffer, "M4+");
} else if (strcasecmp(text, "Mod5")==0) {
buffer = wstrappend(buffer, "M5+");
buffer = wstrappend(buffer, "M5+");
} else if (strcasecmp(text, "Control")==0) {
control = 1;
} else {
@@ -1050,7 +1048,7 @@ GetShortcutString(char *text)
buffer = wstrappend(buffer, "^");
}
buffer = wstrappend(buffer, text);
/* get key */
/* ksym = XStringToKeysym(text);
tmp = keysymToString(ksym, modmask);
@@ -1185,7 +1183,7 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
if (!scr->flags.backimage_helper_launched) {
return;
}
len = (msg ? strlen(msg) : 0) + (workspace >=0 ? 4 : 0) + 1 ;
buffer = wmalloc(len+5);
snprintf(buf, len, "%4i", len);
@@ -1244,22 +1242,141 @@ UpdateDomainFile(WDDomain *domain)
}
char*
StrConcatDot(char *a, char *b)
{
int len;
char *str;
if (!a)
a = "";
if (!b)
b = "";
len = strlen(a)+strlen(b)+4;
str = wmalloc(len);
snprintf(str, len, "%s.%s", a, b);
return str;
}
#ifndef NETWM_HINTS
static Atom net_wm_pid = None;
int
GetPidForWindow(Window win)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
long *data = 0;
int pid;
if (net_wm_pid == None) {
net_wm_pid = XInternAtom(dpy, "_NET_WM_PID", False);
}
if (XGetWindowProperty(dpy, win, net_wm_pid, 0, 1, False,
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret,
(unsigned char**)&data)==Success && data) {
pid = *data;
XFree(data);
} else {
pid = 0;
}
return pid;
}
#endif
Bool
GetCommandForPid(int pid, char ***argv, int *argc)
{
char buf[1024];
FILE *fPtr;
int count, i, j;
sprintf(buf, "/proc/%d/cmdline", pid);
fPtr = fopen(buf, "r");
if (fPtr) {
count = read(fileno(fPtr), buf, 1024);
if (count > 0) {
buf[count] = 0;
for (i=0, *argc=0; i<count; i++) {
if (buf[i] == 0) {
(*argc)++;
}
}
if ((*argc) == 0) {
*argv = NULL;
return False;
}
*argv = (char**) wmalloc(sizeof(char*) * (*argc));
(*argv)[0] = buf;
for (i=0, j=1; i<count; i++) {
if (buf[i] != 0)
continue;
if (i < count-1) {
(*argv)[j++] = &buf[i+1];
}
}
return True;
}
fclose(fPtr);
}
return False;
}
static char*
getCommandForWindow(Window win, int elements)
{
char **argv, *command = NULL;
int argc;
if (XGetCommand(dpy, win, &argv, &argc)) {
if (argc > 0 && argv != NULL) {
if (elements==0)
elements = argc;
command = wtokenjoin(argv, WMIN(argc, elements));
if (command[0] == 0) {
wfree(command);
command = NULL;
}
}
if (argv) {
XFreeStringList(argv);
}
}
return command;
}
/* Free result when done */
char*
GetCommandForWindow(Window win)
{
return getCommandForWindow(win, 0);
}
/* Free result when done */
char*
GetProgramNameForWindow(Window win)
{
return getCommandForWindow(win, 1);
}
+80 -32
View File
@@ -66,7 +66,7 @@
/* True if window currently has a border. This also includes borderless
* windows which are currently selected
*/
#define HAS_BORDER(w) ((w)->flags.selected || !WFLAGP((w), no_border))
#define HAS_BORDER_WITH_SELECT(w) ((w)->flags.selected || HAS_BORDER(w))
/****** Global Variables ******/
@@ -236,8 +236,7 @@ mapPositionDisplay(WWindow *wwin, int x, int y, int w, int h)
return;
} else if (wPreferences.move_display == WDIS_CENTER) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
moveGeometryDisplayCentered(scr,
rect.pos.x + rect.size.width/2,
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
rect.pos.y + rect.size.height/2);
} else if (wPreferences.move_display == WDIS_TOPLEFT) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
@@ -265,7 +264,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
* x2-1 everywhere below in the code). But why only for x? */
x1--; x2--;
if (HAS_BORDER(wwin)) {
if (HAS_BORDER_WITH_SELECT(wwin)) {
x1 += FRAME_BORDER_WIDTH;
x2 += FRAME_BORDER_WIDTH;
y1 += FRAME_BORDER_WIDTH;
@@ -407,8 +406,7 @@ cycleGeometryDisplay(WWindow *wwin, int x, int y, int w, int h, int dir)
} else {
if (wPreferences.size_display == WDIS_CENTER) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
moveGeometryDisplayCentered(scr,
rect.pos.x + rect.size.width/2,
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
rect.pos.y + rect.size.height/2);
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
@@ -434,8 +432,7 @@ mapGeometryDisplay(WWindow *wwin, int x, int y, int w, int h)
if (wPreferences.size_display == WDIS_CENTER) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
moveGeometryDisplayCentered(scr,
rect.pos.x + rect.size.width/2,
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
rect.pos.y + rect.size.height/2);
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
@@ -497,15 +494,15 @@ drawTransparentFrame(WWindow *wwin, int x, int y, int width, int height)
int h = 0;
int bottom = 0;
if (HAS_BORDER(wwin)) {
if (HAS_BORDER_WITH_SELECT(wwin)) {
x += FRAME_BORDER_WIDTH;
y += FRAME_BORDER_WIDTH;
}
if (!WFLAGP(wwin, no_titlebar) && !wwin->flags.shaded) {
if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) {
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
}
if (!WFLAGP(wwin, no_resizebar) && !wwin->flags.shaded) {
if (HAS_RESIZEBAR(wwin) && !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;
@@ -640,9 +637,9 @@ typedef struct {
#define WTOP(w) (w)->frame_y
#define WLEFT(w) (w)->frame_x
#define WRIGHT(w) ((w)->frame_x + (int)(w)->frame->core->width - 1 + \
(HAS_BORDER(w) ? 2*FRAME_BORDER_WIDTH : 0))
(HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0))
#define WBOTTOM(w) ((w)->frame_y + (int)(w)->frame->core->height - 1 + \
(HAS_BORDER(w) ? 2*FRAME_BORDER_WIDTH : 0))
(HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0))
static int
compareWTop(const void *a, const void *b)
@@ -900,9 +897,9 @@ initMoveData(WWindow *wwin, MoveData *data)
data->calcY = wwin->frame_y;
data->winWidth = wwin->frame->core->width +
(HAS_BORDER(wwin) ? 2*FRAME_BORDER_WIDTH : 0);
(HAS_BORDER_WITH_SELECT(wwin) ? 2*FRAME_BORDER_WIDTH : 0);
data->winHeight = wwin->frame->core->height +
(HAS_BORDER(wwin) ? 2*FRAME_BORDER_WIDTH : 0);
(HAS_BORDER_WITH_SELECT(wwin) ? 2*FRAME_BORDER_WIDTH : 0);
}
@@ -1293,6 +1290,9 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
#define _KS KEY_CONTROL_WINDOW_WEIGHT
#define MOVABLE_BIT 0x01
#define RESIZABLE_BIT 0x02
int
wKeyboardMoveResizeWindow(WWindow *wwin)
{
@@ -1309,15 +1309,24 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
int done,off_x,off_y,ww,wh;
int kspeed = _KS;
Time lastTime = 0;
KeyCode shiftl, shiftr, ctrll, ctrlmode;
KeySym keysym=NoSymbol;
int moment=0;
KeyCode shiftl,shiftr,ctrll,ctrlmode;
int modes = ((IS_MOVABLE(wwin) ? MOVABLE_BIT : 0) |
(IS_RESIZABLE(wwin) ? RESIZABLE_BIT : 0));
int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr)>1)
? wGetHeadForWindow(wwin)
: scr->xine_info.primary_head);
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;
if (modes == RESIZABLE_BIT) {
ctrlmode = 1;
}
XSync(dpy, False);
wusleep(10000);
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
@@ -1383,14 +1392,15 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
}
if (kspeed < _KS) kspeed = _KS;
lastTime = event.xkey.time;
if (event.xkey.state & ControlMask && !wwin->flags.shaded) {
ctrlmode=1;
wUnselectWindows(scr);
}
else {
ctrlmode=0;
}
if (modes == (MOVABLE_BIT|RESIZABLE_BIT)) {
if ((event.xkey.state & ControlMask) && !wwin->flags.shaded) {
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);
@@ -1544,7 +1554,7 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
} else if(!scr->selected_windows)
showPosition(wwin, src_x+off_x, src_y+off_y);
/**/
if (done) {
scr->keymove_tick=0;
@@ -1599,6 +1609,17 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
wWindowChangeWorkspace(wwin, scr->current_workspace);
wSetFocusTo(scr, wwin);
}
if (wPreferences.auto_arrange_icons && wXineramaHeads(scr)>1 &&
head != wGetHeadForWindow(wwin)) {
wArrangeIcons(scr, True);
}
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
wWorkspaceResizeViewPort(scr, scr->current_workspace);
#endif
return 1;
}
}
@@ -1638,12 +1659,15 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
/* This needs not to change while moving, else bad things can happen */
int opaqueMove = wPreferences.opaque_move;
MoveData moveData;
int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1)
? wGetHeadForWindow(wwin)
: scr->xine_info.primary_head);
#ifdef GHOST_WINDOW_MOVE
RImage *rimg;
rimg = InitGhostWindowMove(scr);
RImage *rimg = InitGhostWindowMove(scr);
#endif
if (!IS_MOVABLE(wwin))
return False;
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
XSetWindowAttributes attr;
@@ -1873,7 +1897,6 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
XSetWindowAttributes attr;
attr.save_under = False;
XChangeWindowAttributes(dpy, wwin->frame->core->window,
CWSaveUnder, &attr);
@@ -1882,6 +1905,16 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
freeMoveData(&moveData);
if (started && wPreferences.auto_arrange_icons && wXineramaHeads(scr)>1 &&
head != wGetHeadForWindow(wwin)) {
wArrangeIcons(scr, True);
}
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
if (started)
wWorkspaceResizeViewPort(scr, scr->current_workspace);
#endif
return started;
}
@@ -1964,6 +1997,12 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
int orig_fy = fy;
int orig_fw = fw;
int orig_fh = fh;
int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr)>1)
? wGetHeadForWindow(wwin)
: scr->xine_info.primary_head);
if (!IS_RESIZABLE(wwin))
return;
if (wwin->flags.shaded) {
wwarning("internal error: tryein");
@@ -1984,7 +2023,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
ry2 = fy + fh - 1;
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
if (!WFLAGP(wwin, no_titlebar))
if (HAS_TITLEBAR(wwin))
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
else
h = 0;
@@ -2165,6 +2204,15 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
WMHandleEvent(&event);
}
}
if (wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1 &&
head != wGetHeadForWindow(wwin)) {
wArrangeIcons(scr, True);
}
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
wWorkspaceResizeViewPort(scr, scr->current_workspace);
#endif
}
#undef LEFT
@@ -2316,11 +2364,11 @@ InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
*y_ret = 0;
return;
}
if (!WFLAGP(wwin, no_titlebar)) {
if (HAS_TITLEBAR(wwin)) {
h = WMFontHeight(scr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
height += h;
}
if (!WFLAGP(wwin, no_resizebar)) {
if (HAS_RESIZEBAR(wwin)) {
height += RESIZEBAR_HEIGHT;
}
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+43 -34
View File
@@ -349,33 +349,32 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height,
WArea usableArea)
{
WScreen *scr = wwin->screen_ptr;
//WScreen *scr = wwin->screen_ptr;
int test_x = 0, test_y = Y_ORIGIN(scr);
int from_x, to_x, from_y, to_y;
int sx;
int min_isect, min_isect_x, min_isect_y;
int sum_isect;
int extra_height;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
else
extra_height = 24; /* random value */
if (wwin->frame) {
height += wwin->frame->top_width + wwin->frame->bottom_width;
} else {
if (HAS_TITLEBAR(wwin)) height += 18;
if (HAS_RESIZEBAR(wwin)) height += 8;
}
if (HAS_BORDER(wwin)) {
height += 2;
width += 2;
}
sx = X_ORIGIN(scr);
min_isect = INT_MAX;
min_isect_x = sx;
min_isect_y = test_y;
height += extra_height;
while (((test_y + height) < usableArea.y2)) {
test_x = sx;
while ((test_x + width) < usableArea.x2) {
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
width, height);
@@ -430,21 +429,23 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
int loc_ok = False, tw,tx,ty,th;
int swidth, sx;
WWindow *test_window;
int extra_height;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
else
extra_height = 24; /* random value */
if (wwin->frame) {
height += wwin->frame->top_width + wwin->frame->bottom_width;
} else {
if (HAS_TITLEBAR(wwin)) height += 18;
if (HAS_RESIZEBAR(wwin)) height += 8;
}
if (HAS_BORDER(wwin)) {
height += 2;
width += 2;
}
swidth = usableArea.x2-usableArea.x1;
sx = X_ORIGIN(scr);
/* this was based on fvwm2's smart placement */
height += extra_height;
while (((test_y + height) < (usableArea.y2 - usableArea.y1)) && !loc_ok) {
test_x = sx;
@@ -539,17 +540,19 @@ cascadeWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, int h,
WArea usableArea)
{
unsigned int extra_height;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
else
extra_height = 24; /* random value */
if (wwin->frame) {
height += wwin->frame->top_width + wwin->frame->bottom_width;
} else {
if (HAS_TITLEBAR(wwin)) height += 18;
if (HAS_RESIZEBAR(wwin)) height += 8;
}
if (HAS_BORDER(wwin)) {
height += 2;
width += 2;
}
*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 > usableArea.x2 || height + *y_ret > usableArea.y2) {
scr->cascade_index = 0;
@@ -564,15 +567,21 @@ randomPlaceWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height,
WArea usableArea)
{
int w, h, extra_height;
int w, h;
if (wwin->frame)
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
else
extra_height = 24; /* random value */
if (wwin->frame) {
height += wwin->frame->top_width + wwin->frame->bottom_width;
} else {
if (HAS_TITLEBAR(wwin)) height += 18;
if (HAS_RESIZEBAR(wwin)) height += 8;
}
if (HAS_BORDER(wwin)) {
height += 2;
width += 2;
}
w = ((usableArea.x2-X_ORIGIN(scr)) - width);
h = ((usableArea.y2-Y_ORIGIN(scr)) - height - extra_height);
h = ((usableArea.y2-Y_ORIGIN(scr)) - height);
if (w<1) w = 1;
if (h<1) h = 1;
*x_ret = X_ORIGIN(scr) + rand()%w;
+38 -14
View File
@@ -62,6 +62,9 @@
#ifdef OLWM_HINTS
# include "openlook.h"
#endif
#ifdef NETWM_HINTS
# include "wmspec.h"
#endif
#include "xinerama.h"
@@ -787,6 +790,10 @@ wScreenInit(int screen_number)
wOLWMInitStuff(scr);
#endif
#ifdef NETWM_HINTS
wNETWMInitStuff(scr);
#endif
/* create initial workspace */
wWorkspaceNew(scr);
@@ -1014,10 +1021,21 @@ wScreenUpdateUsableArea(WScreen *scr)
}
}
#ifdef NETWM_HINTS
{
WArea area;
if (wNETWMGetUsableArea(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 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);
@@ -1094,6 +1112,10 @@ wScreenUpdateUsableArea(WScreen *scr)
#endif
#endif
#ifdef NETWM_HINTS
wNETWMUpdateWorkarea(scr);
#endif
{
unsigned size = wPreferences.workspace_border_size;
unsigned position = wPreferences.workspace_border_position;
@@ -1146,7 +1168,16 @@ wScreenRestoreState(WScreen *scr)
wfree(path);
}
if (!wPreferences.flags.noclip && scr->session_state) {
if (!scr->session_state) {
scr->session_state = WMCreatePLDictionary(NULL, NULL);
}
if (!wPreferences.flags.nodock) {
state = WMGetFromPLDictionary(scr->session_state, dDock);
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
}
if (!wPreferences.flags.noclip) {
state = WMGetFromPLDictionary(scr->session_state, dClip);
scr->clip_icon = wClipRestoreState(scr, state);
}
@@ -1154,17 +1185,10 @@ wScreenRestoreState(WScreen *scr)
wWorkspaceRestoreState(scr);
#ifdef VIRTUAL_DESKTOP
/*
* * create inputonly windows at the border of screen
* */
wWorkspaceManageEdge(scr);
/* create inputonly windows at the border of screen */
wWorkspaceManageEdge(scr);
#endif
if (!wPreferences.flags.nodock && scr->session_state) {
state = WMGetFromPLDictionary(scr->session_state, dDock);
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
}
wScreenUpdateUsableArea(scr);
}
@@ -1201,7 +1225,7 @@ wScreenSaveState(WScreen *scr)
old_state = scr->session_state;
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
scr->session_state = WMCreatePLDictionary(NULL, NULL);
WMPLSetCaseSensitive(True);
@@ -1239,9 +1263,9 @@ wScreenSaveState(WScreen *scr)
wMenuSaveState(scr);
if (wScreenCount == 1)
if (wScreenCount == 1) {
str = wdefaultspathfordomain("WMState");
else {
} else {
char buf[16];
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
str = wdefaultspathfordomain(buf);
+3 -4
View File
@@ -77,10 +77,8 @@ typedef struct _WScreen {
int scr_height;
#ifdef VIRTUAL_DESKTOP
Window virtual_edge_u;
Window virtual_edge_d;
Window virtual_edge_l;
Window virtual_edge_r;
int virtual_nr_edges;
Window * virtual_edges;
#endif
Window root_win; /* root window of screen */
@@ -328,6 +326,7 @@ typedef struct _WScreen {
unsigned int colormap_stuff_blocked:1;
unsigned int doing_alt_tab:1;
unsigned int jump_back_pending:1;
unsigned int ignore_focus_events:1;
#ifdef KWM_HINTS
unsigned int kwm_syncing_name:1;
unsigned int kwm_syncing_count:1;
+13 -18
View File
@@ -211,8 +211,6 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
{
WScreen *scr = wwin->screen_ptr;
Window win;
int argc;
char **argv;
int i;
unsigned mask;
char *class, *instance, *command=NULL, buffer[512];
@@ -225,10 +223,7 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
else
win = wwin->client_win;
if (XGetCommand(dpy, win, &argv, &argc) && argc>0) {
command = wtokenjoin(argv, argc);
XFreeStringList(argv);
}
command = GetCommandForWindow(win);
if (!command)
return NULL;
@@ -266,14 +261,14 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
shortcut = WMCreatePLString(buffer);
win_state = WMCreatePLDictionary(sName, name,
sCommand, cmd,
sWorkspace, workspace,
sShaded, shaded,
sMiniaturized, miniaturized,
sHidden, hidden,
sShortcutMask, shortcut,
sGeometry, geometry,
NULL);
sCommand, cmd,
sWorkspace, workspace,
sShaded, shaded,
sMiniaturized, miniaturized,
sHidden, hidden,
sShortcutMask, shortcut,
sGeometry, geometry,
NULL);
WMReleasePropList(name);
WMReleasePropList(cmd);
@@ -321,7 +316,7 @@ wSessionSaveState(WScreen *scr)
make_keys();
if (!scr->session_state) {
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
scr->session_state = WMCreatePLDictionary(NULL, NULL);
if (!scr->session_state)
return;
}
@@ -1072,9 +1067,9 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
}
plState = WMCreatePLDictionary(WMCreatePLString("Version"),
WMCreatePLString("1.0"),
WMCreatePLString("Screens"),
state, NULL);
WMCreatePLString("1.0"),
WMCreatePLString("Screens"),
state, NULL);
WMWritePropListToFile(plState, statefile, False);
+12
View File
@@ -35,6 +35,7 @@
#include "actions.h"
#include "properties.h"
#include "stacking.h"
#include "workspace.h"
/*** Global Variables ***/
@@ -152,6 +153,9 @@ CommitStacking(WScreen *scr)
XRestackWindows(dpy, windows, i);
wfree(windows);
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
WMPostNotificationName(WMNResetStacking, scr, NULL);
}
@@ -376,6 +380,10 @@ wLowerFrame(WCoreWindow *frame)
}
notifyStackChange(frame, "lower");
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
}
@@ -510,6 +518,10 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
}
WMPostNotificationName(WMNResetStacking, scr, NULL);
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
}
+14 -1
View File
@@ -111,6 +111,7 @@ extern int wXkbEventBase;
extern XContext wWinContext;
extern XContext wAppWinContext;
extern XContext wStackContext;
extern XContext wVEdgeContext;
/* atoms */
extern Atom _XA_WM_STATE;
@@ -756,6 +757,7 @@ StartUp(Bool defaultScreenOnly)
wWinContext = XUniqueContext();
wAppWinContext = XUniqueContext();
wStackContext = XUniqueContext();
wVEdgeContext = XUniqueContext();
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False);*/
@@ -820,6 +822,17 @@ StartUp(Bool defaultScreenOnly)
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name???*/
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
{
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
GC gc = XCreateGC(dpy, cur, 0, NULL);
XColor black;
memset(&black, 0, sizeof(XColor));
XSetForeground(dpy, gc, 0);
XFillRectangle(dpy, cur, gc, 0, 0, 16, 16);
XFreeGC(dpy, gc);
wCursor[WCUR_EMPTY] = XCreatePixmapCursor(dpy, cur, cur, &black, &black, 0, 0);
XFreePixmap(dpy, cur);
}
/* signal handler stuff that gets called when a signal is caught */
WMAddPersistentTimerHandler(500, delayedAction, NULL);
@@ -1119,7 +1132,7 @@ manageAllWindows(WScreen *scr, int crashRecovery)
if (crashRecovery) {
int border;
border = (WFLAGP(wwin, no_border) ? 0 : FRAME_BORDER_WIDTH);
border = (!HAS_BORDER(wwin) ? 0 : FRAME_BORDER_WIDTH);
wWindowMove(wwin, wwin->frame_x - border,
wwin->frame_y - border -
+10 -9
View File
@@ -28,6 +28,7 @@
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "WindowMaker.h"
@@ -42,14 +43,14 @@
#endif
#if 0
#ifdef DEBUG
# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X);
# define LEAVE(X) fprintf(stderr,"Leaving: %s()\n", X);
# define DEBUG(X) fprintf(stderr,"debug: %s()\n", X);
# define PDEBUG(X) fprintf(stderr,"debug: %s()\n", X);
#else
# define ENTER(X)
# define LEAVE(X)
# define DEBUG(X)
# define PDEBUG(X)
#endif
extern Cursor wCursor[WCUR_LAST];
@@ -582,32 +583,32 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
* text so we can wTextRefresh() */
if( event->xmotion.state & (Button1Mask|Button3Mask|Button2Mask) )
{
DEBUG("MotionNotify");
PDEBUG("MotionNotify");
handled = True;
wtext->text.endPos = textXtoPos( wtext, event->xmotion.x );
}
break;
case ButtonPress:
DEBUG("ButtonPress");
PDEBUG("ButtonPress");
handled = True;
wtext->text.startPos = textXtoPos( wtext, event->xbutton.x );
wtext->text.endPos = wtext->text.startPos;
break;
case ButtonRelease:
DEBUG("ButtonRelease");
PDEBUG("ButtonRelease");
handled = True;
wtext->text.endPos = textXtoPos( wtext, event->xbutton.x );
break;
case KeyPress:
DEBUG("KeyPress");
PDEBUG("KeyPress");
handled = handleKeyPress( wtext, &event->xkey );
break;
case EnterNotify:
DEBUG("EnterNotify");
PDEBUG("EnterNotify");
handled = True;
#if 0
if (!wtext->magic)
@@ -621,7 +622,7 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
break;
case LeaveNotify:
DEBUG("LeaveNotify");
PDEBUG("LeaveNotify");
handled = True;
#if 0
wtext->blinking = 0;
+1 -1
View File
@@ -500,7 +500,7 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
int same = 0;
if (!dict) {
dict = WMCreatePLDictionary(NULL, NULL, NULL);
dict = WMCreatePLDictionary(NULL, NULL);
if (dict) {
db->dictionary = dict;
} else {
+323 -223
View File
File diff suppressed because it is too large Load Diff
+31 -3
View File
@@ -95,6 +95,7 @@ typedef struct {
#ifdef XKB_BUTTON_HINT
unsigned int no_language_button:1;
#endif
unsigned int no_movable:1;
/* decorations */
unsigned int no_resizebar:1; /* draw the bottom handle? */
@@ -135,6 +136,10 @@ typedef struct {
unsigned int full_maximize:1;
#ifdef VIRTUAL_DESKTOP
unsigned int virtual_stick:1;
#endif
/*
* emulate_app_icon must be automatically disabled for apps that can
* generate their own appicons and for apps that have no_appicon=1
@@ -201,6 +206,11 @@ typedef struct WWindow {
unsigned int width, height; /* original geometry of the window */
} old_geometry; /* (before things like maximize) */
struct {
int x, y;
unsigned int width, height; /* original geometry of the window */
} bfs_geometry; /* (before fullscreen) */
/* client window info */
short old_border_width; /* original border width of client_win*/
Window client_win; /* the window we're managing */
@@ -257,6 +267,7 @@ typedef struct WWindow {
unsigned int hidden:1;
unsigned int shaded:1;
unsigned int maximized:2;
unsigned int fullscreen:1;
unsigned int omnipresent:1;
unsigned int semi_focused:1;
@@ -307,19 +318,36 @@ typedef struct WWindow {
unsigned int olwm_push_pin_out:1;/* emulate pushpin behaviour */
unsigned int olwm_limit_menu:1;
#endif
#ifdef NET_HINTS
#ifdef NETWM_HINTS
unsigned int net_state_from_client:1; /* state hint was set by client */
unsigned int net_skip_taskbar:1;
unsigned int net_skip_pager:1;
unsigned int net_handle_icon:1;
unsigned int net_show_desktop:1;
#endif
} flags; /* state of the window */
struct WIcon *icon; /* icon info for the window */
int icon_x, icon_y; /* position of the icon */
#ifdef NETWM_HINTS
int icon_w, icon_h;
RImage *net_icon_image;
Atom type;
#endif
} WWindow;
#define IS_OMNIPRESENT(w) ((w)->flags.omnipresent ^ WFLAGP(w, omnipresent))
#define HAS_TITLEBAR(w) (!(WFLAGP((w), no_titlebar) || (w)->flags.fullscreen))
#define HAS_RESIZEBAR(w) (!(WFLAGP((w), no_resizebar) || (w)->flags.fullscreen))
#define HAS_BORDER(w) (!(WFLAGP((w), no_border) || (w)->flags.fullscreen))
#define IS_MOVABLE(w) (!(WFLAGP((w), no_movable) || (w)->flags.fullscreen))
#define IS_RESIZABLE(w) (!(WFLAGP((w), no_resizable) || (w)->flags.fullscreen))
#ifdef VIRTUAL_DESKTOP
# define IS_VSTUCK(w) (WFLAGP((w), virtual_stick) || (w)->flags.fullscreen)
#endif
/* XXX: CHECK THIS,.. IT SEEMED WEIRD TO ME!!! */
#define IS_OMNIPRESENT(w) ((w)->flags.omnipresent | WFLAGP(w, omnipresent))
#define WINDOW_LEVEL(w) ((w)->frame->core->stacking->window_level)
+2 -2
View File
@@ -586,10 +586,10 @@ updateMenuForWindow(WMenu *menu, WWindow *wwin)
menu->entries[MC_MAXIMIZE]->text = text;
}
wMenuSetEnabled(menu, MC_MAXIMIZE, !WFLAGP(wwin, no_resizable));
wMenuSetEnabled(menu, MC_MAXIMIZE, IS_RESIZABLE(wwin));
wMenuSetEnabled(menu, MC_MOVERESIZE, !WFLAGP(wwin, no_resizable)
wMenuSetEnabled(menu, MC_MOVERESIZE, IS_RESIZABLE(wwin)
&& !wwin->flags.miniaturized);
if (wwin->flags.shaded) {
+11 -3
View File
@@ -47,6 +47,11 @@
#include "dock.h"
#include "client.h"
#ifdef NETWM_HINTS
#include "wmspec.h"
#endif
#include "xinerama.h"
#include <WINGs/WUtil.h>
@@ -540,7 +545,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
return;
if (!dict) {
dict = WMCreatePLDictionary(NULL, NULL, NULL);
dict = WMCreatePLDictionary(NULL, NULL);
if (dict) {
db->dictionary = dict;
} else {
@@ -555,8 +560,8 @@ saveSettings(WMButton *button, InspectorPanel *panel)
WMPLSetCaseSensitive(True);
winDic = WMCreatePLDictionary(NULL, NULL, NULL);
appDic = WMCreatePLDictionary(NULL, NULL, NULL);
winDic = WMCreatePLDictionary(NULL, NULL);
appDic = WMCreatePLDictionary(NULL, NULL);
/* Update icon for window */
icon_file = WMGetTextFieldText(panel->fileText);
@@ -875,6 +880,9 @@ applySettings(WMButton *button, InspectorPanel *panel)
wwin->frame->flags.need_texture_change = 1;
wWindowConfigureBorders(wwin);
wFrameWindowPaint(wwin->frame);
#ifdef NETWM_HINTS
wNETWMUpdateActions(wwin, False);
#endif
/*
* Can't apply emulate_appicon because it will probably cause problems.
+1371 -242
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -25,6 +25,21 @@
#ifndef _WMSPEC_H_
#define _WMSPEC_H_
#include <screen.h>
#include <window.h>
#include <X11/Xlib.h>
void wNETWMInitStuff(WScreen *scr);
void wNETWMUpdateWorkarea(WScreen *scr, WArea usableArea);
Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area);
Bool wNETWMCheckInitialClientState(WWindow *wwin);
Bool wNETWMProcessClientMessage(XClientMessageEvent *event);
Bool wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
void wNETWMShowingDesktop(WScreen *scr, Bool show);
void wNETWMUpdateActions(WWindow *wwin, Bool del);
void wNETWMUpdateDesktop(WScreen *scr);
void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int height);
int wNETWMGetPidForWindow(Window window);
#endif
+591 -151
View File
File diff suppressed because it is too large Load Diff
+10 -1
View File
@@ -41,12 +41,21 @@ void wWorkspaceChange(WScreen *scr, int workspace);
void wWorkspaceForceChange(WScreen *scr, int workspace);
#ifdef VIRTUAL_DESKTOP
void wWorkspaceManageEdge(WScreen *scr);
void wWorkspaceUpdateEdge(WScreen *scr);
void wWorkspaceDestroyEdge(WScreen *scr);
void wWorkspaceRaiseEdge(WScreen *scr);
void wWorkspaceLowerEdge(WScreen *scr);
void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height);
void wWorkspaceResizeViewPort(WScreen *scr, int workspace);
void wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction);
Bool wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y);
Bool wWorkspaceAdjustViewPort(WScreen *scr, int workspace, int view_x, int view_y);
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y);
#define VEC_LEFT wmkpoint(-1,0)
#define VEC_RIGHT wmkpoint(1,0)
#define VEC_UP wmkpoint(0,-1)
#define VEC_DOWN wmkpoint(0,1)
#endif
+1 -1
View File
@@ -86,7 +86,7 @@ void wXDNDMakeAwareness(Window window) {
}
void wXDNDClearAwareness(Window window) {
long int xdnd_version = 3;
//long int xdnd_version = 3;
XDeleteProperty (dpy, window, _XA_XdndAware);
}
+1
View File
@@ -24,6 +24,7 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <string.h>
#include "wconfig.h"
+1
View File
@@ -9,6 +9,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
+5 -2
View File
@@ -3,9 +3,10 @@ AUTOMAKE_OPTIONS = no-dependencies
pkgdatadir = $(datadir)/@PACKAGE@
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle seticons geticonset wmsetbg wmsetup wmagnify
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle convertfonts \
seticons geticonset wmsetbg wmsetup wmagnify
bin_SCRIPTS = wmaker.inst wm-oldmenu2new wsetfont wmchlocale wkdemenu.pl\
bin_SCRIPTS = wmaker.inst wm-oldmenu2new wsetfont wmchlocale wkdemenu.pl \
wcopy wpaste
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wsetfont directjpeg.c \
@@ -31,6 +32,8 @@ setstyle_LDADD = \
$(top_builddir)/WINGs/libWUtil.a \
@XLFLAGS@ @XLIBS@ $(liblist)
convertfonts_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
+317
View File
@@ -0,0 +1,317 @@
/* convertfonts.c - converts fonts in a style file to fontconfig format
*
* WindowMaker window manager
*
* Copyright (c) 2004 Dan Pascu
*
* 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.
*/
#define PROG_VERSION "convertfonts (Window Maker) 1.0"
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <string.h>
#include <WINGs/WUtil.h>
#include "../src/wconfig.h"
#define DEFAULT_FONT "sans-serif:pixelsize=12"
char *FontOptions[] = {
"IconTitleFont",
"ClipTitleFont",
"DisplayFont",
"LargeDisplayFont",
"MenuTextFont",
"MenuTitleFont",
"WindowTitleFont",
"SystemFont",
"BoldSystemFont",
NULL
};
char *ProgName;
static int
countChar(char *str, char c)
{
int count = 0;
if (!str)
return 0;
for (; *str!=0; str++) {
if (*str == c) {
count++;
}
}
return count;
}
typedef struct str {
char *str;
int len;
} str;
#define XLFD_TOKENS 14
static str*
getXLFDTokens(char *xlfd)
{
static str tokens[XLFD_TOKENS];
int i, len, size;
char *ptr;
if (!xlfd || *xlfd!='-' || countChar(xlfd, '-')<XLFD_TOKENS)
return NULL;
memset(tokens, 0, sizeof(str)*XLFD_TOKENS);
len = strlen(xlfd);
for (ptr=xlfd, i=0; i<XLFD_TOKENS && len>0; i++) {
/* skip one '-' */
ptr++;
len--;
if (len <= 0)
break;
size = strcspn(ptr, "-");
tokens[i].str = ptr;
tokens[i].len = size;
ptr += size;
len -= size;
}
return tokens;
}
static int
strToInt(str *token)
{
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
if (c<0 || c>9)
break;
res = res*10 + c;
}
}
return res;
}
static char*
mapSlantToName(str *slant)
{
if (slant->len==0 || slant->str[0]=='*')
return "roman";
switch(slant->str[0]) {
case 'i':
return "italic";
case 'o':
return "oblique";
case 'r':
default:
return "roman";
}
}
char*
xlfdToFc(char *xlfd, char *useFamily, Bool keepXLFD)
{
str *tokens, *family, *weight, *slant;
char *name, buf[512];
int size, pixelsize;
tokens = getXLFDTokens(xlfd);
if (!tokens)
return wstrdup(DEFAULT_FONT);
family = &(tokens[1]);
weight = &(tokens[2]);
slant = &(tokens[3]);
if (useFamily) {
name = wstrdup(useFamily);
} else {
if (family->len==0 || family->str[0]=='*')
return wstrdup(DEFAULT_FONT);
sprintf(buf, "%.*s", family->len, family->str);
name = wstrdup(buf);
}
pixelsize = strToInt(&tokens[6]);
size = strToInt(&tokens[7]);
if (size<=0 && pixelsize<=0) {
name = wstrappend(name, ":pixelsize=12");
} else if (pixelsize>0) {
/* if pixelsize is present size will be ignored so we skip it */
sprintf(buf, ":pixelsize=%d", pixelsize);
name = wstrappend(name, buf);
} else {
sprintf(buf, "-%d", size/10);
name = wstrappend(name, buf);
}
if (weight->len>0 && weight->str[0]!='*') {
sprintf(buf, ":weight=%.*s", weight->len, weight->str);
name = wstrappend(name, buf);
}
if (slant->len>0 && slant->str[0]!='*') {
sprintf(buf, ":slant=%s", mapSlantToName(slant));
name = wstrappend(name, buf);
}
if (keepXLFD) {
name = wstrappend(name, ":xlfd=");
name = wstrappend(name, xlfd);
}
return name;
}
/* return converted font (if conversion is needed) else the original font */
static char*
convertFont(char *font, Bool keepXLFD)
{
if (font[0]=='-') {
if (!strchr(font, ',')) {
return xlfdToFc(font, NULL, keepXLFD);
} else {
return xlfdToFc(font, "sans-serif", keepXLFD);
}
} else {
return font;
}
}
void
print_help()
{
printf("\nUsage: %s <style_file>\n\n", ProgName);
puts("Converts fonts in a style file into fontconfig format");
puts("");
puts(" --help display this help and exit");
puts(" --version output version information and exit");
puts(" --keep-xlfd preserve the original xlfd by appending a ':xlfd=<xlfd>' hint");
puts(" to the font name. This property is not used by the fontconfig");
puts(" matching engine to find the font, but it is useful as a hint");
puts(" about what the original font was to allow hand tuning the");
puts(" result or restoring the xlfd. The default is to not add it");
puts(" as it results in long, unreadable and confusing names.");
puts(" --sets-too try to approximate fontsets by using their first complete xlfd.");
puts(" This only works for singlebyte languages. The default is to");
puts(" replace the fontset with the default: 'sans-serif:pixelsize=12'");
puts(" which should display properly for any language.");
puts("");
}
// replace --sets-too with something better
int
main(int argc, char **argv)
{
WMPropList *style, *key, *val;
char *file = NULL, *oldfont, *newfont;
struct stat statbuf;
Bool keepXLFD = False;
int i;
ProgName = argv[0];
if (argc<2) {
print_help();
exit(0);
}
for (i=1; i < argc; i++) {
if (strcmp("--version", argv[i])==0) {
puts(PROG_VERSION);
exit(0);
} else if (strcmp("--help", argv[i])==0) {
print_help();
exit(0);
} else if (strcmp("--keep-xlfd", argv[i])==0) {
keepXLFD = True;;
} else if (argv[i][0]=='-') {
printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
printf("Try '%s --help' for more information\n", ProgName);
exit(1);
} else {
file = argv[i];
}
}
WMPLSetCaseSensitive(False);
if (stat(file, &statbuf) < 0) {
perror(file);
exit(1);
}
style = WMReadPropListFromFile(file);
if (!style) {
perror(file);
printf("%s: could not load style file.\n", ProgName);
exit(1);
}
if (!WMIsPLDictionary(style)) {
printf("%s: '%s' is not a well formatted style file\n", ProgName, file);
exit(1);
}
for (i=0; FontOptions[i]!=NULL; i++) {
key = WMCreatePLString(FontOptions[i]);
val = WMGetFromPLDictionary(style, key);
if (val) {
oldfont = WMGetFromPLString(val);
newfont = convertFont(oldfont, keepXLFD);
if (oldfont != newfont) {
val = WMCreatePLString(newfont);
WMPutInPLDictionary(style, key, val);
WMReleasePropList(val);
wfree(newfont);
}
}
WMReleasePropList(key);
}
WMWritePropListToFile(style, file, True);
exit(0);
}
+2 -5
View File
@@ -106,7 +106,7 @@ main(int argc, char **argv)
exit(1);
}
iconset = WMCreatePLDictionary(NULL, NULL, NULL);
iconset = WMCreatePLDictionary(NULL, NULL);
keylist = WMGetPLDictionaryKeys(all_windows);
icon_key = WMCreatePLString("Icon");
@@ -122,10 +122,7 @@ main(int argc, char **argv)
if (window_attrs && WMIsPLDictionary(window_attrs)) {
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
if (icon_value) {
icondic = WMCreatePLDictionary(icon_key, icon_value,
NULL);
icondic = WMCreatePLDictionary(icon_key, icon_value, NULL);
WMPutInPLDictionary(iconset, window_name, icondic);
}
}
+4 -4
View File
@@ -467,7 +467,7 @@ strToInt(str *token)
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
@@ -589,7 +589,7 @@ findCopyFile(char *dir, char *file)
if (!fullPath) {
char buffer[4000];
sprintf(buffer, "coould not find file %s", file);
sprintf(buffer, "could not find file %s", file);
abortar(buffer);
}
copyFile(dir, fullPath);
@@ -763,7 +763,7 @@ main(int argc, char **argv)
prop = val;
}
style = WMCreatePLDictionary(NULL, NULL, NULL);
style = WMCreatePLDictionary(NULL, NULL);
for (i=0; options[i]!=NULL; i++) {
key = WMCreatePLString(options[i]);
@@ -776,7 +776,7 @@ main(int argc, char **argv)
oldfont = WMGetFromPLString(val);
newfont = convertFont(oldfont);
/* font is a reference to old if conversion is not needed */
/* newfont is a reference to old if conversion is not needed */
if (newfont != oldfont) {
WMReleasePropList(val);
val = WMCreatePLString(newfont);
+1
View File
@@ -10,6 +10,7 @@
#include <WINGs/WINGs.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
/*
+1 -1
View File
@@ -495,7 +495,7 @@ parseTexture(RContext *rc, char *text)
XColor color;
Pixmap pixmap = None;
RImage *image = NULL;
int w, h;
//int w, h;
int iwidth, iheight;
RColor rcolor;
+1
View File
@@ -21,6 +21,7 @@
#include <X11/Xlib.h>
#include <stdlib.h>
#include <string.h>
#include "WMaker.h"
#include "app.h"
+2 -1
View File
@@ -678,7 +678,8 @@ image2StandardPseudoColor(RContext *ctx, RImage *image)
int x1, ofs;
#ifdef DEBUG
printf("pseudo color dithering with %d colors per channel\n", cpc);
printf("pseudo color dithering with %d colors per channel\n",
ctx->attribs->colors_per_channel);
#endif
err = (short*)malloc(3*(image->width+2)*sizeof(short));
nerr = (short*)malloc(3*(image->width+2)*sizeof(short));
+1 -1
View File
@@ -279,7 +279,7 @@ clipLineInRectangle(int xmin, int ymin, int xmax, int ymax,
} else if (ocode & RIG) {
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
x = xmax;
} else if (ocode & LEF) {
} else { //if (ocode & LEF) {
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
x = xmin;
}
+482 -420
View File
File diff suppressed because it is too large Load Diff