mirror of
https://github.com/gryf/wmaker.git
synced 2026-04-26 02: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:
@@ -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:
|
||||
|
||||
@@ -61,4 +61,3 @@ sample implementation (twm?) it might be supported. Maybe dtwm supports
|
||||
it? I dont know...
|
||||
|
||||
|
||||
|
||||
|
||||
+4
-3
@@ -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:
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
|
||||
@@ -22,18 +22,13 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define DOUBLE_BUFFER
|
||||
|
||||
|
||||
#define DOUBLE_BUFFER 1
|
||||
|
||||
#define WC_UserWidget 128
|
||||
|
||||
|
||||
|
||||
#define SCROLLER_WIDTH 20
|
||||
|
||||
|
||||
|
||||
#define XDND_VERSION 4
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+3
-2
@@ -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");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
@@ -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,13 +88,14 @@ 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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ static WMEventHook *extraEventHandler=NULL;
|
||||
*
|
||||
*/
|
||||
void
|
||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
void *clientData)
|
||||
{
|
||||
W_EventHandler *hPtr;
|
||||
|
||||
+75
-1347
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
+320
-53
@@ -9,6 +9,10 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef XFT
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* XXX TODO */
|
||||
@@ -81,8 +85,11 @@ static int scalableFontSizes[] = {
|
||||
|
||||
|
||||
|
||||
static void getSelectedFont(FontPanel *panel, char buffer[], int bufsize);
|
||||
#ifdef XFT
|
||||
static void setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size);
|
||||
#endif
|
||||
|
||||
static int isXLFD(char *font, int *length_ret);
|
||||
|
||||
static void arrangeLowerFrame(FontPanel *panel);
|
||||
|
||||
@@ -174,7 +181,7 @@ setClickedAction(WMWidget *w, void *data)
|
||||
static void
|
||||
revertClickedAction(WMWidget *w, void *data)
|
||||
{
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
/*FontPanel *panel = (FontPanel*)data;*/
|
||||
/* XXX TODO */
|
||||
}
|
||||
|
||||
@@ -196,7 +203,8 @@ WMGetFontPanel(WMScreen *scr)
|
||||
memset(panel, 0, sizeof(FontPanel));
|
||||
|
||||
panel->win = WMCreateWindow(scr, "fontPanel");
|
||||
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
|
||||
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
|
||||
WMSetWindowTitle(panel->win, _("Font Panel"));
|
||||
WMResizeWidget(panel->win, DEF_WIDTH, DEF_HEIGHT);
|
||||
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
|
||||
@@ -213,7 +221,7 @@ WMGetFontPanel(WMScreen *scr)
|
||||
WMSetFrameRelief(panel->upperF, WRFlat);
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
|
||||
panel->lowerF = WMCreateFrame(panel->win);
|
||||
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
||||
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
||||
WMSetFrameRelief(panel->lowerF, WRFlat);
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
|
||||
|
||||
@@ -232,7 +240,7 @@ WMGetFontPanel(WMScreen *scr)
|
||||
panel->sampleT = WMCreateTextField(panel->upperF);
|
||||
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
|
||||
WMMoveWidget(panel->sampleT, 10, 10);
|
||||
WMSetTextFieldText(panel->sampleT, _("Test!!!"));
|
||||
WMSetTextFieldText(panel->sampleT, _("The quick brown fox jumps over the lazy dog"));
|
||||
|
||||
font = WMBoldSystemFontOfSize(scr, 12);
|
||||
|
||||
@@ -267,7 +275,7 @@ WMGetFontPanel(WMScreen *scr)
|
||||
WMSetLabelTextAlignment(panel->sizL, WACenter);
|
||||
|
||||
panel->sizT = WMCreateTextField(panel->lowerF);
|
||||
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
||||
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
||||
|
||||
panel->sizLs = WMCreateList(panel->lowerF);
|
||||
WMSetListAction(panel->sizLs, sizeClick, panel);
|
||||
@@ -349,21 +357,6 @@ WMHideFontPanel(WMFontPanel *panel)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetFontPanelFont(WMFontPanel *panel, WMFont *font)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMSetFontPanelFontName(WMFontPanel *panel, char *fontName)
|
||||
{
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
WMFont*
|
||||
WMGetFontPanelFont(WMFontPanel *panel)
|
||||
{
|
||||
@@ -371,18 +364,37 @@ WMGetFontPanelFont(WMFontPanel *panel)
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
WMGetFontPanelFontName(WMFontPanel *panel)
|
||||
void
|
||||
WMSetFontPanelFont(WMFontPanel *panel, char *fontName)
|
||||
{
|
||||
char name[512];
|
||||
#ifdef XFT
|
||||
int fname_len;
|
||||
FcPattern *pattern;
|
||||
FcChar8 *family, *style;
|
||||
double size;
|
||||
|
||||
getSelectedFont(panel, name, sizeof(name));
|
||||
if (!isXLFD(fontName, &fname_len)) {
|
||||
/* maybe its proper fontconfig and we can parse it */
|
||||
pattern = FcNameParse(fontName);
|
||||
} else {
|
||||
/* maybe its proper xlfd and we can convert it to an FcPattern */
|
||||
pattern = XftXlfdParse(fontName, False, False);
|
||||
//FcPatternPrint(pattern);
|
||||
}
|
||||
|
||||
return wstrdup(name);
|
||||
if (!pattern)
|
||||
return;
|
||||
|
||||
if (FcPatternGetString(pattern, FC_FAMILY, 0, &family)==FcResultMatch)
|
||||
if (FcPatternGetString(pattern, FC_STYLE, 0, &style)==FcResultMatch)
|
||||
if (FcPatternGetDouble(pattern, "pixelsize", 0, &size)==FcResultMatch)
|
||||
setFontPanelFontName(panel, family, style, size);
|
||||
|
||||
FcPatternDestroy(pattern);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data)
|
||||
{
|
||||
@@ -458,6 +470,22 @@ arrangeLowerFrame(FontPanel *panel)
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isXLFD(char *font, int *length_ret)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
*length_ret = 0;
|
||||
while (*font) {
|
||||
(*length_ret)++;
|
||||
if (*font++ == '-')
|
||||
c++;
|
||||
}
|
||||
|
||||
return c==NUM_FIELDS;
|
||||
}
|
||||
|
||||
#ifndef XFT
|
||||
static Bool
|
||||
parseFont(char *font, char values[NUM_FIELDS][256])
|
||||
{
|
||||
@@ -488,22 +516,6 @@ parseFont(char *font, char values[NUM_FIELDS][256])
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isXLFD(char *font, int *length_ret)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
*length_ret = 0;
|
||||
while (*font) {
|
||||
(*length_ret)++;
|
||||
if (*font++ == '-')
|
||||
c++;
|
||||
}
|
||||
|
||||
return c==NUM_FIELDS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -531,6 +543,18 @@ typedef struct {
|
||||
|
||||
WMArray *typefaces;
|
||||
} Family;
|
||||
#endif
|
||||
#ifdef XFT
|
||||
typedef struct {
|
||||
char *typeface;
|
||||
WMArray *sizes;
|
||||
} Xft_Typeface;
|
||||
|
||||
typedef struct {
|
||||
char *name; /* gotta love simplicity */
|
||||
WMArray *typefaces;
|
||||
} Xft_Family;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -550,9 +574,12 @@ compare_int(const void *a, const void *b)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
#ifdef XFT
|
||||
addSizeToTypeface(Xft_Typeface *face, int size)
|
||||
#else
|
||||
addSizeToTypeface(Typeface *face, int size)
|
||||
#endif
|
||||
{
|
||||
if (size == 0) {
|
||||
int j;
|
||||
@@ -573,7 +600,35 @@ addSizeToTypeface(Typeface *face, int size)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XFT
|
||||
static void
|
||||
addTypefaceToXftFamily(Xft_Family *fam, char *style)
|
||||
{
|
||||
Xft_Typeface *face;
|
||||
WMArrayIterator i;
|
||||
|
||||
if(fam->typefaces) {
|
||||
WM_ITERATE_ARRAY(fam->typefaces, face, i) {
|
||||
if(strcmp(face->typeface, style) != 0)
|
||||
continue; /* go to next interation */
|
||||
addSizeToTypeface(face, 0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fam->typefaces = WMCreateArray(4);
|
||||
}
|
||||
|
||||
face = wmalloc(sizeof(Xft_Typeface));
|
||||
memset(face, 0 , sizeof(Xft_Typeface));
|
||||
|
||||
face->typeface = wstrdup(style);
|
||||
face->sizes = WMCreateArray(4);
|
||||
addSizeToTypeface(face, 0);
|
||||
|
||||
WMAddToArray(fam->typefaces, face);
|
||||
}
|
||||
|
||||
#else /* XFT */
|
||||
|
||||
static void
|
||||
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||
@@ -615,7 +670,7 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||
|
||||
WMAddToArray(family->typefaces, face);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* families (same family name) (Hashtable of family -> array)
|
||||
@@ -623,6 +678,39 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef XFT
|
||||
static void
|
||||
addFontToXftFamily(WMHashTable *families, char *name, char *style)
|
||||
{
|
||||
WMArrayIterator i;
|
||||
WMArray *array;
|
||||
Xft_Family *fam;
|
||||
|
||||
array = WMHashGet(families, name);
|
||||
if(array) {
|
||||
WM_ITERATE_ARRAY(array, fam, i) {
|
||||
if(strcmp(fam->name, name) == 0 )
|
||||
addTypefaceToXftFamily(fam, style);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
array = WMCreateArray(8);
|
||||
|
||||
fam = wmalloc(sizeof(Xft_Family));
|
||||
memset(fam, 0, sizeof(Xft_Family));
|
||||
|
||||
fam->name = wstrdup(name);
|
||||
|
||||
addTypefaceToXftFamily(fam, style);
|
||||
|
||||
WMAddToArray(array, fam);
|
||||
|
||||
WMHashInsert(families, fam->name, array);
|
||||
}
|
||||
|
||||
#else /* XFT */
|
||||
|
||||
static void
|
||||
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
||||
{
|
||||
@@ -731,19 +819,39 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
||||
|
||||
WMHashInsert(families, fam->name, family);
|
||||
}
|
||||
#endif /* XFT */
|
||||
|
||||
|
||||
|
||||
static void
|
||||
listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||
{
|
||||
#ifdef XFT
|
||||
FcObjectSet *os = 0;
|
||||
FcFontSet *fs;
|
||||
FcPattern *pat;
|
||||
#else /* XFT */
|
||||
char **fontList;
|
||||
WMHashTable *families;
|
||||
char fields[NUM_FIELDS][256];
|
||||
int count;
|
||||
#endif /* XFT */
|
||||
WMHashTable *families;
|
||||
WMHashEnumerator enumer;
|
||||
WMArray *array;
|
||||
int i, count;
|
||||
int i;
|
||||
|
||||
#ifdef XFT
|
||||
pat = FcPatternCreate();
|
||||
os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, 0);
|
||||
fs = FcFontList(0, pat, os);
|
||||
if (!fs) {
|
||||
WMRunAlertPanel(scr, panel->win, _("Error"),
|
||||
_("Could not init font config library\n"), _("OK"), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
if (pat)
|
||||
FcPatternDestroy (pat);
|
||||
#else /* XFT */
|
||||
fontList = XListFonts(scr->display, ALL_FONTS_MASK, MAX_FONTS_TO_RETRIEVE,
|
||||
&count);
|
||||
if (!fontList) {
|
||||
@@ -751,9 +859,23 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||
_("Could not retrieve font list"), _("OK"), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
#endif /* XFT */
|
||||
|
||||
families = WMCreateHashTable(WMStringPointerHashCallbacks);
|
||||
|
||||
#ifdef XFT
|
||||
if(fs) {
|
||||
for (i = 0; i < fs->nfont; i++) {
|
||||
FcChar8 *family;
|
||||
FcChar8 *style;
|
||||
|
||||
if (FcPatternGetString(fs->fonts[i],FC_FAMILY,0,&family)==FcResultMatch)
|
||||
if (FcPatternGetString(fs->fonts[i],FC_STYLE,0,&style)==FcResultMatch)
|
||||
addFontToXftFamily(families, family, style);
|
||||
}
|
||||
FcFontSetDestroy(fs);
|
||||
}
|
||||
#else /* XFT */
|
||||
for (i = 0; i < count; i++) {
|
||||
int fname_len;
|
||||
|
||||
@@ -773,9 +895,27 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||
}
|
||||
addFontToFamily(families, fields);
|
||||
}
|
||||
#endif /* XFT */
|
||||
|
||||
enumer = WMEnumerateHashTable(families);
|
||||
|
||||
#ifdef XFT
|
||||
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
||||
WMArrayIterator i;
|
||||
Xft_Family *fam;
|
||||
char buffer[256];
|
||||
WMListItem *item;
|
||||
|
||||
WM_ITERATE_ARRAY(array, fam, i) {
|
||||
strcpy(buffer, fam->name);
|
||||
item = WMAddListItem(panel->famLs, buffer);
|
||||
|
||||
item->clientData = fam;
|
||||
}
|
||||
|
||||
WMFreeArray(array);
|
||||
}
|
||||
#else /* XFT */
|
||||
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
||||
WMArrayIterator i;
|
||||
Family *fam;
|
||||
@@ -803,6 +943,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||
}
|
||||
WMFreeArray(array);
|
||||
}
|
||||
#endif /* XFT */
|
||||
WMSortListItems(panel->famLs);
|
||||
|
||||
WMFreeHashTable(families);
|
||||
@@ -813,23 +954,42 @@ static void
|
||||
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
||||
{
|
||||
WMListItem *item;
|
||||
#ifdef XFT
|
||||
Xft_Family *family;
|
||||
Xft_Typeface *face;
|
||||
#else
|
||||
Family *family;
|
||||
Typeface *face;
|
||||
#endif
|
||||
char *size;
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(panel->famLs);
|
||||
if (!item)
|
||||
return;
|
||||
#ifdef XFT
|
||||
family = (Xft_Family*)item->clientData;
|
||||
#else
|
||||
family = (Family*)item->clientData;
|
||||
#endif
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
if (!item)
|
||||
return;
|
||||
#ifdef XFT
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
#else
|
||||
face = (Typeface*)item->clientData;
|
||||
#endif
|
||||
|
||||
size = WMGetTextFieldText(panel->sizT);
|
||||
|
||||
#ifdef XFT
|
||||
snprintf(buffer, bufsize, "%s:style=%s:pixelsize=%s",
|
||||
family->name,
|
||||
face->typeface,
|
||||
size);
|
||||
#else
|
||||
snprintf(buffer, bufsize, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
|
||||
family->foundry,
|
||||
family->name,
|
||||
@@ -840,7 +1000,7 @@ getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
||||
size,
|
||||
family->registry,
|
||||
family->encoding);
|
||||
|
||||
#endif /* XFT */
|
||||
wfree(size);
|
||||
}
|
||||
|
||||
@@ -853,7 +1013,6 @@ preview(FontPanel *panel)
|
||||
WMFont *font;
|
||||
|
||||
getSelectedFont(panel, buffer, sizeof(buffer));
|
||||
|
||||
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
|
||||
if (font) {
|
||||
WMSetTextFieldFont(panel->sampleT, font);
|
||||
@@ -868,9 +1027,14 @@ familyClick(WMWidget *w, void *data)
|
||||
{
|
||||
WMList *lPtr = (WMList*)w;
|
||||
WMListItem *item;
|
||||
#ifdef XFT
|
||||
Xft_Family *family;
|
||||
Xft_Typeface *face;
|
||||
#else
|
||||
Family *family;
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
Typeface *face;
|
||||
#endif
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
WMArrayIterator i;
|
||||
/* current typeface and size */
|
||||
char *oface = NULL;
|
||||
@@ -887,7 +1051,11 @@ familyClick(WMWidget *w, void *data)
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(lPtr);
|
||||
#ifdef XFT
|
||||
family = (Xft_Family*)item->clientData;
|
||||
#else
|
||||
family = (Family*)item->clientData;
|
||||
#endif
|
||||
|
||||
WMClearList(panel->typLs);
|
||||
|
||||
@@ -897,6 +1065,13 @@ familyClick(WMWidget *w, void *data)
|
||||
int top=0;
|
||||
WMListItem *fitem;
|
||||
|
||||
#ifdef XFT
|
||||
strcpy(buffer, face->typeface);
|
||||
if(strcasecmp(face->typeface, "Roman") == 0)
|
||||
top = 1;
|
||||
if(strcasecmp(face->typeface, "Regular") == 0)
|
||||
top = 1;
|
||||
#else
|
||||
if (strcmp(face->weight, "medium") == 0) {
|
||||
buffer[0] = 0;
|
||||
} else {
|
||||
@@ -927,7 +1102,7 @@ familyClick(WMWidget *w, void *data)
|
||||
if (buffer[0] == 0) {
|
||||
strcpy(buffer, _("Normal"));
|
||||
}
|
||||
|
||||
#endif
|
||||
if (top)
|
||||
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
||||
else
|
||||
@@ -966,7 +1141,11 @@ typefaceClick(WMWidget *w, void *data)
|
||||
{
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
WMListItem *item;
|
||||
#ifdef XFT
|
||||
Xft_Typeface *face;
|
||||
#else
|
||||
Typeface *face;
|
||||
#endif
|
||||
WMArrayIterator i;
|
||||
char buffer[32];
|
||||
|
||||
@@ -978,7 +1157,11 @@ typefaceClick(WMWidget *w, void *data)
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
#ifdef XFT
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
#else
|
||||
face = (Typeface*)item->clientData;
|
||||
#endif
|
||||
|
||||
WMClearList(panel->sizLs);
|
||||
|
||||
@@ -1009,7 +1192,6 @@ typefaceClick(WMWidget *w, void *data)
|
||||
preview(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sizeClick(WMWidget *w, void *data)
|
||||
{
|
||||
@@ -1017,7 +1199,6 @@ sizeClick(WMWidget *w, void *data)
|
||||
WMListItem *item;
|
||||
|
||||
item = WMGetListSelectedItem(panel->sizLs);
|
||||
|
||||
WMSetTextFieldText(panel->sizT, item->text);
|
||||
|
||||
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text)));
|
||||
@@ -1025,3 +1206,89 @@ sizeClick(WMWidget *w, void *data)
|
||||
preview(panel);
|
||||
}
|
||||
|
||||
|
||||
#ifdef XFT
|
||||
static void
|
||||
setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size)
|
||||
{
|
||||
int famrow;
|
||||
int stlrow;
|
||||
int sz;
|
||||
char asize[64];
|
||||
void *vsize;
|
||||
WMListItem *item;
|
||||
Xft_Family *fam;
|
||||
Xft_Typeface *face;
|
||||
WMArrayIterator i;
|
||||
|
||||
famrow = WMFindRowOfListItemWithTitle(panel->famLs, family);
|
||||
if (famrow < 0 ){
|
||||
famrow = 0;
|
||||
return;
|
||||
}
|
||||
WMSelectListItem(panel->famLs, famrow);
|
||||
WMSetListPosition(panel->famLs, famrow);
|
||||
|
||||
WMClearList(panel->typLs);
|
||||
|
||||
item = WMGetListSelectedItem(panel->famLs);
|
||||
|
||||
fam = (Xft_Family*)item->clientData;
|
||||
WM_ITERATE_ARRAY(fam->typefaces, face, i) {
|
||||
char buffer[256];
|
||||
int top=0;
|
||||
WMListItem *fitem;
|
||||
|
||||
strcpy(buffer, face->typeface);
|
||||
if(strcasecmp(face->typeface, "Roman") == 0)
|
||||
top = 1;
|
||||
if (top)
|
||||
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
||||
else
|
||||
fitem = WMAddListItem(panel->typLs, buffer);
|
||||
fitem->clientData = face;
|
||||
}
|
||||
|
||||
|
||||
stlrow = WMFindRowOfListItemWithTitle(panel->typLs, style);
|
||||
|
||||
if (stlrow < 0) {
|
||||
stlrow = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
WMSelectListItem(panel->typLs, stlrow);
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
|
||||
WMClearList(panel->sizLs);
|
||||
|
||||
|
||||
WM_ITERATE_ARRAY(face->sizes, vsize, i) {
|
||||
char buffer[32];
|
||||
if ((int)vsize != 0) {
|
||||
sprintf(buffer, "%i", (int)vsize);
|
||||
|
||||
WMAddListItem(panel->sizLs, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(asize, sizeof(asize)-1, "%d",(int)(size+0.5));
|
||||
|
||||
sz = WMFindRowOfListItemWithTitle(panel->sizLs, asize);
|
||||
|
||||
if (sz < 0) {
|
||||
sz = 4;
|
||||
return;
|
||||
}
|
||||
|
||||
WMSelectListItem(panel->sizLs, sz);
|
||||
sizeClick(panel->sizLs, panel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+6
-7
@@ -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);
|
||||
}
|
||||
|
||||
+11
-4
@@ -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;
|
||||
|
||||
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;
|
||||
|
||||
+11
-6
@@ -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,7 +76,8 @@ void W_DestroyIC(WMICContext *ctx)
|
||||
}
|
||||
|
||||
|
||||
int W_LookupString(WMView *view, XKeyEvent *event,
|
||||
int
|
||||
W_LookupString(WMView *view, XKeyEvent *event,
|
||||
char buffer, int bufsize, KeySym ksym)
|
||||
{
|
||||
|
||||
|
||||
+62
-2
@@ -87,8 +87,68 @@ 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)
|
||||
{
|
||||
@@ -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
|
||||
|
||||
@@ -309,7 +309,6 @@ paintArrow(WMScroller *sPtr, Drawable d, int part)
|
||||
|
||||
|
||||
if (sPtr->flags.horizontal) {
|
||||
|
||||
/* paint button */
|
||||
#ifndef DOUBLE_BUFFER
|
||||
XFillRectangle(scr->display, d, gc,
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -109,9 +109,9 @@ typedef struct _Panel {
|
||||
|
||||
char oldTabItem;
|
||||
|
||||
char menuStyle;
|
||||
int menuStyle;
|
||||
|
||||
char titleAlignment;
|
||||
int titleAlignment;
|
||||
|
||||
Pixmap preview;
|
||||
Pixmap previewNoText;
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+10
-10
@@ -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"
|
||||
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);
|
||||
|
||||
|
||||
+22
-28
@@ -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,25 +1473,19 @@ 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 1:
|
||||
return WMBoldSystemFontOfSize(scr, 24);
|
||||
case 4:
|
||||
return WMSystemFontOfSize(scr, 8);
|
||||
break;
|
||||
case 5:
|
||||
return WMSystemFontOfSize(scr, 8);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
return WMSystemFontOfSize(scr, 12);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+87
-27
@@ -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
|
||||
if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
|
||||
XFTCONFIG="$PKGCONFIG xft"
|
||||
pkgconfig_xft=yes
|
||||
else
|
||||
else
|
||||
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
|
||||
fi
|
||||
AC_MSG_CHECKING([for the Xft2 library])
|
||||
if test "x$XFTCONFIG" != x; then
|
||||
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
|
||||
else
|
||||
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
|
||||
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
@@ -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 = \
|
||||
|
||||
+5
-3
@@ -70,6 +70,7 @@ enum {
|
||||
WMSubmenuLevel = 6,
|
||||
WMMainMenuLevel = 20,
|
||||
WMStatusLevel = 21,
|
||||
WMFullscreenLevel = 50,
|
||||
WMModalLevel = 100,
|
||||
WMPopUpLevel = 101,
|
||||
WMScreensaverLevel = 1000,
|
||||
@@ -144,7 +145,8 @@ typedef enum {
|
||||
#define WCUR_TEXT 12
|
||||
#define WCUR_SELECT 13
|
||||
#define WCUR_ROOT 14
|
||||
#define WCUR_LAST 15
|
||||
#define WCUR_EMPTY 15
|
||||
#define WCUR_LAST 16
|
||||
|
||||
/* geometry displays */
|
||||
#define WDIS_NEW 0 /* new style */
|
||||
@@ -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 */
|
||||
|
||||
+170
-77
@@ -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--
|
||||
@@ -140,32 +111,20 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
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,6 +1124,15 @@ wIconifyWindow(WWindow *wwin)
|
||||
void
|
||||
wDeiconifyWindow(WWindow *wwin)
|
||||
{
|
||||
#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)
|
||||
@@ -1094,25 +1151,42 @@ wDeiconifyWindow(WWindow *wwin)
|
||||
}
|
||||
|
||||
wwin->flags.miniaturized = 0;
|
||||
if (!wwin->flags.shaded)
|
||||
wwin->flags.mapped = 1;
|
||||
|
||||
if (!wPreferences.disable_miniwindows && wwin->icon != NULL) {
|
||||
if (!netwm_hidden && !wwin->flags.shaded) {
|
||||
wwin->flags.mapped = 1;
|
||||
}
|
||||
|
||||
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 (!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;
|
||||
@@ -1128,6 +1202,14 @@ wDeiconifyWindow(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;
|
||||
@@ -1152,28 +1234,38 @@ wDeiconifyWindow(WWindow *wwin)
|
||||
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;
|
||||
}
|
||||
|
||||
if (!netwm_hidden) {
|
||||
XUngrabServer(dpy);
|
||||
|
||||
wSetFocusTo(wwin->screen_ptr, 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();
|
||||
|
||||
if (!wWindowFor(clientwin))
|
||||
/* the window can disappear while ProcessPendingEvents() runs */
|
||||
if (!wWindowFor(clientwin)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (wPreferences.auto_arrange_icons) {
|
||||
wArrangeIcons(wwin->screen_ptr, True);
|
||||
@@ -1182,6 +1274,7 @@ wDeiconifyWindow(WWindow *wwin)
|
||||
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
||||
|
||||
/* In case we were shaded and iconified, also unshade */
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
char *progname;
|
||||
|
||||
if (!XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc < 1)
|
||||
return;
|
||||
|
||||
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
@@ -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);
|
||||
|
||||
+23
-18
@@ -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,21 +356,16 @@ 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) {
|
||||
command = GetCommandForWindow(wwin->main_window);
|
||||
if (command) {
|
||||
if (wapp->app_icon->command)
|
||||
wfree(wapp->app_icon->command);
|
||||
wapp->app_icon->command = wtokenjoin(argv, argc);
|
||||
}
|
||||
if (argv) {
|
||||
XFreeStringList(argv);
|
||||
}
|
||||
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;
|
||||
|
||||
if (!done)
|
||||
done = wKWMCheckClientHintChange(wwin, event);
|
||||
#endif /* KWM_HINTS */
|
||||
#ifdef NETWM_HINTS
|
||||
if (!done) {
|
||||
done = wNETWMCheckClientHintChange(wwin, event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-8
@@ -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,6 +245,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
||||
modifiers = ev.xkey.state & ValidModMask;
|
||||
|
||||
if (ev.type == KeyPress) {
|
||||
#ifdef DEBUG
|
||||
printf("Got key press\n");
|
||||
#endif
|
||||
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
||||
|
||||
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
+50
-63
@@ -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,10 +971,11 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 +1511,7 @@ wDockSaveState(WScreen *scr, WMPropList *old_state)
|
||||
if (strncasecmp(WMGetFromPLString(tmp), "applications", 12) == 0
|
||||
&& !WMGetFromPLDictionary(dock_state, tmp)) {
|
||||
|
||||
WMPutInPLDictionary(dock_state,
|
||||
tmp,
|
||||
WMPutInPLDictionary(dock_state, tmp,
|
||||
WMGetFromPLDictionary(old_state, tmp));
|
||||
}
|
||||
}
|
||||
@@ -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,13 +1819,14 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* restore collapsed state */
|
||||
@@ -1836,13 +1836,14 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* restore auto-collapsed state */
|
||||
@@ -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,13 +1883,14 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* application list */
|
||||
@@ -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) {
|
||||
char *command;
|
||||
|
||||
icon->editing = 0;
|
||||
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->forced_dock = 1;*/
|
||||
/* icon->forced_dock = 1;*/
|
||||
if (dock->type!=WM_CLIP || !icon->attracted) {
|
||||
icon->editing = 1;
|
||||
if (wInputDialog(dock->screen_ptr, _("Dock Icon"),
|
||||
@@ -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))
|
||||
(!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)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
+83
-39
@@ -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];
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
+6
-3
@@ -1488,12 +1488,14 @@ titlebarMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
WCoreWindow *titlebar = desc->self;
|
||||
|
||||
if (IsDoubleClick(fwin->core->screen_ptr, event)) {
|
||||
if (fwin->on_dblclick_titlebar)
|
||||
if (fwin->on_dblclick_titlebar) {
|
||||
(*fwin->on_dblclick_titlebar)(titlebar, fwin->child, event);
|
||||
}
|
||||
} else {
|
||||
if (fwin->on_mousedown_titlebar)
|
||||
if (fwin->on_mousedown_titlebar) {
|
||||
(*fwin->on_mousedown_titlebar)(titlebar, fwin->child, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1534,7 +1536,8 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
}
|
||||
#ifdef XKB_BUTTON_HINT
|
||||
if (button == fwin->language_button) {
|
||||
if (!wPreferences.modelock) return;
|
||||
if (!wPreferences.modelock)
|
||||
return;
|
||||
image = fwin->languagebutton_image;
|
||||
}
|
||||
#endif
|
||||
|
||||
+12
@@ -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
@@ -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 */
|
||||
|
||||
+13
-3
@@ -80,10 +80,20 @@
|
||||
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
# define WKBD_TOGGLE 46
|
||||
# define WKBD_LAST 47
|
||||
# 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 {
|
||||
|
||||
+16
-8
@@ -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,12 +722,15 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
if (!Locale) {
|
||||
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, "");
|
||||
|
||||
|
||||
+2
-3
@@ -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) {
|
||||
|
||||
+120
-3
@@ -52,8 +52,6 @@
|
||||
|
||||
/**** global variables *****/
|
||||
|
||||
extern char *DisplayName;
|
||||
|
||||
extern WPreferences wPreferences;
|
||||
|
||||
extern Time LastTimestamp;
|
||||
@@ -1244,7 +1242,6 @@ UpdateDomainFile(WDDomain *domain)
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
StrConcatDot(char *a, char *b)
|
||||
{
|
||||
@@ -1263,3 +1260,123 @@ StrConcatDot(char *a, char *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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+74
-26
@@ -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) {
|
||||
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
@@ -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;
|
||||
|
||||
+37
-13
@@ -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
|
||||
* */
|
||||
/* 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
@@ -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;
|
||||
|
||||
+2
-7
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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 {
|
||||
|
||||
+139
-39
@@ -68,6 +68,9 @@
|
||||
#ifdef OLWM_HINTS
|
||||
# include "openlook.h"
|
||||
#endif
|
||||
#ifdef NETWM_HINTS
|
||||
# include "wmspec.h"
|
||||
#endif
|
||||
|
||||
/****** Global Variables ******/
|
||||
|
||||
@@ -278,12 +281,16 @@ wWindowDestroy(WWindow *wwin)
|
||||
if (wPreferences.auto_arrange_icons)
|
||||
wArrangeIcons(wwin->screen_ptr, True);
|
||||
}
|
||||
|
||||
#ifdef NETWM_HINTS
|
||||
if (wwin->net_icon_image)
|
||||
RReleaseImage(wwin->net_icon_image);
|
||||
#endif
|
||||
|
||||
wrelease(wwin);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setupGNUstepHints(WWindow *wwin, GNUstepWMAttributes *gs_hints)
|
||||
{
|
||||
@@ -431,13 +438,19 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
wMWMCheckClientHints(wwin);
|
||||
#endif /* MWM_HINTS */
|
||||
|
||||
#ifdef NETWM_HINTS
|
||||
if (!check)
|
||||
check = wNETWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||
#endif
|
||||
|
||||
#ifdef GNOME_STUFF
|
||||
if (!check)
|
||||
check = wGNOMECheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||
#endif /* GNOME_STUFF */
|
||||
|
||||
#ifdef KWM_HINTS
|
||||
if (!check)
|
||||
wKWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||
check = wKWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||
#endif /* KWM_HINTS */
|
||||
|
||||
#ifdef OLWM_HINTS
|
||||
@@ -458,6 +471,14 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
*level = tmp_level;
|
||||
}
|
||||
|
||||
if (wwin->transient_for!=None && wwin->transient_for != scr->root_win) {
|
||||
WWindow * transientOwner = wWindowFor(wwin->transient_for);
|
||||
if (transientOwner) {
|
||||
int ownerLevel = transientOwner->frame->core->stacking->window_level;
|
||||
if (ownerLevel > *level) *level = ownerLevel;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_workspace >= 0) {
|
||||
*workspace = tmp_workspace % scr->workspace_count;
|
||||
}
|
||||
@@ -541,6 +562,78 @@ wWindowObscuresWindow(WWindow *wwin, WWindow *obscured)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fixLeaderProperties(WWindow *wwin)
|
||||
{
|
||||
XClassHint *classHint;
|
||||
XWMHints *hints, *clientHints;
|
||||
Window leaders[2], window;
|
||||
char **argv, *command;
|
||||
int argc, i, pid;
|
||||
Bool haveCommand;
|
||||
|
||||
classHint = XAllocClassHint();
|
||||
clientHints = XGetWMHints(dpy, wwin->client_win);
|
||||
pid = GetPidForWindow(wwin->client_win);
|
||||
if (pid > 0) {
|
||||
haveCommand = GetCommandForPid(pid, &argv, &argc);
|
||||
} else {
|
||||
haveCommand = False;
|
||||
}
|
||||
|
||||
leaders[0] = wwin->client_leader;
|
||||
leaders[1] = wwin->group_id;
|
||||
|
||||
if (haveCommand) {
|
||||
command = GetCommandForWindow(wwin->client_win);
|
||||
if (command) {
|
||||
/* command already set. nothing to do. */
|
||||
wfree(command);
|
||||
} else {
|
||||
XSetCommand(dpy, wwin->client_win, argv, argc);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
window = leaders[i];
|
||||
if (window) {
|
||||
if (XGetClassHint(dpy, window, classHint) == 0) {
|
||||
classHint->res_name = wwin->wm_instance;
|
||||
classHint->res_class = wwin->wm_class;
|
||||
XSetClassHint(dpy, window, classHint);
|
||||
}
|
||||
hints = XGetWMHints(dpy, window);
|
||||
if (hints) {
|
||||
XFree(hints);
|
||||
} else if (clientHints) {
|
||||
/* set window group leader to self */
|
||||
clientHints->window_group = window;
|
||||
clientHints->flags |= WindowGroupHint;
|
||||
XSetWMHints(dpy, window, clientHints);
|
||||
}
|
||||
|
||||
if (haveCommand) {
|
||||
command = GetCommandForWindow(window);
|
||||
if (command) {
|
||||
/* command already set. nothing to do. */
|
||||
wfree(command);
|
||||
} else {
|
||||
XSetCommand(dpy, window, argv, argc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XFree(classHint);
|
||||
if (clientHints) {
|
||||
XFree(clientHints);
|
||||
}
|
||||
if (haveCommand) {
|
||||
wfree(argv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Window
|
||||
createFakeWindowGroupLeader(WScreen *scr, Window win, char *instance, char *class)
|
||||
{
|
||||
@@ -812,6 +905,8 @@ wManageWindow(WScreen *scr, Window window)
|
||||
wwin->main_window = wwin->client_win;
|
||||
}
|
||||
|
||||
fixLeaderProperties(wwin);
|
||||
|
||||
wwin->orig_main_window = wwin->main_window;
|
||||
|
||||
if (wwin->flags.is_gnustep) {
|
||||
@@ -835,7 +930,7 @@ wManageWindow(WScreen *scr, Window window)
|
||||
|
||||
#define ADEQUATE(x) ((x)!=None && (x)!=wwin->client_win && (x)!=fPtr->leader)
|
||||
|
||||
|
||||
// only enter here if PropGetWMClass() succeds
|
||||
PropGetWMClass(wwin->main_window, &class, &instance);
|
||||
buffer = StrConcatDot(instance, class);
|
||||
|
||||
@@ -924,20 +1019,26 @@ wManageWindow(WScreen *scr, Window window)
|
||||
wwin->flags.miniaturized = 1;
|
||||
}
|
||||
|
||||
if (WFLAGP(wwin, start_maximized) && !WFLAGP(wwin, no_resizable)) {
|
||||
if (WFLAGP(wwin, start_maximized) && IS_RESIZABLE(wwin)) {
|
||||
wwin->flags.maximized = MAX_VERTICAL|MAX_HORIZONTAL;
|
||||
}
|
||||
|
||||
{
|
||||
Bool bla;
|
||||
#if defined(NETWM_HINTS) || defined(GNOME_STUFF) || defined(KWM_HINTS)
|
||||
Bool bla = False;
|
||||
#endif
|
||||
|
||||
bla = False;
|
||||
#ifdef NETWM_HINTS
|
||||
if (!bla)
|
||||
bla = wNETWMCheckInitialClientState(wwin);
|
||||
#endif
|
||||
#ifdef GNOME_STUFF
|
||||
if (!bla)
|
||||
bla = wGNOMECheckInitialClientState(wwin);
|
||||
#endif
|
||||
#ifdef KWM_HINTS
|
||||
if (!bla)
|
||||
wKWMCheckClientInitialState(wwin);
|
||||
bla = wKWMCheckClientInitialState(wwin);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1145,9 +1246,9 @@ wManageWindow(WScreen *scr, Window window)
|
||||
* Make spash screens come out in the center of a head
|
||||
* trouble is that most splashies never get here
|
||||
* they are managed trough atoms but god knows where.
|
||||
* Dan, do you know ?
|
||||
* Dan, do you know ? -peter
|
||||
*
|
||||
* Most of them are not managed, they are set
|
||||
* Most of them are not managed, they have set
|
||||
* OverrideRedirect, which means we can't do anything about
|
||||
* them. -alfredo
|
||||
*/
|
||||
@@ -1213,6 +1314,10 @@ wManageWindow(WScreen *scr, Window window)
|
||||
wScreenBringInside(scr, &x, &y, width, height);
|
||||
}
|
||||
|
||||
#ifdef NETWM_HINTS
|
||||
wNETWMPositionSplash(wwin, &x, &y, width, height);
|
||||
#endif
|
||||
|
||||
if (wwin->flags.urgent) {
|
||||
if (!IS_OMNIPRESENT(wwin))
|
||||
wwin->flags.omnipresent ^= 1;
|
||||
@@ -1230,11 +1335,11 @@ wManageWindow(WScreen *scr, Window window)
|
||||
if (wPreferences.modelock)
|
||||
foo |= WFF_LANGUAGE_BUTTON;
|
||||
#endif
|
||||
if (!WFLAGP(wwin, no_titlebar))
|
||||
if (HAS_TITLEBAR(wwin))
|
||||
foo |= WFF_TITLEBAR;
|
||||
if (!WFLAGP(wwin, no_resizebar))
|
||||
if (HAS_RESIZEBAR(wwin))
|
||||
foo |= WFF_RESIZEBAR;
|
||||
if (!WFLAGP(wwin, no_border))
|
||||
if (HAS_BORDER(wwin))
|
||||
foo |= WFF_BORDER;
|
||||
|
||||
wwin->frame = wFrameWindowCreate(scr, window_level,
|
||||
@@ -1342,12 +1447,10 @@ wManageWindow(WScreen *scr, Window window)
|
||||
if (leader && leader->main_window==None) {
|
||||
leader->main_window = leader->client_win;
|
||||
}
|
||||
app = wApplicationCreate(scr, wwin->main_window);
|
||||
app = wApplicationCreate(wwin);
|
||||
if (app) {
|
||||
app->last_workspace = workspace;
|
||||
|
||||
app->main_window_desc->fake_group = wwin->fake_group;
|
||||
|
||||
/*
|
||||
* Do application specific stuff, like setting application
|
||||
* wide attributes.
|
||||
@@ -2218,7 +2321,7 @@ wWindowSynthConfigureNotify(WWindow *wwin)
|
||||
sevent.xconfigure.height = wwin->client.height;
|
||||
|
||||
sevent.xconfigure.border_width = wwin->old_border_width;
|
||||
if (WFLAGP(wwin, no_titlebar))
|
||||
if (!HAS_TITLEBAR(wwin))
|
||||
sevent.xconfigure.above = None;
|
||||
else
|
||||
sevent.xconfigure.above = wwin->frame->titlebar->window;
|
||||
@@ -2316,7 +2419,7 @@ int req_width, req_height; /* new size of the client */
|
||||
}
|
||||
wwin->frame_x = req_x;
|
||||
wwin->frame_y = req_y;
|
||||
if (!WFLAGP(wwin, no_border)) {
|
||||
if (HAS_BORDER(wwin)) {
|
||||
wwin->client.x += FRAME_BORDER_WIDTH;
|
||||
wwin->client.y += FRAME_BORDER_WIDTH;
|
||||
}
|
||||
@@ -2356,7 +2459,7 @@ int req_x, req_y; /* new position of the frame */
|
||||
|
||||
wwin->client.x = req_x;
|
||||
wwin->client.y = req_y + wwin->frame->top_width;
|
||||
if (!WFLAGP(wwin, no_border)) {
|
||||
if (HAS_BORDER(wwin)) {
|
||||
wwin->client.x += FRAME_BORDER_WIDTH;
|
||||
wwin->client.y += FRAME_BORDER_WIDTH;
|
||||
}
|
||||
@@ -2380,7 +2483,7 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
||||
Pixmap pixmap, mask;
|
||||
WFrameWindow *fwin = wwin->frame;
|
||||
|
||||
if (WFLAGP(wwin, no_titlebar))
|
||||
if (!HAS_TITLEBAR(wwin))
|
||||
return;
|
||||
|
||||
/* miniaturize button */
|
||||
@@ -2429,7 +2532,7 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
||||
|
||||
/* close button */
|
||||
|
||||
/* redefine WFLAGP to MGFLAGP to allow broken close operation */
|
||||
/* redefine WFLAGP to MGFLAGP to allow broken close operation */
|
||||
#define MGFLAGP(wwin, FLAG) (wwin)->client_flags.FLAG
|
||||
|
||||
if (!WFLAGP(wwin, no_close_button)) {
|
||||
@@ -2498,14 +2601,16 @@ wWindowConfigureBorders(WWindow *wwin)
|
||||
int newy, oldh;
|
||||
|
||||
flags = WFF_LEFT_BUTTON|WFF_RIGHT_BUTTON;
|
||||
|
||||
#ifdef XKB_BUTTON_HINT
|
||||
flags |= WFF_LANGUAGE_BUTTON;
|
||||
#endif
|
||||
if (!WFLAGP(wwin, no_titlebar))
|
||||
|
||||
if (HAS_TITLEBAR(wwin))
|
||||
flags |= WFF_TITLEBAR;
|
||||
if (!WFLAGP(wwin, no_resizebar) && !WFLAGP(wwin, no_resizable))
|
||||
if (HAS_RESIZEBAR(wwin) && IS_RESIZABLE(wwin))
|
||||
flags |= WFF_RESIZEBAR;
|
||||
if (!WFLAGP(wwin, no_border))
|
||||
if (HAS_BORDER(wwin))
|
||||
flags |= WFF_BORDER;
|
||||
if (wwin->flags.shaded)
|
||||
flags |= WFF_IS_SHADED;
|
||||
@@ -2527,8 +2632,9 @@ wWindowConfigureBorders(WWindow *wwin)
|
||||
|
||||
#ifdef XKB_BUTTON_HINT
|
||||
if (!WFLAGP(wwin, no_language_button)
|
||||
&& wwin->frame->flags.hide_language_button)
|
||||
&& wwin->frame->flags.hide_language_button) {
|
||||
flags |= WFF_LANGUAGE_BUTTON;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!WFLAGP(wwin, no_close_button)
|
||||
@@ -2659,7 +2765,7 @@ wWindowSetShape(WWindow *wwin)
|
||||
int ordering;
|
||||
|
||||
/* only shape is the client's */
|
||||
if (WFLAGP(wwin, no_titlebar) && WFLAGP(wwin, no_resizebar)) {
|
||||
if (!HAS_TITLEBAR(wwin) && !HAS_RESIZEBAR(wwin)) {
|
||||
goto alt_code;
|
||||
}
|
||||
|
||||
@@ -2680,14 +2786,14 @@ wWindowSetShape(WWindow *wwin)
|
||||
memcpy(urec, rects, sizeof(XRectangle)*count);
|
||||
XFree(rects);
|
||||
|
||||
if (!WFLAGP(wwin, no_titlebar)) {
|
||||
if (HAS_TITLEBAR(wwin)) {
|
||||
urec[count].x = -1;
|
||||
urec[count].y = -1 - wwin->frame->top_width;
|
||||
urec[count].width = wwin->frame->core->width + 2;
|
||||
urec[count].height = wwin->frame->top_width + 1;
|
||||
count++;
|
||||
}
|
||||
if (!WFLAGP(wwin, no_resizebar)) {
|
||||
if (HAS_RESIZEBAR(wwin)) {
|
||||
urec[count].x = -1;
|
||||
urec[count].y = wwin->frame->core->height
|
||||
- wwin->frame->bottom_width - wwin->frame->top_width;
|
||||
@@ -2707,14 +2813,14 @@ wWindowSetShape(WWindow *wwin)
|
||||
alt_code:
|
||||
#endif /* OPTIMIZE_SHAPE */
|
||||
count = 0;
|
||||
if (!WFLAGP(wwin, no_titlebar)) {
|
||||
if (HAS_TITLEBAR(wwin)) {
|
||||
rect[count].x = -1;
|
||||
rect[count].y = -1;
|
||||
rect[count].width = wwin->frame->core->width + 2;
|
||||
rect[count].height = wwin->frame->top_width + 1;
|
||||
count++;
|
||||
}
|
||||
if (!WFLAGP(wwin, no_resizebar)) {
|
||||
if (HAS_RESIZEBAR(wwin)) {
|
||||
rect[count].x = -1;
|
||||
rect[count].y = wwin->frame->core->height - wwin->frame->bottom_width;
|
||||
rect[count].width = wwin->frame->core->width + 2;
|
||||
@@ -2878,17 +2984,11 @@ wWindowGetSavedState(Window win)
|
||||
{
|
||||
char *instance, *class, *command=NULL;
|
||||
WWindowState *wstate = windowState;
|
||||
char **argv;
|
||||
int argc;
|
||||
|
||||
if (!wstate)
|
||||
return NULL;
|
||||
|
||||
if (XGetCommand(dpy, win, &argv, &argc)) {
|
||||
if (argc > 0)
|
||||
command = wtokenjoin(argv, argc);
|
||||
XFreeStringList(argv);
|
||||
}
|
||||
command = GetCommandForWindow(win);
|
||||
if (!command)
|
||||
return NULL;
|
||||
|
||||
@@ -3094,7 +3194,7 @@ titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
|
||||
}
|
||||
|
||||
/* maximize window */
|
||||
if (dir!=0 && !WFLAGP(wwin, no_resizable)) {
|
||||
if (dir!=0 && IS_RESIZABLE(wwin)) {
|
||||
int ndir = dir ^ wwin->flags.maximized;
|
||||
|
||||
if (ndir != 0) {
|
||||
@@ -3147,7 +3247,7 @@ frameMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (event->xbutton.button == Button3 && !WFLAGP(wwin, no_resizable))
|
||||
if (event->xbutton.button == Button3)
|
||||
wMouseResizeWindow(wwin, event);
|
||||
else if (event->xbutton.button==Button1 || event->xbutton.button==Button2)
|
||||
wMouseMoveWindow(wwin, event);
|
||||
|
||||
+31
-3
@@ -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
@@ -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
@@ -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.
|
||||
|
||||
+1329
-200
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
+543
-103
@@ -33,6 +33,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "wcore.h"
|
||||
@@ -49,11 +50,18 @@
|
||||
#ifdef KWM_HINTS
|
||||
#include "kwm.h"
|
||||
#endif
|
||||
#ifdef NETWM_HINTS
|
||||
#include "wmspec.h"
|
||||
#endif
|
||||
|
||||
#include "xinerama.h"
|
||||
|
||||
|
||||
extern WPreferences wPreferences;
|
||||
extern XContext wWinContext;
|
||||
extern XContext wVEdgeContext;
|
||||
|
||||
extern void ProcessPendingEvents();
|
||||
|
||||
static WMPropList *dWorkspaces=NULL;
|
||||
static WMPropList *dClip, *dName;
|
||||
@@ -62,6 +70,7 @@ static WMPropList *dClip, *dName;
|
||||
static BOOL initVDesk = False;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
make_keys()
|
||||
{
|
||||
@@ -129,17 +138,21 @@ wWorkspaceNew(WScreen *scr)
|
||||
wspace->height = scr->scr_height;
|
||||
wspace->width = scr->scr_width;
|
||||
#endif
|
||||
#ifdef NETWM_HINTS
|
||||
wNETWMUpdateDesktop(scr);
|
||||
#endif
|
||||
|
||||
WMPostNotificationName(WMNWorkspaceCreated, scr,
|
||||
(void*)(scr->workspace_count-1));
|
||||
XFlush(dpy);
|
||||
|
||||
return scr->workspace_count-1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool
|
||||
wWorkspaceDelete(WScreen *scr, int workspace)
|
||||
{
|
||||
@@ -147,7 +160,6 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
||||
WWorkspace **list;
|
||||
int i, j;
|
||||
|
||||
|
||||
if (workspace<=0)
|
||||
return False;
|
||||
|
||||
@@ -167,9 +179,9 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
||||
list = wmalloc(sizeof(WWorkspace*)*(scr->workspace_count-1));
|
||||
j = 0;
|
||||
for (i=0; i<scr->workspace_count; i++) {
|
||||
if (i!=workspace)
|
||||
if (i!=workspace) {
|
||||
list[j++] = scr->workspaces[i];
|
||||
else {
|
||||
} else {
|
||||
if (scr->workspaces[i]->name)
|
||||
wfree(scr->workspaces[i]->name);
|
||||
wfree(scr->workspaces[i]);
|
||||
@@ -205,6 +217,10 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
|
||||
#ifdef NETWM_HINTS
|
||||
wNETWMUpdateDesktop(scr);
|
||||
#endif
|
||||
|
||||
WMPostNotificationName(WMNWorkspaceDestroyed, scr,
|
||||
(void*)(scr->workspace_count-1));
|
||||
|
||||
@@ -223,7 +239,6 @@ typedef struct WorkspaceNameData {
|
||||
} WorkspaceNameData;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
hideWorkspaceName(void *data)
|
||||
{
|
||||
@@ -246,8 +261,7 @@ hideWorkspaceName(void *data)
|
||||
Pixmap pix;
|
||||
|
||||
scr->workspace_name_timer =
|
||||
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkspaceName,
|
||||
scr);
|
||||
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkspaceName, scr);
|
||||
|
||||
RCombineImagesWithOpaqueness(img, scr->workspace_name_data->text,
|
||||
scr->workspace_name_data->count*255/10);
|
||||
@@ -266,7 +280,6 @@ hideWorkspaceName(void *data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
showWorkspaceName(WScreen *scr, int workspace)
|
||||
{
|
||||
@@ -279,9 +292,10 @@ showWorkspaceName(WScreen *scr, int workspace)
|
||||
int len = strlen(name);
|
||||
int x, y;
|
||||
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE
|
||||
|| scr->workspace_count < 2)
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE ||
|
||||
scr->workspace_count < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scr->workspace_name_timer) {
|
||||
WMDeleteTimerHandler(scr->workspace_name_timer);
|
||||
@@ -298,6 +312,7 @@ showWorkspaceName(WScreen *scr, int workspace)
|
||||
}
|
||||
|
||||
data = wmalloc(sizeof(WorkspaceNameData));
|
||||
data->back = NULL;
|
||||
|
||||
w = WMWidthOfString(scr->workspace_name_font, name, len);
|
||||
h = WMFontHeight(scr->workspace_name_font);
|
||||
@@ -452,25 +467,23 @@ wWorkspaceRelativeChange(WScreen *scr, int amount)
|
||||
w = scr->current_workspace + amount;
|
||||
|
||||
if (amount < 0) {
|
||||
|
||||
if (w >= 0)
|
||||
if (w >= 0) {
|
||||
wWorkspaceChange(scr, w);
|
||||
else if (wPreferences.ws_cycle)
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWorkspaceChange(scr, scr->workspace_count + w);
|
||||
|
||||
}
|
||||
} else if (amount > 0) {
|
||||
|
||||
if (w < scr->workspace_count)
|
||||
if (w < scr->workspace_count) {
|
||||
wWorkspaceChange(scr, w);
|
||||
else if (wPreferences.ws_advance)
|
||||
} else if (wPreferences.ws_advance) {
|
||||
wWorkspaceChange(scr, WMIN(w, MAX_WORKSPACES-1));
|
||||
else if (wPreferences.ws_cycle)
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWorkspaceChange(scr, w % scr->workspace_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
{
|
||||
@@ -494,29 +507,24 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
|
||||
if ((tmp = scr->focused_window)!= NULL) {
|
||||
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded)
|
||||
&& !WFLAGP(tmp, no_focusable))
|
||||
|| tmp->flags.changing_workspace) {
|
||||
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
|
||||
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
|
||||
foc = tmp;
|
||||
}
|
||||
|
||||
/* foc2 = tmp; will fix annoyance with gnome panel
|
||||
* but will create annoyance for every other application
|
||||
*/
|
||||
|
||||
while (tmp) {
|
||||
if (tmp->frame->workspace!=workspace && !tmp->flags.selected) {
|
||||
/* unmap windows not on this workspace */
|
||||
if ((tmp->flags.mapped||tmp->flags.shaded)
|
||||
&& !IS_OMNIPRESENT(tmp)
|
||||
&& !tmp->flags.changing_workspace) {
|
||||
|
||||
if ((tmp->flags.mapped||tmp->flags.shaded) &&
|
||||
!IS_OMNIPRESENT(tmp) && !tmp->flags.changing_workspace) {
|
||||
wWindowUnmap(tmp);
|
||||
}
|
||||
/* also unmap miniwindows not on this workspace */
|
||||
if (!wPreferences.sticky_icons && tmp->flags.miniaturized &&
|
||||
tmp->icon && !IS_OMNIPRESENT(tmp)) {
|
||||
|
||||
XUnmapWindow(dpy, tmp->icon->core->window);
|
||||
tmp->icon->mapped = 0;
|
||||
}
|
||||
@@ -529,9 +537,10 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
if (wapp) {
|
||||
wapp->last_workspace = workspace;
|
||||
}
|
||||
if (!foc2 && (tmp->flags.mapped || tmp->flags.shaded))
|
||||
if (!foc2 && (tmp->flags.mapped || tmp->flags.shaded)) {
|
||||
foc2 = tmp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* change selected windows' workspace */
|
||||
if (tmp->flags.selected) {
|
||||
@@ -544,9 +553,10 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
if (!(tmp->flags.mapped || tmp->flags.miniaturized)) {
|
||||
/* remap windows that are on this workspace */
|
||||
wWindowMap(tmp);
|
||||
if (!foc && !WFLAGP(tmp, no_focusable))
|
||||
if (!foc && !WFLAGP(tmp, no_focusable)) {
|
||||
foc = tmp;
|
||||
}
|
||||
}
|
||||
/* Also map miniwindow if not omnipresent */
|
||||
if (!wPreferences.sticky_icons &&
|
||||
tmp->flags.miniaturized &&
|
||||
@@ -560,6 +570,16 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
tmp = tmp->prev;
|
||||
}
|
||||
|
||||
/* Gobble up events unleashed by our mapping & unmapping.
|
||||
* These may trigger various grab-initiated focus &
|
||||
* crossing events. However, we don't care about them,
|
||||
* and ignore their focus implications altogether to avoid
|
||||
* flicker.
|
||||
*/
|
||||
scr->flags.ignore_focus_events = 1;
|
||||
ProcessPendingEvents();
|
||||
scr->flags.ignore_focus_events = 0;
|
||||
|
||||
if (!foc)
|
||||
foc = foc2;
|
||||
|
||||
@@ -579,6 +599,12 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
&foo, &foo, &foo, &foo, &mask)) {
|
||||
tmp = wWindowFor(win);
|
||||
}
|
||||
|
||||
/* If there's a window under the pointer, focus it.
|
||||
* (we ate all other focus events above, so it's
|
||||
* certainly not focused). Otherwise focus last
|
||||
* focused, or the root (depending on sloppiness)
|
||||
*/
|
||||
if (!tmp && wPreferences.focus_mode == WKF_SLOPPY) {
|
||||
wSetFocusTo(scr, foc);
|
||||
} else {
|
||||
@@ -609,9 +635,12 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KWM_HINTS
|
||||
#if defined KWM_HINTS || defined NETWM_HINTS
|
||||
wScreenUpdateUsableArea(scr);
|
||||
#endif
|
||||
#ifdef NETWM_HINTS
|
||||
wNETWMUpdateDesktop(scr);
|
||||
#endif
|
||||
|
||||
showWorkspaceName(scr, workspace);
|
||||
|
||||
@@ -620,23 +649,320 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
/* XSync(dpy, False); */
|
||||
}
|
||||
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
|
||||
/* TODO:
|
||||
* 1) Allow border around each window so the scrolling
|
||||
* won't just stop at the border.
|
||||
* 2) Make pager.
|
||||
*/
|
||||
*
|
||||
* 1) Allow border around each window so the scrolling
|
||||
* won't just stop at the border.
|
||||
* 2) Make pager.
|
||||
*
|
||||
*/
|
||||
|
||||
#define vec_sub(a, b) wmkpoint((a).x-(b).x, (a).y-(b).y)
|
||||
#define vec_add(a, b) wmkpoint((a).x+(b).x, (a).y+(b).y)
|
||||
#define vec_inc(a, b) do { (a).x+=(b).x; (a).y+=(b).y; } while(0)
|
||||
#define vec_dot(a, b) ((a).x*(b).x + (a).y*(b).y)
|
||||
#define vec_scale(a, s) wmkpoint((a).x*s, (a).y*s)
|
||||
#define vec_scale2(a, s, t) wmkpoint((a).x*s, (a).y*t)
|
||||
|
||||
#ifndef HAS_BORDER
|
||||
#define HAS_BORDER(w) (!(WFLAGP((w), no_border)))
|
||||
#endif
|
||||
|
||||
#ifndef IS_VSTUCK
|
||||
#define IS_VSTUCK(w) (WFLAGP((w), virtual_stick))
|
||||
#endif
|
||||
|
||||
#define updateMinimum(l,p,ml,mp) do { if (cmp(l) && (l)<(ml)) { (ml)=(l); (mp)=(p); }; } while(0)
|
||||
|
||||
static Bool cmp_gez(int i) { return (i >= 0); }
|
||||
|
||||
static Bool cmp_gz(int i) { return (i > 0); }
|
||||
|
||||
|
||||
static WMPoint
|
||||
getClosestEdge(WScreen * scr, WMPoint direction, Bool (*cmp)(int))
|
||||
{
|
||||
WMPoint closest = wmkpoint(0, 0);
|
||||
int closest_len = INT_MAX;
|
||||
WWindow * wwin;
|
||||
|
||||
for (wwin=scr->focused_window; wwin; wwin=wwin->prev) {
|
||||
if (wwin->frame->workspace == scr->current_workspace) {
|
||||
if (!wwin->flags.miniaturized &&
|
||||
!IS_VSTUCK(wwin) &&
|
||||
!wwin->flags.hidden) {
|
||||
int border = 2*HAS_BORDER(wwin);
|
||||
int len;
|
||||
int x1,x2,y1,y2;
|
||||
int head = wGetHeadForWindow(wwin);
|
||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||
WMPoint p;
|
||||
|
||||
x1 = wwin->frame_x - area.x1;
|
||||
y1 = wwin->frame_y - area.y1;
|
||||
x2 = wwin->frame_x + wwin->frame->core->width + border - area.x2;
|
||||
y2 = wwin->frame_y + wwin->frame->core->height + border - area.y2;
|
||||
|
||||
p = wmkpoint(x1,y1);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x1,y2);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x2,y1);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x2,y2);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction)
|
||||
{
|
||||
int x, y;
|
||||
WMPoint edge = getClosestEdge(scr, direction, cmp_gz);
|
||||
int len = vec_dot(edge, direction);
|
||||
WMPoint step = vec_scale(direction, len);
|
||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x+step.x, y+step.y);
|
||||
}
|
||||
|
||||
|
||||
extern Cursor wCursor[WCUR_LAST];
|
||||
|
||||
|
||||
static void
|
||||
vdMouseMoveDesktop(XEvent *event, WMPoint direction)
|
||||
{
|
||||
static int lock = False;
|
||||
if (lock) return;
|
||||
lock = True;
|
||||
|
||||
Bool done = False;
|
||||
Bool moved = True;
|
||||
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
||||
WMPoint old_pos = wmkpoint(event->xcrossing.x_root, event->xcrossing.y_root);
|
||||
WMPoint step;
|
||||
int x, y;
|
||||
int resisted = 0;
|
||||
|
||||
if (XGrabPointer(dpy, event->xcrossing.window, False,
|
||||
PointerMotionMask, GrabModeAsync, GrabModeAsync,
|
||||
scr->root_win, wCursor[WCUR_EMPTY],
|
||||
CurrentTime) != GrabSuccess) {
|
||||
|
||||
/* if the grab fails, do it the old fashioned way */
|
||||
step = vec_scale2(direction, wPreferences.vedge_hscrollspeed,
|
||||
wPreferences.vedge_vscrollspeed);
|
||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
if (wWorkspaceSetViewPort(scr, scr->current_workspace,
|
||||
x+step.x, y+step.y)) {
|
||||
step = vec_scale(direction, wPreferences.vedge_thickness + 1);
|
||||
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0,
|
||||
event->xcrossing.x_root - step.x,
|
||||
event->xcrossing.y_root - step.y);
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
XSync(dpy, True);
|
||||
|
||||
if (old_pos.x < 0)
|
||||
old_pos.x = 0;
|
||||
if (old_pos.y < 0)
|
||||
old_pos.y = 0;
|
||||
if (old_pos.x > scr->scr_width)
|
||||
old_pos.x = scr->scr_width;
|
||||
if (old_pos.y > scr->scr_height)
|
||||
old_pos.y = scr->scr_height;
|
||||
|
||||
while (!done) {
|
||||
XEvent ev;
|
||||
if (moved) {
|
||||
XWarpPointer(dpy, None, scr->root_win, 0, 0, 0, 0,
|
||||
scr->scr_width/2, scr->scr_height/2);
|
||||
moved = False;
|
||||
}
|
||||
WMMaskEvent(dpy, PointerMotionMask, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case MotionNotify:
|
||||
{
|
||||
int step_len;
|
||||
step = wmkpoint(ev.xmotion.x_root-scr->scr_width/2,
|
||||
ev.xmotion.y_root-scr->scr_height/2);
|
||||
step_len = vec_dot(step, direction);
|
||||
if (step_len < 0) {
|
||||
done = True;
|
||||
break;
|
||||
}
|
||||
|
||||
if (step_len > 0) {
|
||||
Bool do_move = True;
|
||||
int resist = wPreferences.vedge_resistance;
|
||||
WMPoint closest;
|
||||
int closest_len = INT_MAX;
|
||||
if (resist) {
|
||||
closest = getClosestEdge(scr, direction, cmp_gez);
|
||||
closest_len = vec_dot(direction, closest);
|
||||
}
|
||||
|
||||
if (!closest_len) {
|
||||
resisted += step_len;
|
||||
do_move = resisted >= resist;
|
||||
if (do_move) {
|
||||
closest_len = INT_MAX;
|
||||
step_len = resisted - resist;
|
||||
resisted = 0;
|
||||
}
|
||||
}
|
||||
if (do_move) {
|
||||
if (closest_len <= wPreferences.vedge_attraction) {
|
||||
step = vec_scale(direction, closest_len);
|
||||
} else {
|
||||
step = vec_scale(direction, step_len);
|
||||
}
|
||||
|
||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewPort(scr, scr->current_workspace,
|
||||
x+step.x, y+step.y);
|
||||
moved = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
step = vec_add(old_pos, vec_scale(direction, -1));
|
||||
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, step.x, step.y);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
|
||||
exit:
|
||||
lock = False;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vdHandleEnter_u(XEvent *event) {
|
||||
vdMouseMoveDesktop(event, VEC_UP);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vdHandleEnter_d(XEvent *event) {
|
||||
vdMouseMoveDesktop(event, VEC_DOWN);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vdHandleEnter_l(XEvent *event) {
|
||||
vdMouseMoveDesktop(event, VEC_LEFT);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vdHandleEnter_r(XEvent *event) {
|
||||
vdMouseMoveDesktop(event, VEC_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
wWorkspaceMapEdge(WScreen *scr)
|
||||
{
|
||||
int i;
|
||||
if (wPreferences.vedge_thickness && initVDesk) {
|
||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||
XMapWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
wWorkspaceUnmapEdge(WScreen *scr)
|
||||
{
|
||||
int i;
|
||||
if (wPreferences.vedge_thickness && initVDesk) {
|
||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||
XUnmapWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define LEFT_EDGE 0x01
|
||||
#define RIGHT_EDGE 0x02
|
||||
#define TOP_EDGE 0x04
|
||||
#define BOTTOM_EDGE 0x08
|
||||
#define ALL_EDGES 0x0F
|
||||
|
||||
void
|
||||
wWorkspaceManageEdge(WScreen *scr)
|
||||
{
|
||||
int w;
|
||||
if (!initVDesk && wPreferences.vedge_thickness) {
|
||||
int i, j, w;
|
||||
int vmask;
|
||||
XSetWindowAttributes attribs;
|
||||
|
||||
/* puts("wWorkspaceManageEdge()"); */
|
||||
if (wPreferences.vedge_thickness) {
|
||||
int heads = wXineramaHeads(scr);
|
||||
int *hasEdges = (int*)wmalloc(sizeof(int)*heads);
|
||||
|
||||
int thickness = wPreferences.vedge_thickness;
|
||||
int nr_edges = 0;
|
||||
int max_edges = 4*heads;
|
||||
int head;
|
||||
Window * edges = (Window *)wmalloc(sizeof(Window)*max_edges);
|
||||
|
||||
initVDesk = True;
|
||||
|
||||
for (i=0; i<heads; ++i)
|
||||
hasEdges[i] = ALL_EDGES;
|
||||
for (i=0; i<heads; ++i) {
|
||||
WMRect i_rect = wGetRectForHead(scr, i);
|
||||
for (j=i+1; j<heads; ++j) {
|
||||
WMRect j_rect = wGetRectForHead(scr, j);
|
||||
|
||||
int vlen = (WMIN(i_rect.pos.y + i_rect.size.height,
|
||||
j_rect.pos.y + j_rect.size.height) -
|
||||
WMAX(i_rect.pos.y, j_rect.pos.y));
|
||||
|
||||
int hlen = (WMIN(i_rect.pos.x + i_rect.size.width,
|
||||
j_rect.pos.x + j_rect.size.width) -
|
||||
WMAX( i_rect.pos.x, j_rect.pos.x));
|
||||
|
||||
if (vlen > 0 && hlen == 0) { /* horz alignment, vert edges touch */
|
||||
if (i_rect.pos.x < j_rect.pos.x) { /* i left of j */
|
||||
hasEdges[i] &= ~RIGHT_EDGE;
|
||||
hasEdges[j] &= ~LEFT_EDGE;
|
||||
} else { /* j left of i */
|
||||
hasEdges[j] &= ~RIGHT_EDGE;
|
||||
hasEdges[i] &= ~LEFT_EDGE;
|
||||
}
|
||||
} else if (vlen == 0 && hlen > 0) { /* vert alignment, horz edges touch */
|
||||
if (i_rect.pos.y < j_rect.pos.y) { /* i top of j */
|
||||
hasEdges[i] &= ~BOTTOM_EDGE;
|
||||
hasEdges[j] &= ~TOP_EDGE;
|
||||
} else { /* j top of i */
|
||||
hasEdges[j] &= ~BOTTOM_EDGE;
|
||||
hasEdges[i] &= ~TOP_EDGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (w = 0; w < scr->workspace_count; w++) {
|
||||
/* puts("reset workspace"); */
|
||||
wWorkspaceSetViewPort(scr, w, 0, 0);
|
||||
@@ -645,93 +971,202 @@ wWorkspaceManageEdge(WScreen *scr)
|
||||
vmask = CWEventMask|CWOverrideRedirect;
|
||||
attribs.event_mask = (EnterWindowMask | LeaveWindowMask | VisibilityChangeMask);
|
||||
attribs.override_redirect = True;
|
||||
scr->virtual_edge_u =
|
||||
XCreateWindow(dpy, scr->root_win, 0, 0,
|
||||
scr->scr_width, wPreferences.vedge_thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
scr->virtual_edge_d =
|
||||
XCreateWindow(dpy, scr->root_win, 0, scr->scr_height-wPreferences.vedge_thickness,
|
||||
scr->scr_width, wPreferences.vedge_thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
scr->virtual_edge_l =
|
||||
XCreateWindow(dpy, scr->root_win, 0, 0,
|
||||
wPreferences.vedge_thickness, scr->scr_height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
scr->virtual_edge_r =
|
||||
XCreateWindow(dpy, scr->root_win, scr->scr_width-wPreferences.vedge_thickness, 0,
|
||||
wPreferences.vedge_thickness, scr->scr_height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
XMapWindow(dpy, scr->virtual_edge_u);
|
||||
XMapWindow(dpy, scr->virtual_edge_d);
|
||||
XMapWindow(dpy, scr->virtual_edge_l);
|
||||
XMapWindow(dpy, scr->virtual_edge_r);
|
||||
|
||||
for (head=0; head<wXineramaHeads(scr); ++head) {
|
||||
WMRect rect = wGetRectForHead(scr, head);
|
||||
|
||||
if (hasEdges[head] & TOP_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x, rect.pos.y,
|
||||
rect.size.width, thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent,
|
||||
vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext,
|
||||
(XPointer)vdHandleEnter_u);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & BOTTOM_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x,
|
||||
rect.pos.y+rect.size.height-thickness,
|
||||
rect.size.width, thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent,
|
||||
vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext,
|
||||
(XPointer)vdHandleEnter_d);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & LEFT_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x, rect.pos.y,
|
||||
thickness, rect.pos.y+rect.size.height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent,
|
||||
vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext,
|
||||
(XPointer)vdHandleEnter_l);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & RIGHT_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win,
|
||||
rect.pos.x + rect.size.width - thickness, rect.pos.y,
|
||||
thickness, rect.size.height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask,
|
||||
&attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext,
|
||||
(XPointer)vdHandleEnter_r);
|
||||
++nr_edges;
|
||||
}
|
||||
}
|
||||
|
||||
scr->virtual_nr_edges = nr_edges;
|
||||
scr->virtual_edges = edges;
|
||||
|
||||
wWorkspaceMapEdge(scr);
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
|
||||
wfree(hasEdges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceUpdateEdge(WScreen *scr)
|
||||
{
|
||||
if (!initVDesk && wPreferences.vedge_thickness) {
|
||||
wWorkspaceManageEdge(scr);
|
||||
} else if (initVDesk) {
|
||||
if (wPreferences.vedge_thickness) {
|
||||
wWorkspaceMapEdge(scr);
|
||||
} else {
|
||||
wWorkspaceUnmapEdge(scr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceDestroyEdge(WScreen *scr)
|
||||
{
|
||||
if (!initVDesk) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||
XDeleteContext(dpy, scr->virtual_edges[i], wVEdgeContext);
|
||||
XDestroyWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
|
||||
wfree(scr->virtual_edges);
|
||||
scr->virtual_edges = NULL;
|
||||
scr->virtual_nr_edges = 0;
|
||||
|
||||
initVDesk = False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceRaiseEdge(WScreen *scr)
|
||||
{
|
||||
puts("raise edge");
|
||||
static int toggle = 0;
|
||||
int i;
|
||||
|
||||
if (wPreferences.vedge_thickness && initVDesk) {
|
||||
XRaiseWindow(dpy, scr->virtual_edge_u);
|
||||
XRaiseWindow(dpy, scr->virtual_edge_d);
|
||||
XRaiseWindow(dpy, scr->virtual_edge_l);
|
||||
XRaiseWindow(dpy, scr->virtual_edge_r);
|
||||
if (toggle) {
|
||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
} else {
|
||||
for (i=scr->virtual_nr_edges-1; i>=0; --i) {
|
||||
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
toggle ^= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wWorkspaceLowerEdge(WScreen *scr)
|
||||
{
|
||||
puts("lower edge");
|
||||
int i;
|
||||
if (wPreferences.vedge_thickness && initVDesk) {
|
||||
XLowerWindow(dpy, scr->virtual_edge_u);
|
||||
XLowerWindow(dpy, scr->virtual_edge_d);
|
||||
XLowerWindow(dpy, scr->virtual_edge_l);
|
||||
XLowerWindow(dpy, scr->virtual_edge_r);
|
||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||
XLowerWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height)
|
||||
wWorkspaceResizeViewPort(WScreen *scr, int workspace)
|
||||
{
|
||||
scr->workspaces[workspace]->width = WMAX(width,scr->scr_width);
|
||||
scr->workspaces[workspace]->height = WMAX(height,scr->scr_height);
|
||||
int x, y;
|
||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
updateWorkspaceGeometry(WScreen *scr, int workspace, int *view_x, int *view_y)
|
||||
{
|
||||
int most_left, most_right, most_top, most_bottom;
|
||||
WWindow *wwin;
|
||||
|
||||
int heads = wXineramaHeads(scr);
|
||||
typedef int strut_t[4];
|
||||
strut_t * strut = (strut_t*)wmalloc(heads*sizeof(strut_t));
|
||||
int head, i;
|
||||
|
||||
for (head=0; head<heads; ++head) {
|
||||
WMRect rect = wGetRectForHead(scr, head);
|
||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||
strut[head][0] = area.x1 - rect.pos.x;
|
||||
strut[head][1] = rect.pos.x + rect.size.width - area.x2;
|
||||
strut[head][2] = area.y1 - rect.pos.y;
|
||||
strut[head][3] = rect.pos.y + rect.size.height - area.y2;
|
||||
}
|
||||
|
||||
/* adjust workspace layout */
|
||||
wwin = scr->focused_window;
|
||||
most_right = scr->scr_width;
|
||||
most_bottom = scr->scr_height;
|
||||
most_left = 0;
|
||||
most_top = 0;
|
||||
most_right = 0;
|
||||
most_bottom = 0;
|
||||
most_left = scr->scr_width;
|
||||
most_top = scr->scr_height;
|
||||
for(;wwin; wwin = wwin->prev) {
|
||||
if (wwin->frame->workspace == workspace) {
|
||||
if (!wwin->flags.miniaturized
|
||||
&& !wwin->flags.hidden) {
|
||||
if (wwin->frame_x < most_left) { /* record positions, should this be cached? */
|
||||
most_left = wwin->frame_x;
|
||||
}
|
||||
if ((int)wwin->frame_x + (int)wwin->frame->core->width > most_right) {
|
||||
most_right = wwin->frame_x + wwin->frame->core->width;
|
||||
}
|
||||
if (wwin->frame_y < most_top) {
|
||||
most_top = wwin->frame_y;
|
||||
}
|
||||
if (wwin->frame_y + wwin->frame->core->height > most_bottom) {
|
||||
most_bottom = wwin->frame_y + wwin->frame->core->height;
|
||||
if (!wwin->flags.miniaturized && !IS_VSTUCK(wwin) &&
|
||||
!wwin->flags.hidden) {
|
||||
|
||||
head = wGetHeadForWindow(wwin);
|
||||
|
||||
i = wwin->frame_x - strut[head][0];
|
||||
if (i < most_left) /* record positions, should this be cached? */
|
||||
most_left = i;
|
||||
i = wwin->frame_x + wwin->frame->core->width + strut[head][1];
|
||||
if (HAS_BORDER(wwin))
|
||||
i+=2;
|
||||
if (i > most_right)
|
||||
most_right = i;
|
||||
i = wwin->frame_y - strut[head][2];
|
||||
if (i < most_top)
|
||||
most_top = i;
|
||||
i = wwin->frame_y + wwin->frame->core->height + strut[head][3];
|
||||
if (HAS_BORDER(wwin))
|
||||
i+=2;
|
||||
if (i > most_bottom) {
|
||||
most_bottom = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (most_left > 0) most_left = 0;
|
||||
if (most_top > 0) most_top = 0;
|
||||
|
||||
scr->workspaces[workspace]->width = WMAX(most_right, scr->scr_width) - WMIN(most_left, 0);
|
||||
scr->workspaces[workspace]->height = WMAX(most_bottom, scr->scr_height) - WMIN(most_top, 0);
|
||||
|
||||
@@ -741,6 +1176,7 @@ updateWorkspaceGeometry(WScreen *scr, int workspace, int *view_x, int *view_y)
|
||||
*view_y += -most_top - scr->workspaces[workspace]->view_y;
|
||||
scr->workspaces[workspace]->view_y = -most_top;
|
||||
|
||||
wfree(strut);
|
||||
}
|
||||
|
||||
|
||||
@@ -770,41 +1206,48 @@ wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
||||
Bool adjust_flag = False;
|
||||
int diff_x, diff_y;
|
||||
static _delay_configure delay_configure = {NULL, 0};
|
||||
WWorkspace *wptr;
|
||||
WWindow *wwin;
|
||||
|
||||
wptr = scr->workspaces[workspace];
|
||||
|
||||
/*printf("wWorkspaceSetViewPort %d %d\n", view_x, view_y);*/
|
||||
|
||||
updateWorkspaceGeometry(scr, workspace, &view_x, &view_y);
|
||||
|
||||
if (view_x + scr->scr_width > scr->workspaces[workspace]->width) {
|
||||
if (view_x + scr->scr_width > wptr->width) {
|
||||
/* puts("right edge of vdesk"); */
|
||||
view_x = scr->workspaces[workspace]->width - scr->scr_width;
|
||||
view_x = wptr->width - scr->scr_width;
|
||||
}
|
||||
if (view_x < 0) {
|
||||
/* puts("left edge of vdesk"); */
|
||||
view_x = 0;
|
||||
}
|
||||
if (view_y + scr->scr_height > scr->workspaces[workspace]->height) {
|
||||
if (view_y + scr->scr_height > wptr->height) {
|
||||
/* puts("right edge of vdesk"); */
|
||||
view_y = scr->workspaces[workspace]->height - scr->scr_height;
|
||||
view_y = wptr->height - scr->scr_height;
|
||||
}
|
||||
if (view_y < 0) {
|
||||
/* puts("left edge of vdesk"); */
|
||||
view_y = 0;
|
||||
}
|
||||
|
||||
diff_x = scr->workspaces[workspace]->view_x - view_x;
|
||||
diff_y = scr->workspaces[workspace]->view_y - view_y;
|
||||
diff_x = wptr->view_x - view_x;
|
||||
diff_y = wptr->view_y - view_y;
|
||||
if (!diff_x && !diff_y)
|
||||
return False;
|
||||
|
||||
scr->workspaces[workspace]->view_x = view_x;
|
||||
scr->workspaces[workspace]->view_y = view_y;
|
||||
wptr->view_x = view_x;
|
||||
wptr->view_y = view_y;
|
||||
|
||||
#ifdef NETWM_HINTS
|
||||
wNETWMUpdateDesktop(scr);
|
||||
#endif
|
||||
|
||||
for (wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
||||
if (wwin->frame->workspace == workspace) {
|
||||
if (wwin->frame->workspace == workspace && !IS_VSTUCK(wwin)) {
|
||||
wWindowMove(wwin, wwin->frame_x + diff_x, wwin->frame_y + diff_y);
|
||||
adjust_flag = True;
|
||||
}
|
||||
}
|
||||
if (1) { /* if delay*/
|
||||
@@ -818,15 +1261,14 @@ wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
||||
|
||||
|
||||
void
|
||||
wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y)
|
||||
wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *x, int *y)
|
||||
{
|
||||
if (view_x) *view_x = scr->workspaces[workspace]->view_x;
|
||||
if (view_y) *view_y = scr->workspaces[workspace]->view_y;
|
||||
*x = scr->workspaces[workspace]->view_x;
|
||||
*y = scr->workspaces[workspace]->view_y;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void
|
||||
switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
@@ -834,7 +1276,6 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
@@ -843,7 +1284,6 @@ deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
newWSCommand(WMenu *menu, WMenuEntry *foo)
|
||||
{
|
||||
|
||||
+10
-1
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
+5
-2
@@ -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)
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <WINGs/WINGs.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WMaker.h"
|
||||
#include "app.h"
|
||||
|
||||
+2
-1
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
+477
-415
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user