mirror of
https://github.com/gryf/wmaker.git
synced 2026-04-25 18:11:26 +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>)
|
(Marcelo E. Magallon <marcelo.magallon@bigfoot.com>)
|
||||||
- Do not use the disabled clip color for the clip's workspace navigation arrows
|
- 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)
|
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.
|
- Fixed bug with incorrect un-escaping if there is a dot in wm_class.
|
||||||
- Updated Catalan translations (Ernest Adrogue <eadrogue@gmx.net>)
|
- Updated Catalan translations (Ernest Adrogue <eadrogue@gmx.net>)
|
||||||
- Updated Spanish translation of WPrefs (Alberto Gimenez <algibe@teleline.es>)
|
- 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.
|
appicon when a KDE3 application opens a config panel.
|
||||||
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
|
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
|
||||||
- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)
|
- 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:
|
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:
|
Changes since version 0.80.0:
|
||||||
|
|||||||
@@ -61,4 +61,3 @@ sample implementation (twm?) it might be supported. Maybe dtwm supports
|
|||||||
it? I dont know...
|
it? I dont know...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,8 @@
|
|||||||
Changes since wmaker 0.80.1:
|
Changes since wmaker 0.80.1:
|
||||||
............................
|
............................
|
||||||
|
|
||||||
- added WMSetConnectionShutdownOnClose()
|
- Added WMSetConnectionShutdownOnClose()
|
||||||
- added an extra member to the ConnectionDelegate: canResumeSending
|
- Added an extra member to the ConnectionDelegate: canResumeSending
|
||||||
see NEWS for details.
|
see NEWS for details.
|
||||||
- WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
|
- WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
|
||||||
arguments. WMDrawImageString() receives 2 colors (text & background).
|
arguments. WMDrawImageString() receives 2 colors (text & background).
|
||||||
@@ -49,12 +49,13 @@ Changes since wmaker 0.80.1:
|
|||||||
- Fixed a memleak in the file panel.
|
- Fixed a memleak in the file panel.
|
||||||
- Double/triple-click selection in text widgets
|
- Double/triple-click selection in text widgets
|
||||||
(Vitaly Ovtchinnikov <ov@rbcmail.ru>)
|
(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>)
|
(Carlos Torres <vlaadbrain@operamail.com>)
|
||||||
- Fixed bug in resizing a scrollview
|
- Fixed bug in resizing a scrollview
|
||||||
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
|
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
|
||||||
- Added wmkrect()
|
- Added wmkrect()
|
||||||
- Added xdnd v3 support (Sylvain Reynal <sreynal@nerim.net>)
|
- Added xdnd v3 support (Sylvain Reynal <sreynal@nerim.net>)
|
||||||
|
- Fixed and enhanced text wrapping.
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.80.0:
|
Changes since wmaker 0.80.0:
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ int MoveCount;
|
|||||||
int WinSize = 120;
|
int WinSize = 120;
|
||||||
|
|
||||||
|
|
||||||
Bool CheckWin(void)
|
Bool
|
||||||
|
CheckWin(void)
|
||||||
{
|
{
|
||||||
int i;
|
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));
|
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 */
|
/* locate the button */
|
||||||
for (y = 0; y < Size; y++) {
|
for (y = 0; y < Size; y++) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ libExtraWINGs_a_SOURCES = \
|
|||||||
wtableview.h \
|
wtableview.h \
|
||||||
wtabledelegates.h
|
wtabledelegates.h
|
||||||
|
|
||||||
|
AM_CFLAGS = -fno-strict-aliasing
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||||
|
|||||||
+3
-1
@@ -108,7 +108,9 @@ libWUtil_a_SOURCES = \
|
|||||||
wutil.c
|
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 \
|
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG
|
-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)
|
resizedWindow(void *self, WMNotification *notif)
|
||||||
{
|
{
|
||||||
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
||||||
WMSize size = WMGetViewSize(view);
|
WMSize size = WMGetViewSize(view);
|
||||||
|
|
||||||
WMResizeWidget((WMWidget*)self, size.width, size.height);
|
WMResizeWidget((WMWidget*)self, size.width, size.height);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void
|
void
|
||||||
testBox(WMScreen *scr)
|
testBox(WMScreen *scr)
|
||||||
@@ -609,7 +609,8 @@ testText(WMScreen *scr)
|
|||||||
WMFont *font, *ifont;
|
WMFont *font, *ifont;
|
||||||
|
|
||||||
font = WMDefaultSystemFont(scr);
|
font = WMDefaultSystemFont(scr);
|
||||||
ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
|
//ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
|
||||||
|
ifont = WMCreateFont(scr, "verdana,sans:pixelsize=12:italic");
|
||||||
if (ifont) {
|
if (ifont) {
|
||||||
WMSetTextDefaultFont(text, ifont);
|
WMSetTextDefaultFont(text, ifont);
|
||||||
WMReleaseFont(ifont);
|
WMReleaseFont(ifont);
|
||||||
@@ -619,7 +620,7 @@ testText(WMScreen *scr)
|
|||||||
WMReleaseFont(font);
|
WMReleaseFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file) {
|
if (file) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
WMFreezeText(text);
|
WMFreezeText(text);
|
||||||
@@ -1042,6 +1043,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
testColorPanel(scr);
|
testColorPanel(scr);
|
||||||
|
|
||||||
|
testFrame(scr);
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
testBox(scr);
|
testBox(scr);
|
||||||
|
|||||||
+3
-4
@@ -1834,12 +1834,11 @@ void WMShowFontPanel(WMFontPanel *panel);
|
|||||||
|
|
||||||
void WMHideFontPanel(WMFontPanel *panel);
|
void WMHideFontPanel(WMFontPanel *panel);
|
||||||
|
|
||||||
|
void WMFreeFontPanel(WMFontPanel *panel);
|
||||||
|
|
||||||
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
||||||
|
|
||||||
void WMSetFontPanelFont(WMFontPanel *panel, WMFont *font);
|
void WMSetFontPanelFont(WMFontPanel *panel, char *fontName);
|
||||||
|
|
||||||
/* you can free the returned string */
|
|
||||||
char* WMGetFontPanelFontName(WMFontPanel *panel);
|
|
||||||
|
|
||||||
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
||||||
|
|
||||||
|
|||||||
@@ -22,18 +22,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#define DOUBLE_BUFFER
|
|
||||||
|
|
||||||
|
|
||||||
|
#define DOUBLE_BUFFER 1
|
||||||
|
|
||||||
#define WC_UserWidget 128
|
#define WC_UserWidget 128
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SCROLLER_WIDTH 20
|
#define SCROLLER_WIDTH 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define XDND_VERSION 4
|
#define XDND_VERSION 4
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ _WINGsConfiguration WINGsConfiguration;
|
|||||||
|
|
||||||
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
|
#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"
|
#define FLOPPY_PATH "/floppy"
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +41,7 @@ getButtonWithName(const char *name, unsigned defaultButton)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fix this
|
||||||
static Bool
|
static Bool
|
||||||
missingOrInvalidXLFD(char *xlfd)
|
missingOrInvalidXLFD(char *xlfd)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-2
@@ -193,14 +193,15 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
|||||||
WMDraggingInfo *info = &scr->dragInfo;
|
WMDraggingInfo *info = &scr->dragInfo;
|
||||||
Atom messageType = event->message_type;
|
Atom messageType = event->message_type;
|
||||||
|
|
||||||
char* msgTypeName = XGetAtomName(scr->display, messageType);
|
|
||||||
|
|
||||||
#ifdef XDND_DEBUG
|
#ifdef XDND_DEBUG
|
||||||
|
{
|
||||||
|
char* msgTypeName = XGetAtomName(scr->display, messageType);
|
||||||
|
|
||||||
if (msgTypeName != NULL)
|
if (msgTypeName != NULL)
|
||||||
printf("event type = %s\n", msgTypeName);
|
printf("event type = %s\n", msgTypeName);
|
||||||
else
|
else
|
||||||
printf("pb with event type !\n");
|
printf("pb with event type !\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ createDropDataArray(WMArray *requiredTypes)
|
|||||||
static WMArray*
|
static WMArray*
|
||||||
getTypesFromTypeList(WMScreen *scr, Window sourceWin)
|
getTypesFromTypeList(WMScreen *scr, Window sourceWin)
|
||||||
{
|
{
|
||||||
WMDraggingInfo *info = &scr->dragInfo;
|
/* // WMDraggingInfo *info = &scr->dragInfo;*/
|
||||||
Atom dataType;
|
Atom dataType;
|
||||||
Atom* typeAtomList;
|
Atom* typeAtomList;
|
||||||
WMArray* typeList;
|
WMArray* typeList;
|
||||||
@@ -365,7 +365,6 @@ W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info,
|
|||||||
WMView *toplevel, XClientMessageEvent *event)
|
WMView *toplevel, XClientMessageEvent *event)
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
||||||
int i,j, typesCount;
|
|
||||||
|
|
||||||
if (XDND_DEST_INFO(info) == NULL)
|
if (XDND_DEST_INFO(info) == NULL)
|
||||||
initDestinationDragInfo(info);
|
initDestinationDragInfo(info);
|
||||||
@@ -609,7 +608,7 @@ static void
|
|||||||
sendAllowedAction(WMView *destView, Atom action)
|
sendAllowedAction(WMView *destView, Atom action)
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(destView);
|
WMScreen *scr = W_VIEW_SCREEN(destView);
|
||||||
WMPoint destPos = WMGetViewScreenPosition(destView);
|
/* // WMPoint destPos = WMGetViewScreenPosition(destView); */
|
||||||
WMSize destSize = WMGetViewSize(destView);
|
WMSize destSize = WMGetViewSize(destView);
|
||||||
int destX, destY;
|
int destX, destY;
|
||||||
Window foo;
|
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
|
static Bool
|
||||||
sendPositionMessage(WMDraggingInfo *info, WMPoint *mousePos)
|
sendPositionMessage(WMDraggingInfo *info, WMPoint *mousePos)
|
||||||
{
|
{
|
||||||
@@ -740,7 +742,6 @@ isXdndAware(WMScreen *scr, Window win)
|
|||||||
int format;
|
int format;
|
||||||
unsigned long count, remain;
|
unsigned long count, remain;
|
||||||
unsigned char *winXdndVersion;
|
unsigned char *winXdndVersion;
|
||||||
unsigned char *proxy;
|
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return False;
|
return False;
|
||||||
@@ -876,7 +877,7 @@ initMotionProcess(WMView *view, WMDraggingInfo *info,
|
|||||||
static void
|
static void
|
||||||
processMotion(WMDraggingInfo *info, Window windowUnderDrag, WMPoint *mousePos)
|
processMotion(WMDraggingInfo *info, Window windowUnderDrag, WMPoint *mousePos)
|
||||||
{
|
{
|
||||||
WMScreen *scr = sourceScreen(info);
|
/* // WMScreen *scr = sourceScreen(info); */
|
||||||
Window newDestination = findDestination(info, mousePos);
|
Window newDestination = findDestination(info, mousePos);
|
||||||
|
|
||||||
W_DragSourceStopTimer();
|
W_DragSourceStopTimer();
|
||||||
@@ -1058,6 +1059,7 @@ traceStatusMsg(Display *dpy, XClientMessageEvent *statusEvent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
storeDropAction(WMDraggingInfo *info, Atom destAction)
|
storeDropAction(WMDraggingInfo *info, Atom destAction)
|
||||||
{
|
{
|
||||||
WMView* sourceView = XDND_SOURCE_VIEW(info);
|
WMView* sourceView = XDND_SOURCE_VIEW(info);
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ class WMTimer:
|
|||||||
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
|
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
|
||||||
else:
|
else:
|
||||||
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
|
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
|
||||||
|
self.__WMDeleteTimerHandler = wings.pyWMDeleteTimerHandler
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
wings.pyWMDeleteTimerHandler(self._o)
|
self.__WMDeleteTimerHandler(self._o)
|
||||||
#delete = __del__
|
|
||||||
|
|
||||||
class WMPersistentTimer(WMTimer):
|
class WMPersistentTimer(WMTimer):
|
||||||
def __init__(self, milliseconds, callback, cdata=None):
|
def __init__(self, milliseconds, callback, cdata=None):
|
||||||
@@ -87,13 +88,14 @@ class WMView:
|
|||||||
|
|
||||||
class WMWidget(WMView):
|
class WMWidget(WMView):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._o = None
|
|
||||||
if self.__class__ == WMWidget:
|
if self.__class__ == WMWidget:
|
||||||
raise Error, "a WMWidget can't be instantiated directly"
|
raise Error, "a WMWidget can't be instantiated directly"
|
||||||
|
self._o = None
|
||||||
|
self.__WMDestroyWidget = wings.WMDestroyWidget
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if (self._o != None):
|
if self._o is not None:
|
||||||
wings.WMDestroyWidget(self._o)
|
self.__WMDestroyWidget(self._o)
|
||||||
|
|
||||||
def resize(self, width, height):
|
def resize(self, width, height):
|
||||||
wings.WMResizeWidget(self._o, width, height)
|
wings.WMResizeWidget(self._o, width, height)
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ WMGetStandardUserDefaults(void)
|
|||||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||||
|
|
||||||
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
|
defaults->defaults = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
defaults->searchList = wmalloc(sizeof(WMPropList*)*3);
|
defaults->searchList = wmalloc(sizeof(WMPropList*)*3);
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ WMGetStandardUserDefaults(void)
|
|||||||
domain = WMReadPropListFromFile(path);
|
domain = WMReadPropListFromFile(path);
|
||||||
|
|
||||||
if (!domain)
|
if (!domain)
|
||||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
domain = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
wfree(path);
|
wfree(path);
|
||||||
@@ -314,7 +314,7 @@ WMGetStandardUserDefaults(void)
|
|||||||
wfree(path);
|
wfree(path);
|
||||||
|
|
||||||
if (!domain)
|
if (!domain)
|
||||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
domain = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
WMPutInPLDictionary(defaults->defaults, key, domain);
|
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||||
@@ -367,7 +367,7 @@ WMGetDefaultsFromPath(char *path)
|
|||||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||||
|
|
||||||
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
|
defaults->defaults = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
defaults->searchList = wmalloc(sizeof(WMPropList*)*2);
|
defaults->searchList = wmalloc(sizeof(WMPropList*)*2);
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ WMGetDefaultsFromPath(char *path)
|
|||||||
domain = WMReadPropListFromFile(path);
|
domain = WMReadPropListFromFile(path);
|
||||||
|
|
||||||
if (!domain)
|
if (!domain)
|
||||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
domain = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
defaults->path = wstrdup(path);
|
defaults->path = wstrdup(path);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ static WMEventHook *extraEventHandler=NULL;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||||
void *clientData)
|
void *clientData)
|
||||||
{
|
{
|
||||||
W_EventHandler *hPtr;
|
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 <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef XFT
|
||||||
|
#include <X11/Xft/Xft.h>
|
||||||
|
#include <fontconfig/fontconfig.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* XXX TODO */
|
/* 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);
|
static void arrangeLowerFrame(FontPanel *panel);
|
||||||
|
|
||||||
@@ -174,7 +181,7 @@ setClickedAction(WMWidget *w, void *data)
|
|||||||
static void
|
static void
|
||||||
revertClickedAction(WMWidget *w, void *data)
|
revertClickedAction(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
FontPanel *panel = (FontPanel*)data;
|
/*FontPanel *panel = (FontPanel*)data;*/
|
||||||
/* XXX TODO */
|
/* XXX TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +203,8 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
memset(panel, 0, sizeof(FontPanel));
|
memset(panel, 0, sizeof(FontPanel));
|
||||||
|
|
||||||
panel->win = WMCreateWindow(scr, "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);
|
WMResizeWidget(panel->win, DEF_WIDTH, DEF_HEIGHT);
|
||||||
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
|
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
|
||||||
@@ -213,7 +221,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
WMSetFrameRelief(panel->upperF, WRFlat);
|
WMSetFrameRelief(panel->upperF, WRFlat);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
|
||||||
panel->lowerF = WMCreateFrame(panel->win);
|
panel->lowerF = WMCreateFrame(panel->win);
|
||||||
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
||||||
WMSetFrameRelief(panel->lowerF, WRFlat);
|
WMSetFrameRelief(panel->lowerF, WRFlat);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
|
||||||
|
|
||||||
@@ -232,7 +240,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
panel->sampleT = WMCreateTextField(panel->upperF);
|
panel->sampleT = WMCreateTextField(panel->upperF);
|
||||||
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
|
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
|
||||||
WMMoveWidget(panel->sampleT, 10, 10);
|
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);
|
font = WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
|
||||||
@@ -267,7 +275,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
WMSetLabelTextAlignment(panel->sizL, WACenter);
|
WMSetLabelTextAlignment(panel->sizL, WACenter);
|
||||||
|
|
||||||
panel->sizT = WMCreateTextField(panel->lowerF);
|
panel->sizT = WMCreateTextField(panel->lowerF);
|
||||||
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
||||||
|
|
||||||
panel->sizLs = WMCreateList(panel->lowerF);
|
panel->sizLs = WMCreateList(panel->lowerF);
|
||||||
WMSetListAction(panel->sizLs, sizeClick, panel);
|
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*
|
WMFont*
|
||||||
WMGetFontPanelFont(WMFontPanel *panel)
|
WMGetFontPanelFont(WMFontPanel *panel)
|
||||||
{
|
{
|
||||||
@@ -371,18 +364,37 @@ WMGetFontPanelFont(WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
void
|
||||||
WMGetFontPanelFontName(WMFontPanel *panel)
|
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
|
void
|
||||||
WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data)
|
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
|
static Bool
|
||||||
parseFont(char *font, char values[NUM_FIELDS][256])
|
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 {
|
typedef struct {
|
||||||
@@ -531,6 +543,18 @@ typedef struct {
|
|||||||
|
|
||||||
WMArray *typefaces;
|
WMArray *typefaces;
|
||||||
} Family;
|
} 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
|
static void
|
||||||
|
#ifdef XFT
|
||||||
|
addSizeToTypeface(Xft_Typeface *face, int size)
|
||||||
|
#else
|
||||||
addSizeToTypeface(Typeface *face, int size)
|
addSizeToTypeface(Typeface *face, int size)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
int j;
|
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
|
static void
|
||||||
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||||
@@ -615,7 +670,7 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
|||||||
|
|
||||||
WMAddToArray(family->typefaces, face);
|
WMAddToArray(family->typefaces, face);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* families (same family name) (Hashtable of family -> array)
|
* 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
|
static void
|
||||||
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
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);
|
WMHashInsert(families, fam->name, family);
|
||||||
}
|
}
|
||||||
|
#endif /* XFT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
listFamilies(WMScreen *scr, WMFontPanel *panel)
|
listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||||
{
|
{
|
||||||
|
#ifdef XFT
|
||||||
|
FcObjectSet *os = 0;
|
||||||
|
FcFontSet *fs;
|
||||||
|
FcPattern *pat;
|
||||||
|
#else /* XFT */
|
||||||
char **fontList;
|
char **fontList;
|
||||||
WMHashTable *families;
|
|
||||||
char fields[NUM_FIELDS][256];
|
char fields[NUM_FIELDS][256];
|
||||||
|
int count;
|
||||||
|
#endif /* XFT */
|
||||||
|
WMHashTable *families;
|
||||||
WMHashEnumerator enumer;
|
WMHashEnumerator enumer;
|
||||||
WMArray *array;
|
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,
|
fontList = XListFonts(scr->display, ALL_FONTS_MASK, MAX_FONTS_TO_RETRIEVE,
|
||||||
&count);
|
&count);
|
||||||
if (!fontList) {
|
if (!fontList) {
|
||||||
@@ -751,9 +859,23 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
_("Could not retrieve font list"), _("OK"), NULL, NULL);
|
_("Could not retrieve font list"), _("OK"), NULL, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* XFT */
|
||||||
|
|
||||||
families = WMCreateHashTable(WMStringPointerHashCallbacks);
|
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++) {
|
for (i = 0; i < count; i++) {
|
||||||
int fname_len;
|
int fname_len;
|
||||||
|
|
||||||
@@ -773,9 +895,27 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
addFontToFamily(families, fields);
|
addFontToFamily(families, fields);
|
||||||
}
|
}
|
||||||
|
#endif /* XFT */
|
||||||
|
|
||||||
enumer = WMEnumerateHashTable(families);
|
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))) {
|
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
Family *fam;
|
Family *fam;
|
||||||
@@ -803,6 +943,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
WMFreeArray(array);
|
WMFreeArray(array);
|
||||||
}
|
}
|
||||||
|
#endif /* XFT */
|
||||||
WMSortListItems(panel->famLs);
|
WMSortListItems(panel->famLs);
|
||||||
|
|
||||||
WMFreeHashTable(families);
|
WMFreeHashTable(families);
|
||||||
@@ -813,23 +954,42 @@ static void
|
|||||||
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
#ifdef XFT
|
||||||
|
Xft_Family *family;
|
||||||
|
Xft_Typeface *face;
|
||||||
|
#else
|
||||||
Family *family;
|
Family *family;
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
|
#endif
|
||||||
char *size;
|
char *size;
|
||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->famLs);
|
item = WMGetListSelectedItem(panel->famLs);
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
#ifdef XFT
|
||||||
|
family = (Xft_Family*)item->clientData;
|
||||||
|
#else
|
||||||
family = (Family*)item->clientData;
|
family = (Family*)item->clientData;
|
||||||
|
#endif
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->typLs);
|
item = WMGetListSelectedItem(panel->typLs);
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
#ifdef XFT
|
||||||
|
face = (Xft_Typeface*)item->clientData;
|
||||||
|
#else
|
||||||
face = (Typeface*)item->clientData;
|
face = (Typeface*)item->clientData;
|
||||||
|
#endif
|
||||||
|
|
||||||
size = WMGetTextFieldText(panel->sizT);
|
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",
|
snprintf(buffer, bufsize, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
|
||||||
family->foundry,
|
family->foundry,
|
||||||
family->name,
|
family->name,
|
||||||
@@ -840,7 +1000,7 @@ getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
|||||||
size,
|
size,
|
||||||
family->registry,
|
family->registry,
|
||||||
family->encoding);
|
family->encoding);
|
||||||
|
#endif /* XFT */
|
||||||
wfree(size);
|
wfree(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,7 +1013,6 @@ preview(FontPanel *panel)
|
|||||||
WMFont *font;
|
WMFont *font;
|
||||||
|
|
||||||
getSelectedFont(panel, buffer, sizeof(buffer));
|
getSelectedFont(panel, buffer, sizeof(buffer));
|
||||||
|
|
||||||
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
|
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMSetTextFieldFont(panel->sampleT, font);
|
WMSetTextFieldFont(panel->sampleT, font);
|
||||||
@@ -868,9 +1027,14 @@ familyClick(WMWidget *w, void *data)
|
|||||||
{
|
{
|
||||||
WMList *lPtr = (WMList*)w;
|
WMList *lPtr = (WMList*)w;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
#ifdef XFT
|
||||||
|
Xft_Family *family;
|
||||||
|
Xft_Typeface *face;
|
||||||
|
#else
|
||||||
Family *family;
|
Family *family;
|
||||||
FontPanel *panel = (FontPanel*)data;
|
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
|
#endif
|
||||||
|
FontPanel *panel = (FontPanel*)data;
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
/* current typeface and size */
|
/* current typeface and size */
|
||||||
char *oface = NULL;
|
char *oface = NULL;
|
||||||
@@ -887,7 +1051,11 @@ familyClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(lPtr);
|
item = WMGetListSelectedItem(lPtr);
|
||||||
|
#ifdef XFT
|
||||||
|
family = (Xft_Family*)item->clientData;
|
||||||
|
#else
|
||||||
family = (Family*)item->clientData;
|
family = (Family*)item->clientData;
|
||||||
|
#endif
|
||||||
|
|
||||||
WMClearList(panel->typLs);
|
WMClearList(panel->typLs);
|
||||||
|
|
||||||
@@ -897,6 +1065,13 @@ familyClick(WMWidget *w, void *data)
|
|||||||
int top=0;
|
int top=0;
|
||||||
WMListItem *fitem;
|
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) {
|
if (strcmp(face->weight, "medium") == 0) {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -927,7 +1102,7 @@ familyClick(WMWidget *w, void *data)
|
|||||||
if (buffer[0] == 0) {
|
if (buffer[0] == 0) {
|
||||||
strcpy(buffer, _("Normal"));
|
strcpy(buffer, _("Normal"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (top)
|
if (top)
|
||||||
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
||||||
else
|
else
|
||||||
@@ -966,7 +1141,11 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
{
|
{
|
||||||
FontPanel *panel = (FontPanel*)data;
|
FontPanel *panel = (FontPanel*)data;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
#ifdef XFT
|
||||||
|
Xft_Typeface *face;
|
||||||
|
#else
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
|
#endif
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
@@ -978,7 +1157,11 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->typLs);
|
item = WMGetListSelectedItem(panel->typLs);
|
||||||
|
#ifdef XFT
|
||||||
|
face = (Xft_Typeface*)item->clientData;
|
||||||
|
#else
|
||||||
face = (Typeface*)item->clientData;
|
face = (Typeface*)item->clientData;
|
||||||
|
#endif
|
||||||
|
|
||||||
WMClearList(panel->sizLs);
|
WMClearList(panel->sizLs);
|
||||||
|
|
||||||
@@ -1009,7 +1192,6 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
preview(panel);
|
preview(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sizeClick(WMWidget *w, void *data)
|
sizeClick(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
@@ -1017,7 +1199,6 @@ sizeClick(WMWidget *w, void *data)
|
|||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->sizLs);
|
item = WMGetListSelectedItem(panel->sizLs);
|
||||||
|
|
||||||
WMSetTextFieldText(panel->sizT, item->text);
|
WMSetTextFieldText(panel->sizT, item->text);
|
||||||
|
|
||||||
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text)));
|
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text)));
|
||||||
@@ -1025,3 +1206,89 @@ sizeClick(WMWidget *w, void *data)
|
|||||||
preview(panel);
|
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;
|
drawTitle = True;
|
||||||
} else {
|
} else {
|
||||||
|
tw = tx = 0;
|
||||||
drawTitle = False;
|
drawTitle = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,6 +161,11 @@ paintFrame(Frame *fPtr)
|
|||||||
|
|
||||||
region = XCreateRegion();
|
region = XCreateRegion();
|
||||||
|
|
||||||
|
rect.x = 0;
|
||||||
|
rect.y = 0;
|
||||||
|
rect.width = view->size.width;
|
||||||
|
rect.height = view->size.height;
|
||||||
|
XUnionRectWithRegion(&rect, region, region);
|
||||||
if (drawTitle) {
|
if (drawTitle) {
|
||||||
tmp = XCreateRegion();
|
tmp = XCreateRegion();
|
||||||
rect.x = tx;
|
rect.x = tx;
|
||||||
@@ -167,13 +173,6 @@ paintFrame(Frame *fPtr)
|
|||||||
rect.width = tw;
|
rect.width = tw;
|
||||||
rect.height = th;
|
rect.height = th;
|
||||||
XUnionRectWithRegion(&rect, tmp, tmp);
|
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);
|
XSubtractRegion(region, tmp, region);
|
||||||
XDestroyRegion(tmp);
|
XDestroyRegion(tmp);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-4
@@ -12,6 +12,8 @@
|
|||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
|
|
||||||
|
#include <X11/Xlocale.h>
|
||||||
|
|
||||||
/********** data ************/
|
/********** data ************/
|
||||||
|
|
||||||
|
|
||||||
@@ -591,6 +593,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
"WM_STATE"
|
"WM_STATE"
|
||||||
};
|
};
|
||||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||||
|
char *locale;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -756,16 +759,20 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->stipple = stipple;
|
scrPtr->stipple = stipple;
|
||||||
|
|
||||||
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
|
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->useWideChar = 1;
|
||||||
|
|
||||||
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
||||||
|
|
||||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
|
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 0);
|
||||||
WINGsConfiguration.defaultFontSize);
|
|
||||||
|
|
||||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
|
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 0);
|
||||||
WINGsConfiguration.defaultFontSize);
|
|
||||||
|
|
||||||
if (!scrPtr->boldFont)
|
if (!scrPtr->boldFont)
|
||||||
scrPtr->boldFont = scrPtr->normalFont;
|
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;
|
WMIMContext *ctx;
|
||||||
|
|
||||||
@@ -38,7 +39,8 @@ Bool W_InitIMStuff(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void W_CloseIMStuff(WMScreen *scr)
|
void
|
||||||
|
W_CloseIMStuff(WMScreen *scr)
|
||||||
{
|
{
|
||||||
if (!scr->imctx)
|
if (!scr->imctx)
|
||||||
return;
|
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);
|
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||||
WMICContext *ctx;
|
WMICContext *ctx;
|
||||||
@@ -60,11 +63,12 @@ WMICContext *W_CreateIC(WMView *view)
|
|||||||
ctx->next = scr->imctx->icList;
|
ctx->next = scr->imctx->icList;
|
||||||
if (scr->imctx->icList)
|
if (scr->imctx->icList)
|
||||||
scr->imctx->icList->prev = ctx;
|
scr->imctx->icList->prev = ctx;
|
||||||
scr->imctx = ctx;
|
//scr->imctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void W_DestroyIC(WMICContext *ctx)
|
void
|
||||||
|
W_DestroyIC(WMICContext *ctx)
|
||||||
{
|
{
|
||||||
XDestroyIC(ctx->xic);
|
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)
|
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
|
static int
|
||||||
fitText(char *text, WMFont *font, int width, int wrap)
|
fitText(char *text, WMFont *font, int width, int wrap)
|
||||||
{
|
{
|
||||||
@@ -120,11 +180,11 @@ fitText(char *text, WMFont *font, int width, int wrap)
|
|||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (text[i]!='\n' && text[i]!=0)
|
i = strcspn(text, "\n\r");
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ paintArrow(WMScroller *sPtr, Drawable d, int part)
|
|||||||
|
|
||||||
|
|
||||||
if (sPtr->flags.horizontal) {
|
if (sPtr->flags.horizontal) {
|
||||||
|
|
||||||
/* paint button */
|
/* paint button */
|
||||||
#ifndef DOUBLE_BUFFER
|
#ifndef DOUBLE_BUFFER
|
||||||
XFillRectangle(scr->display, d, gc,
|
XFillRectangle(scr->display, d, gc,
|
||||||
|
|||||||
+1
-1
@@ -2026,7 +2026,7 @@ insertTextInteractively(Text *tPtr, char *text, int len)
|
|||||||
int s = tb->used - tPtr->tpos;
|
int s = tb->used - tPtr->tpos;
|
||||||
|
|
||||||
if (!tb->blank && nlen>0) {
|
if (!tb->blank && nlen>0) {
|
||||||
char *save;
|
char *save=NULL;
|
||||||
|
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
save = wmalloc(s);
|
save = wmalloc(s);
|
||||||
|
|||||||
@@ -109,9 +109,9 @@ typedef struct _Panel {
|
|||||||
|
|
||||||
char oldTabItem;
|
char oldTabItem;
|
||||||
|
|
||||||
char menuStyle;
|
int menuStyle;
|
||||||
|
|
||||||
char titleAlignment;
|
int titleAlignment;
|
||||||
|
|
||||||
Pixmap preview;
|
Pixmap preview;
|
||||||
Pixmap previewNoText;
|
Pixmap previewNoText;
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ createPanel(Panel *p)
|
|||||||
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
||||||
|
|
||||||
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
WMSetButtonEnabled(panel->swi[7], False);
|
WMSetButtonEnabled(panel->swi[7], True);
|
||||||
|
|
||||||
WMRealizeWidget(panel->box);
|
WMRealizeWidget(panel->box);
|
||||||
WMMapSubwidgets(panel->box);
|
WMMapSubwidgets(panel->box);
|
||||||
|
|||||||
+10
-10
@@ -243,13 +243,13 @@ createPanel(Panel *p)
|
|||||||
WMSetFrameTitle(panel->cfocF, _("Install colormap in the window..."));
|
WMSetFrameTitle(panel->cfocF, _("Install colormap in the window..."));
|
||||||
|
|
||||||
panel->manB = WMCreateRadioButton(panel->cfocF);
|
panel->manB = WMCreateRadioButton(panel->cfocF);
|
||||||
WMResizeWidget(panel->manB, 220, 20);
|
WMResizeWidget(panel->manB, 225, 20);
|
||||||
WMMoveWidget(panel->manB, 15, 18);
|
WMMoveWidget(panel->manB, 10, 18);
|
||||||
WMSetButtonText(panel->manB, _("...that has the input focus."));
|
WMSetButtonText(panel->manB, _("...that has the input focus."));
|
||||||
|
|
||||||
panel->autB = WMCreateRadioButton(panel->cfocF);
|
panel->autB = WMCreateRadioButton(panel->cfocF);
|
||||||
WMResizeWidget(panel->autB, 220, 20);
|
WMResizeWidget(panel->autB, 225, 20);
|
||||||
WMMoveWidget(panel->autB, 15, 40);
|
WMMoveWidget(panel->autB, 10, 43);
|
||||||
WMSetButtonText(panel->autB, _("...that is under the mouse pointer."));
|
WMSetButtonText(panel->autB, _("...that is under the mouse pointer."));
|
||||||
WMGroupButtons(panel->manB, panel->autB);
|
WMGroupButtons(panel->manB, panel->autB);
|
||||||
|
|
||||||
@@ -331,15 +331,15 @@ createPanel(Panel *p)
|
|||||||
WMMoveWidget(panel->optF, 265, 95);
|
WMMoveWidget(panel->optF, 265, 95);
|
||||||
|
|
||||||
panel->ignB = WMCreateSwitchButton(panel->optF);
|
panel->ignB = WMCreateSwitchButton(panel->optF);
|
||||||
WMResizeWidget(panel->ignB, 210, 50);
|
WMResizeWidget(panel->ignB, 225, 50);
|
||||||
WMMoveWidget(panel->ignB, 15, 10);
|
WMMoveWidget(panel->ignB, 10, 10);
|
||||||
WMSetButtonText(panel->ignB, _("Do not let applications receive\n"
|
WMSetButtonText(panel->ignB, _("Do not let applications receive "
|
||||||
"the click used to focus windows."));
|
"the click used to focus windows."));
|
||||||
|
|
||||||
panel->newB = WMCreateSwitchButton(panel->optF);
|
panel->newB = WMCreateSwitchButton(panel->optF);
|
||||||
WMResizeWidget(panel->newB, 210, 35);
|
WMResizeWidget(panel->newB, 225, 35);
|
||||||
WMMoveWidget(panel->newB, 15, 70);
|
WMMoveWidget(panel->newB, 10, 70);
|
||||||
WMSetButtonText(panel->newB, _("Automatically focus new\nwindows."));
|
WMSetButtonText(panel->newB, _("Automatically focus new windows."));
|
||||||
|
|
||||||
WMMapSubwidgets(panel->optF);
|
WMMapSubwidgets(panel->optF);
|
||||||
|
|
||||||
|
|||||||
+22
-28
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "WPrefs.h"
|
#include "WPrefs.h"
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
WMBox *box;
|
WMBox *box;
|
||||||
@@ -358,7 +358,7 @@ paintItems(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
|
|||||||
int l = strlen(text);
|
int l = strlen(text);
|
||||||
int x = previewPositions[part].pos.x;
|
int x = previewPositions[part].pos.x;
|
||||||
int y = previewPositions[part].pos.y;
|
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 h = previewPositions[part].size.height/4;
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < 4 ; i++) {
|
for( i = 0; i < 4 ; i++) {
|
||||||
@@ -443,7 +443,7 @@ dumpRImage(char *path, RImage *image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
/*static int
|
||||||
isPixmap(WMPropList *prop)
|
isPixmap(WMPropList *prop)
|
||||||
{
|
{
|
||||||
WMPropList *p;
|
WMPropList *p;
|
||||||
@@ -455,7 +455,7 @@ isPixmap(WMPropList *prop)
|
|||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
static Pixmap
|
static Pixmap
|
||||||
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
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);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
Pixmap pix, tmp;
|
Pixmap pix, tmp;
|
||||||
RContext *rc = WMScreenRContext(scr);
|
//RContext *rc = WMScreenRContext(scr);
|
||||||
GC gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
GC gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -835,7 +835,7 @@ paintPreviewBox(Panel *panel, int elements)
|
|||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
int refresh = 0;
|
//int refresh = 0;
|
||||||
GC gc;
|
GC gc;
|
||||||
WMColor *black = WMBlackColor(scr);
|
WMColor *black = WMBlackColor(scr);
|
||||||
Pixmap mitem;
|
Pixmap mitem;
|
||||||
@@ -926,7 +926,7 @@ static void
|
|||||||
paintTextField(void *data, int section)
|
paintTextField(void *data, int section)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
char *sample = NULL;
|
//char *sample = NULL;
|
||||||
int encoding;
|
int encoding;
|
||||||
encoding = WMGetPopUpButtonSelectedItem(panel->langP);
|
encoding = WMGetPopUpButtonSelectedItem(panel->langP);
|
||||||
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
||||||
@@ -1072,7 +1072,7 @@ refillFontSetList(void *data)
|
|||||||
char *encoding = getFontEncoding(panel);
|
char *encoding = getFontEncoding(panel);
|
||||||
int section = WMGetPopUpButtonSelectedItem(panel->fontSel);
|
int section = WMGetPopUpButtonSelectedItem(panel->fontSel);
|
||||||
int i;
|
int i;
|
||||||
int pos;
|
//int pos;
|
||||||
WMClearList(panel->fsetLs);
|
WMClearList(panel->fsetLs);
|
||||||
if(!encoding) {
|
if(!encoding) {
|
||||||
array = getCurrentFontProp(panel, section);
|
array = getCurrentFontProp(panel, section);
|
||||||
@@ -1259,7 +1259,7 @@ static void
|
|||||||
changeLanguageAction(WMWidget *w, void *data)
|
changeLanguageAction(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
Panel *panel = (Panel*)data;
|
Panel *panel = (Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
//WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
int section;
|
int section;
|
||||||
|
|
||||||
section = WMGetPopUpButtonSelectedItem(w);
|
section = WMGetPopUpButtonSelectedItem(w);
|
||||||
@@ -1314,7 +1314,7 @@ static char*
|
|||||||
getFontSampleString(void *data)
|
getFontSampleString(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
//WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1336,7 +1336,7 @@ static char*
|
|||||||
getFontEncoding(void *data)
|
getFontEncoding(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
//WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1358,7 +1358,7 @@ static Bool
|
|||||||
isEncodingMultiByte(void *data)
|
isEncodingMultiByte(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
//WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1473,25 +1473,19 @@ getDefaultSystemFont(void *data, int element)
|
|||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
|
|
||||||
switch(element) {
|
switch(element) {
|
||||||
case 0:
|
case 0:
|
||||||
return WMBoldSystemFontOfSize(scr, 12);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return WMBoldSystemFontOfSize(scr, 24);
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
return WMBoldSystemFontOfSize(scr, 12);
|
return WMBoldSystemFontOfSize(scr, 12);
|
||||||
break;
|
case 1:
|
||||||
case 3:
|
return WMBoldSystemFontOfSize(scr, 24);
|
||||||
return WMSystemFontOfSize(scr, 12);
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
return WMSystemFontOfSize(scr, 8);
|
|
||||||
break;
|
|
||||||
case 5:
|
case 5:
|
||||||
return WMSystemFontOfSize(scr, 8);
|
return WMSystemFontOfSize(scr, 8);
|
||||||
break;
|
case 3:
|
||||||
|
default:
|
||||||
|
return WMSystemFontOfSize(scr, 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1515,7 +1509,7 @@ static void
|
|||||||
toggleAA(WMWidget *w, void *data)
|
toggleAA(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
int section;
|
//int section;
|
||||||
if(panel->AntialiasedText)
|
if(panel->AntialiasedText)
|
||||||
panel->AntialiasedText = False;
|
panel->AntialiasedText = False;
|
||||||
else
|
else
|
||||||
@@ -1622,7 +1616,7 @@ addButtonAction(WMWidget *w, void *data)
|
|||||||
array = getDefaultFontProp(panel, encoding, section);
|
array = getDefaultFontProp(panel, encoding, section);
|
||||||
|
|
||||||
WMHideFontPanel(panel->fontPanel);
|
WMHideFontPanel(panel->fontPanel);
|
||||||
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
|
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
|
||||||
string = WMCreatePLString(chosenFont);
|
string = WMCreatePLString(chosenFont);
|
||||||
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
||||||
WMInsertListItem(panel->fsetLs, pos+1, chosenFont);
|
WMInsertListItem(panel->fsetLs, pos+1, chosenFont);
|
||||||
@@ -1651,7 +1645,7 @@ changeButtonAction(WMWidget *w, void *data)
|
|||||||
|
|
||||||
WMHideFontPanel(panel->fontPanel);
|
WMHideFontPanel(panel->fontPanel);
|
||||||
|
|
||||||
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
|
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
|
||||||
string = WMCreatePLString(chosenFont);
|
string = WMCreatePLString(chosenFont);
|
||||||
|
|
||||||
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
||||||
@@ -1720,7 +1714,7 @@ removeButtonClick(WMWidget *w, void *data)
|
|||||||
static void
|
static void
|
||||||
showData(_Panel *panel)
|
showData(_Panel *panel)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
//WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
char *str;
|
char *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ static char *keyOptions[] = {
|
|||||||
"WindowShortcut9Key",
|
"WindowShortcut9Key",
|
||||||
"WindowShortcut10Key",
|
"WindowShortcut10Key",
|
||||||
"ScreenSwitchKey",
|
"ScreenSwitchKey",
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
"VirtualEdgeLeftKey",
|
||||||
|
"VirtualEdgeRightKey",
|
||||||
|
"VirtualEdgeUpKey",
|
||||||
|
"VirtualEdgeDownKey",
|
||||||
|
#endif
|
||||||
"ClipRaiseKey",
|
"ClipRaiseKey",
|
||||||
"ClipLowerKey",
|
"ClipLowerKey",
|
||||||
#ifndef XKB_MODELOCK
|
#ifndef XKB_MODELOCK
|
||||||
@@ -326,7 +332,7 @@ captureClick(WMWidget *w, void *data)
|
|||||||
}
|
}
|
||||||
panel->capturing = 0;
|
panel->capturing = 0;
|
||||||
WMSetButtonText(w, _("Capture"));
|
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);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,6 +543,12 @@ createPanel(Panel *p)
|
|||||||
WMAddListItem(panel->actLs, _("Shortcut for window 9"));
|
WMAddListItem(panel->actLs, _("Shortcut for window 9"));
|
||||||
WMAddListItem(panel->actLs, _("Shortcut for window 10"));
|
WMAddListItem(panel->actLs, _("Shortcut for window 10"));
|
||||||
WMAddListItem(panel->actLs, _("Switch to Next Screen/Monitor"));
|
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, _("Raise Clip"));
|
||||||
WMAddListItem(panel->actLs, _("Lower Clip"));
|
WMAddListItem(panel->actLs, _("Lower Clip"));
|
||||||
WMAddListItem(panel->actLs, _("Raise/Lower Clip"));
|
WMAddListItem(panel->actLs, _("Raise/Lower Clip"));
|
||||||
@@ -580,7 +592,7 @@ createPanel(Panel *p)
|
|||||||
WMMoveWidget(panel->instructionsL, 15, 140);
|
WMMoveWidget(panel->instructionsL, 15, 140);
|
||||||
WMSetLabelTextAlignment(panel->instructionsL, WACenter);
|
WMSetLabelTextAlignment(panel->instructionsL, WACenter);
|
||||||
WMSetLabelWraps(panel->instructionsL, True);
|
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);
|
WMMapSubwidgets(panel->shoF);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ WPrefs_SOURCES = \
|
|||||||
imagebrowser.h \
|
imagebrowser.h \
|
||||||
xmodifier.c
|
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@
|
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) {
|
if (!db) {
|
||||||
db = WMCreatePLDictionary(NULL, NULL, NULL);
|
db = WMCreatePLDictionary(NULL, NULL);
|
||||||
}
|
}
|
||||||
if (!gdb) {
|
if (!gdb) {
|
||||||
gdb = WMCreatePLDictionary(NULL, NULL, NULL);
|
gdb = WMCreatePLDictionary(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalDB = gdb;
|
GlobalDB = gdb;
|
||||||
|
|||||||
@@ -397,18 +397,16 @@ createPanel(Panel *p)
|
|||||||
WMMoveWidget(panel->resL, 95, 20);
|
WMMoveWidget(panel->resL, 95, 20);
|
||||||
|
|
||||||
panel->resaB = WMCreateRadioButton(panel->resF);
|
panel->resaB = WMCreateRadioButton(panel->resF);
|
||||||
WMMoveWidget(panel->resaB, 130, 14);
|
WMMoveWidget(panel->resaB, 130, 15);
|
||||||
WMResizeWidget(panel->resaB, 70, 26);
|
WMResizeWidget(panel->resaB, 70, 25);
|
||||||
WMSetButtonText(panel->resaB, _("Resist"));
|
WMSetButtonText(panel->resaB, _("Resist"));
|
||||||
|
|
||||||
panel->resrB = WMCreateRadioButton(panel->resF);
|
panel->resrB = WMCreateRadioButton(panel->resF);
|
||||||
WMMoveWidget(panel->resrB, 200, 12);
|
WMMoveWidget(panel->resrB, 200, 15);
|
||||||
WMResizeWidget(panel->resrB, 65, 30);
|
WMResizeWidget(panel->resrB, 70, 25);
|
||||||
WMSetButtonText(panel->resrB, _("Attract"));
|
WMSetButtonText(panel->resrB, _("Attract"));
|
||||||
WMGroupButtons(panel->resrB, panel->resaB);
|
WMGroupButtons(panel->resrB, panel->resaB);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WMMapSubwidgets(panel->resF);
|
WMMapSubwidgets(panel->resF);
|
||||||
|
|
||||||
/**************** Transients on Parent Workspace ****************/
|
/**************** Transients on Parent Workspace ****************/
|
||||||
@@ -420,7 +418,7 @@ createPanel(Panel *p)
|
|||||||
panel->tranB = WMCreateSwitchButton(panel->tranF);
|
panel->tranB = WMCreateSwitchButton(panel->tranF);
|
||||||
WMMoveWidget(panel->tranB, 10, 5);
|
WMMoveWidget(panel->tranB, 10, 5);
|
||||||
WMResizeWidget(panel->tranB, 250, 30);
|
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);
|
WMMapSubwidgets(panel->tranF);
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ createPanel(Panel *p)
|
|||||||
WMResizeWidget(panel->cyclB, 280, 34);
|
WMResizeWidget(panel->cyclB, 280, 34);
|
||||||
WMMoveWidget(panel->cyclB, 75, 30);
|
WMMoveWidget(panel->cyclB, 75, 30);
|
||||||
WMSetButtonText(panel->cyclB,
|
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);
|
panel->cyclL = WMCreateLabel(panel->navF);
|
||||||
WMResizeWidget(panel->cyclL, 60, 60);
|
WMResizeWidget(panel->cyclL, 60, 60);
|
||||||
@@ -202,7 +202,7 @@ createPanel(Panel *p)
|
|||||||
WMResizeWidget(panel->linkB, 280, 34);
|
WMResizeWidget(panel->linkB, 280, 34);
|
||||||
WMMoveWidget(panel->linkB, 75, 75);
|
WMMoveWidget(panel->linkB, 75, 75);
|
||||||
WMSetButtonText(panel->linkB,
|
WMSetButtonText(panel->linkB,
|
||||||
_("switch workspaces while dragging windows."));
|
_("Switch workspaces while dragging windows."));
|
||||||
|
|
||||||
panel->linkL = WMCreateLabel(panel->navF);
|
panel->linkL = WMCreateLabel(panel->navF);
|
||||||
WMResizeWidget(panel->linkL, 60, 40);
|
WMResizeWidget(panel->linkL, 60, 40);
|
||||||
@@ -224,7 +224,7 @@ createPanel(Panel *p)
|
|||||||
WMResizeWidget(panel->newB, 280, 34);
|
WMResizeWidget(panel->newB, 280, 34);
|
||||||
WMMoveWidget(panel->newB, 75, 120);
|
WMMoveWidget(panel->newB, 75, 120);
|
||||||
WMSetButtonText(panel->newB,
|
WMSetButtonText(panel->newB,
|
||||||
_("automatically create new workspaces."));
|
_("Automatically create new workspaces."));
|
||||||
|
|
||||||
panel->newL = WMCreateLabel(panel->navF);
|
panel->newL = WMCreateLabel(panel->navF);
|
||||||
WMResizeWidget(panel->newL, 60, 20);
|
WMResizeWidget(panel->newL, 60, 20);
|
||||||
|
|||||||
@@ -75,6 +75,9 @@
|
|||||||
DontSaveSession = Yes;
|
DontSaveSession = Yes;
|
||||||
Unfocusable = Yes;
|
Unfocusable = Yes;
|
||||||
};
|
};
|
||||||
|
kio_uiserver = {NoAppIcon = Yes;};
|
||||||
|
kcmshell = {NoAppIcon = Yes;};
|
||||||
|
kded = {NoAppIcon = Yes;};
|
||||||
"." = {NoAppIcon = Yes;};
|
"." = {NoAppIcon = Yes;};
|
||||||
"*" = {Icon = defaultAppIcon.#extension#;SharedAppIcon = 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
|
||||||
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
||||||
dnl
|
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
|
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_CACHE_CHECK(whether gcc supports MMX(tm) inline asm,
|
||||||
ac_cv_c_inline_mmx,
|
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=yes,
|
||||||
ac_cv_c_inline_mmx=no)])
|
ac_cv_c_inline_mmx=no)])
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ dnl ==================
|
|||||||
|
|
||||||
dnl List of supported locales
|
dnl List of supported locales
|
||||||
dnl -------------------------
|
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_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"
|
supported_wings_locales="bg ca cs de fr sk"
|
||||||
|
|
||||||
@@ -376,6 +376,12 @@ AC_SUBST(supported_locales)
|
|||||||
dnl Support for various hint things
|
dnl Support for various hint things
|
||||||
dnl ===============================
|
dnl ===============================
|
||||||
|
|
||||||
|
gnome_on="no"
|
||||||
|
kde_on="no"
|
||||||
|
openlook_on="no"
|
||||||
|
netwm_on="no"
|
||||||
|
vdesktop_on="no"
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(gnome,
|
AC_ARG_ENABLE(gnome,
|
||||||
[ --enable-gnome enable stuff needed for GNOME ],
|
[ --enable-gnome enable stuff needed for GNOME ],
|
||||||
@@ -401,6 +407,22 @@ AC_ARG_ENABLE(openlook,
|
|||||||
fi])
|
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
|
||||||
dnl Disable some stuff that are duplicated in kde
|
dnl Disable some stuff that are duplicated in kde
|
||||||
dnl ---------------------------------------------
|
dnl ---------------------------------------------
|
||||||
@@ -519,35 +541,54 @@ fi
|
|||||||
|
|
||||||
dnl Xft antialiased font support
|
dnl Xft antialiased font support
|
||||||
dnl ============================
|
dnl ============================
|
||||||
|
|
||||||
xft=yes
|
xft=yes
|
||||||
XFTLIBS=""
|
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"
|
XFTCONFIG="$PKGCONFIG xft"
|
||||||
pkgconfig_xft=yes
|
pkgconfig_xft=yes
|
||||||
else
|
else
|
||||||
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
|
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING([for the Xft2 library])
|
|
||||||
if test "x$XFTCONFIG" != x; then
|
AC_MSG_CHECKING([for the Xft2 library])
|
||||||
|
|
||||||
|
if test "x$XFTCONFIG" != x; then
|
||||||
XFTLIBS=`$XFTCONFIG --libs`
|
XFTLIBS=`$XFTCONFIG --libs`
|
||||||
XFTFLAGS=`$XFTCONFIG --cflags`
|
XFTFLAGS=`$XFTCONFIG --cflags`
|
||||||
AC_MSG_RESULT([found])
|
AC_MSG_RESULT([found])
|
||||||
else
|
else
|
||||||
xft=no
|
|
||||||
AC_MSG_RESULT([not found])
|
AC_MSG_RESULT([not found])
|
||||||
fi
|
echo
|
||||||
if test "$xft" = yes; then
|
echo "ERROR!!! libXft2 is not installed or could not be found."
|
||||||
AC_SUBST(XFTFLAGS)
|
echo " Xft2 is a requirement for building Window Maker."
|
||||||
AC_SUBST(XFTLIBS)
|
echo " Please install it (along with fontconfig) before continuing."
|
||||||
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])
|
echo
|
||||||
fi
|
exit 1
|
||||||
fi
|
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 support
|
||||||
dnl ================
|
dnl ================
|
||||||
xinerama=no
|
xinerama=no
|
||||||
@@ -845,14 +886,14 @@ AC_ARG_WITH(appspath,
|
|||||||
[ --with-appspath=PATH specify the directory for GNUstep applications], appspath=$withval )
|
[ --with-appspath=PATH specify the directory for GNUstep applications], appspath=$withval )
|
||||||
|
|
||||||
if test "x$appspath" = "x"; then
|
if test "x$appspath" = "x"; then
|
||||||
gnustepdir='$(prefix)/GNUstep'
|
gnustepdir='${prefix}/GNUstep'
|
||||||
|
|
||||||
if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
|
if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
|
||||||
gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
|
gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
|
||||||
gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
|
gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
with_appspath=$gnustepdir/Apps
|
with_appspath=$gnustepdir/Applications
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wprefsdir=$with_appspath/WPrefs.app
|
wprefsdir=$with_appspath/WPrefs.app
|
||||||
@@ -1075,29 +1116,48 @@ dnl ==========================
|
|||||||
supported_gfx="$supported_gfx builtin-PPM"
|
supported_gfx="$supported_gfx builtin-PPM"
|
||||||
|
|
||||||
if test "x$MOFILES" = "x"; then
|
if test "x$MOFILES" = "x"; then
|
||||||
mof=none
|
mof=None
|
||||||
else
|
else
|
||||||
mof=`echo $MOFILES`
|
mof=`echo $MOFILES`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$MOFILES" = "x"; then
|
if test "x$MOFILES" = "x"; then
|
||||||
languages=none
|
languages=None
|
||||||
else
|
else
|
||||||
languages=`echo $MOFILES | sed 's/.mo//g'`
|
languages=`echo $MOFILES | sed 's/.mo//g'`
|
||||||
fi
|
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
|
||||||
echo "Window Maker was configured as follows:"
|
echo "Window Maker was configured as follows:"
|
||||||
echo
|
echo
|
||||||
echo "Installation path prefix : $prefix"
|
echo "Installation path prefix : $prefix"
|
||||||
echo "Installation path for binaries : $_bindir"
|
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 "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 assembly routines for wrlib : $asm_support"
|
||||||
echo "Use inline MMX(tm) x86 assembly : $mmx_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"
|
echo "Translated message files to install : $mof"
|
||||||
dnl echo "Supported languages beside English : $languages"
|
dnl echo "Supported languages beside English : $languages"
|
||||||
if test "x$MOFILES" != "x"; then
|
if test "x$MOFILES" != "x"; then
|
||||||
|
|||||||
+5
-1
@@ -96,6 +96,8 @@ wmaker_SOURCES = \
|
|||||||
winmenu.c \
|
winmenu.c \
|
||||||
winspector.h \
|
winspector.h \
|
||||||
winspector.c \
|
winspector.c \
|
||||||
|
wmspec.h \
|
||||||
|
wmspec.c \
|
||||||
workspace.c \
|
workspace.c \
|
||||||
workspace.h \
|
workspace.h \
|
||||||
wsound.c \
|
wsound.c \
|
||||||
@@ -104,7 +106,9 @@ wmaker_SOURCES = \
|
|||||||
text.h
|
text.h
|
||||||
|
|
||||||
|
|
||||||
AM_CPPFLAGS = @CPPFLAGS@ $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
|
AM_CPPFLAGS = $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
|
||||||
|
|
||||||
|
AM_CFLAGS = -fno-strict-aliasing
|
||||||
|
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
|
|||||||
+5
-3
@@ -70,6 +70,7 @@ enum {
|
|||||||
WMSubmenuLevel = 6,
|
WMSubmenuLevel = 6,
|
||||||
WMMainMenuLevel = 20,
|
WMMainMenuLevel = 20,
|
||||||
WMStatusLevel = 21,
|
WMStatusLevel = 21,
|
||||||
|
WMFullscreenLevel = 50,
|
||||||
WMModalLevel = 100,
|
WMModalLevel = 100,
|
||||||
WMPopUpLevel = 101,
|
WMPopUpLevel = 101,
|
||||||
WMScreensaverLevel = 1000,
|
WMScreensaverLevel = 1000,
|
||||||
@@ -144,7 +145,8 @@ typedef enum {
|
|||||||
#define WCUR_TEXT 12
|
#define WCUR_TEXT 12
|
||||||
#define WCUR_SELECT 13
|
#define WCUR_SELECT 13
|
||||||
#define WCUR_ROOT 14
|
#define WCUR_ROOT 14
|
||||||
#define WCUR_LAST 15
|
#define WCUR_EMPTY 15
|
||||||
|
#define WCUR_LAST 16
|
||||||
|
|
||||||
/* geometry displays */
|
/* geometry displays */
|
||||||
#define WDIS_NEW 0 /* new style */
|
#define WDIS_NEW 0 /* new style */
|
||||||
@@ -420,8 +422,8 @@ typedef struct WPreferences {
|
|||||||
unsigned int vedge_bordersize;
|
unsigned int vedge_bordersize;
|
||||||
unsigned int vedge_hscrollspeed;
|
unsigned int vedge_hscrollspeed;
|
||||||
unsigned int vedge_vscrollspeed;
|
unsigned int vedge_vscrollspeed;
|
||||||
unsigned int vedge_maxheight;
|
unsigned int vedge_resistance;
|
||||||
unsigned int vedge_maxwidth;
|
unsigned int vedge_attraction;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char ws_cycle; /* Cycle existing workspaces */
|
char ws_cycle; /* Cycle existing workspaces */
|
||||||
|
|||||||
+170
-77
@@ -69,6 +69,8 @@ extern WPreferences wPreferences;
|
|||||||
|
|
||||||
extern Atom _XA_WM_TAKE_FOCUS;
|
extern Atom _XA_WM_TAKE_FOCUS;
|
||||||
|
|
||||||
|
extern void ProcessPendingEvents();
|
||||||
|
|
||||||
|
|
||||||
/******* Local Variables *******/
|
/******* Local Variables *******/
|
||||||
static struct {
|
static struct {
|
||||||
@@ -85,37 +87,6 @@ static struct {
|
|||||||
#define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
|
#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--
|
* wSetFocusTo--
|
||||||
@@ -140,32 +111,20 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
WApplication *oapp=NULL, *napp=NULL;
|
WApplication *oapp=NULL, *napp=NULL;
|
||||||
int wasfocused;
|
int wasfocused;
|
||||||
|
|
||||||
|
if (scr->flags.ignore_focus_events || LastFocusChange > timestamp)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!old_scr)
|
if (!old_scr)
|
||||||
old_scr=scr;
|
old_scr=scr;
|
||||||
old_focused=old_scr->focused_window;
|
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;
|
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)
|
if (old_focused)
|
||||||
oapp = wApplicationOf(old_focused->main_window);
|
oapp = wApplicationOf(old_focused->main_window);
|
||||||
|
|
||||||
if (wwin == NULL) {
|
if (wwin == NULL) {
|
||||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
|
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||||
if (old_focused) {
|
if (old_focused) {
|
||||||
wWindowUnfocus(old_focused);
|
wWindowUnfocus(old_focused);
|
||||||
}
|
}
|
||||||
@@ -199,12 +158,12 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
/* set input focus */
|
/* set input focus */
|
||||||
switch (wwin->focus_mode) {
|
switch (wwin->focus_mode) {
|
||||||
case WFM_NO_INPUT:
|
case WFM_NO_INPUT:
|
||||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
|
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFM_PASSIVE:
|
case WFM_PASSIVE:
|
||||||
case WFM_LOCALLY_ACTIVE:
|
case WFM_LOCALLY_ACTIVE:
|
||||||
XSetInputFocus(dpy, wwin->client_win, RevertToParent, timestamp);
|
XSetInputFocus(dpy, wwin->client_win, RevertToParent, CurrentTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFM_GLOBALLY_ACTIVE:
|
case WFM_GLOBALLY_ACTIVE:
|
||||||
@@ -216,7 +175,7 @@ wSetFocusTo(WScreen *scr, WWindow *wwin)
|
|||||||
}
|
}
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
} else {
|
} else {
|
||||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, timestamp);
|
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||||
}
|
}
|
||||||
if (WFLAGP(wwin, no_focusable))
|
if (WFLAGP(wwin, no_focusable))
|
||||||
return;
|
return;
|
||||||
@@ -333,9 +292,8 @@ wShadeWindow(WWindow *wwin)
|
|||||||
|
|
||||||
#ifdef ANIMATIONS
|
#ifdef ANIMATIONS
|
||||||
if (!wwin->screen_ptr->flags.startup) {
|
if (!wwin->screen_ptr->flags.startup) {
|
||||||
/* Look at processEvents() for reason of this code. */
|
/* Catch up with events not processed while animation was running */
|
||||||
XSync(dpy, 0);
|
ProcessPendingEvents();
|
||||||
processEvents(XPending(dpy));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -419,7 +377,7 @@ wMaximizeWindow(WWindow *wwin, int directions)
|
|||||||
int changed_h, changed_v, shrink_h, shrink_v;
|
int changed_h, changed_v, shrink_h, shrink_v;
|
||||||
WArea usableArea, totalArea;
|
WArea usableArea, totalArea;
|
||||||
|
|
||||||
if (WFLAGP(wwin, no_resizable))
|
if (!IS_RESIZABLE(wwin))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
totalArea.x1 = 0;
|
totalArea.x1 = 0;
|
||||||
@@ -550,6 +508,65 @@ wUnmaximizeWindow(WWindow *wwin)
|
|||||||
wSoundPlay(WSOUND_UNMAXIMIZE);
|
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
|
#ifdef ANIMATIONS
|
||||||
static void
|
static void
|
||||||
animateResizeFlip(WScreen *scr, int x, int y, int w, int h,
|
animateResizeFlip(WScreen *scr, int x, int y, int w, int h,
|
||||||
@@ -943,7 +960,11 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
GrabModeAsync, None, None, CurrentTime);
|
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) {
|
if (!wwin->flags.icon_moved) {
|
||||||
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, &wwin->icon_y, wGetHeadForWindow(wwin));
|
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) */
|
* something before the animation starts (and the server is grabbed) */
|
||||||
XSync(dpy, 0);
|
XSync(dpy, 0);
|
||||||
|
|
||||||
if (wPreferences.disable_miniwindows)
|
if (wPreferences.disable_miniwindows
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
|| wwin->flags.net_handle_icon
|
||||||
|
#endif
|
||||||
|
)
|
||||||
wClientSetState(wwin, IconicState, None);
|
wClientSetState(wwin, IconicState, None);
|
||||||
else
|
else
|
||||||
wClientSetState(wwin, IconicState, wwin->icon->icon_win);
|
wClientSetState(wwin, IconicState, wwin->icon->icon_win);
|
||||||
@@ -979,7 +1004,11 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
&& !wPreferences.no_animations) {
|
&& !wPreferences.no_animations) {
|
||||||
int ix, iy, iw, ih;
|
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;
|
ix = wwin->icon_x;
|
||||||
iy = wwin->icon_y;
|
iy = wwin->icon_y;
|
||||||
iw = wwin->icon->core->width;
|
iw = wwin->icon->core->width;
|
||||||
@@ -995,6 +1024,14 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
ih = area.y2 - iy;
|
ih = area.y2 - iy;
|
||||||
} else
|
} else
|
||||||
#endif /* KWM_HINTS */
|
#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;
|
ix = 0;
|
||||||
iy = 0;
|
iy = 0;
|
||||||
@@ -1011,7 +1048,11 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
|
|
||||||
wwin->flags.skip_next_animation = 0;
|
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 ||
|
if (wwin->screen_ptr->current_workspace==wwin->frame->workspace ||
|
||||||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
|
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
|
||||||
@@ -1051,20 +1092,27 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
|
|
||||||
#ifdef ANIMATIONS
|
#ifdef ANIMATIONS
|
||||||
if (!wwin->screen_ptr->flags.startup) {
|
if (!wwin->screen_ptr->flags.startup) {
|
||||||
|
/* Catch up with events not processed while animation was running */
|
||||||
Window clientwin = wwin->client_win;
|
Window clientwin = wwin->client_win;
|
||||||
|
|
||||||
XSync(dpy, 0);
|
ProcessPendingEvents();
|
||||||
processEvents(XPending(dpy));
|
|
||||||
|
|
||||||
/* the window can disappear while doing the processEvents() */
|
/* the window can disappear while ProcessPendingEvents() runs */
|
||||||
if (!wWindowFor(clientwin))
|
if (!wWindowFor(clientwin)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* maybe we want to do this regardless of net_handle_icon
|
||||||
if (wwin->flags.selected && !wPreferences.disable_miniwindows)
|
* 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);
|
wIconSelect(wwin->icon);
|
||||||
|
|
||||||
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
||||||
@@ -1076,6 +1124,15 @@ wIconifyWindow(WWindow *wwin)
|
|||||||
void
|
void
|
||||||
wDeiconifyWindow(WWindow *wwin)
|
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);
|
wWindowChangeWorkspace(wwin, wwin->screen_ptr->current_workspace);
|
||||||
|
|
||||||
if (!wwin->flags.miniaturized)
|
if (!wwin->flags.miniaturized)
|
||||||
@@ -1094,25 +1151,42 @@ wDeiconifyWindow(WWindow *wwin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wwin->flags.miniaturized = 0;
|
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)
|
if (wwin->icon->selected)
|
||||||
wIconSelect(wwin->icon);
|
wIconSelect(wwin->icon);
|
||||||
|
|
||||||
XUnmapWindow(dpy, wwin->icon->core->window);
|
XUnmapWindow(dpy, wwin->icon->core->window);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!netwm_hidden)
|
||||||
wSoundPlay(WSOUND_DEICONIFY);
|
wSoundPlay(WSOUND_DEICONIFY);
|
||||||
|
|
||||||
/* if the window is in another workspace, do it silently */
|
/* if the window is in another workspace, do it silently */
|
||||||
|
if (!netwm_hidden) {
|
||||||
#ifdef ANIMATIONS
|
#ifdef ANIMATIONS
|
||||||
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
|
if (!wwin->screen_ptr->flags.startup && !wPreferences.no_animations
|
||||||
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
|
&& !wwin->flags.skip_next_animation && wwin->icon != NULL) {
|
||||||
int ix, iy, iw, ih;
|
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;
|
ix = wwin->icon_x;
|
||||||
iy = wwin->icon_y;
|
iy = wwin->icon_y;
|
||||||
iw = wwin->icon->core->width;
|
iw = wwin->icon->core->width;
|
||||||
@@ -1128,6 +1202,14 @@ wDeiconifyWindow(WWindow *wwin)
|
|||||||
ih = area.y2 - iy;
|
ih = area.y2 - iy;
|
||||||
} else
|
} else
|
||||||
#endif /* KWM_HINTS */
|
#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;
|
ix = 0;
|
||||||
iy = 0;
|
iy = 0;
|
||||||
@@ -1152,28 +1234,38 @@ wDeiconifyWindow(WWindow *wwin)
|
|||||||
wClientSetState(wwin, NormalState, None);
|
wClientSetState(wwin, NormalState, None);
|
||||||
}
|
}
|
||||||
mapTransientsFor(wwin);
|
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);
|
RemoveFromStackList(wwin->icon->core);
|
||||||
/* removeIconGrabs(wwin->icon);*/
|
/* removeIconGrabs(wwin->icon);*/
|
||||||
wIconDestroy(wwin->icon);
|
wIconDestroy(wwin->icon);
|
||||||
wwin->icon = NULL;
|
wwin->icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!netwm_hidden) {
|
||||||
XUngrabServer(dpy);
|
XUngrabServer(dpy);
|
||||||
|
|
||||||
wSetFocusTo(wwin->screen_ptr, wwin);
|
wSetFocusTo(wwin->screen_ptr, wwin);
|
||||||
|
|
||||||
#ifdef ANIMATIONS
|
#ifdef ANIMATIONS
|
||||||
if (!wwin->screen_ptr->flags.startup) {
|
if (!wwin->screen_ptr->flags.startup) {
|
||||||
|
/* Catch up with events not processed while animation was running */
|
||||||
Window clientwin = wwin->client_win;
|
Window clientwin = wwin->client_win;
|
||||||
|
|
||||||
XSync(dpy, 0);
|
ProcessPendingEvents();
|
||||||
processEvents(XPending(dpy));
|
|
||||||
|
|
||||||
if (!wWindowFor(clientwin))
|
/* the window can disappear while ProcessPendingEvents() runs */
|
||||||
|
if (!wWindowFor(clientwin)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (wPreferences.auto_arrange_icons) {
|
if (wPreferences.auto_arrange_icons) {
|
||||||
wArrangeIcons(wwin->screen_ptr, True);
|
wArrangeIcons(wwin->screen_ptr, True);
|
||||||
@@ -1182,6 +1274,7 @@ wDeiconifyWindow(WWindow *wwin)
|
|||||||
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
||||||
|
|
||||||
/* In case we were shaded and iconified, also unshade */
|
/* In case we were shaded and iconified, also unshade */
|
||||||
|
if (!netwm_hidden)
|
||||||
wUnshadeWindow(wwin);
|
wUnshadeWindow(wwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1618,9 +1711,9 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
|
|
||||||
while (aicon) {
|
while (aicon) {
|
||||||
if (!aicon->docked) {
|
if (!aicon->docked) {
|
||||||
/* XXX: can: icon == NULL ? */
|
/* 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. */
|
/* The intention here is to place the AppIcon on the head that
|
||||||
/* printf("appicon: %x %x\n", aicon->icon->core->window, aicon->main_window); */
|
* contains most of the applications _main_ window. */
|
||||||
head = wGetHeadForWindow(aicon->icon->owner);
|
head = wGetHeadForWindow(aicon->icon->owner);
|
||||||
|
|
||||||
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
||||||
@@ -1847,7 +1940,7 @@ wSelectWindow(WWindow *wwin, Bool flag)
|
|||||||
wwin->flags.selected = 1;
|
wwin->flags.selected = 1;
|
||||||
XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel);
|
XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel);
|
||||||
|
|
||||||
if (WFLAGP(wwin, no_border)) {
|
if (!HAS_BORDER(wwin)) {
|
||||||
XSetWindowBorderWidth(dpy, wwin->frame->core->window,
|
XSetWindowBorderWidth(dpy, wwin->frame->core->window,
|
||||||
FRAME_BORDER_WIDTH);
|
FRAME_BORDER_WIDTH);
|
||||||
}
|
}
|
||||||
@@ -1860,7 +1953,7 @@ wSelectWindow(WWindow *wwin, Bool flag)
|
|||||||
XSetWindowBorder(dpy, wwin->frame->core->window,
|
XSetWindowBorder(dpy, wwin->frame->core->window,
|
||||||
scr->frame_border_pixel);
|
scr->frame_border_pixel);
|
||||||
|
|
||||||
if (WFLAGP(wwin, no_border)) {
|
if (!HAS_BORDER(wwin)) {
|
||||||
XSetWindowBorderWidth(dpy, wwin->frame->core->window, 0);
|
XSetWindowBorderWidth(dpy, wwin->frame->core->window, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,4 +65,8 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll);
|
|||||||
|
|
||||||
void wMakeWindowVisible(WWindow *wwin);
|
void wMakeWindowVisible(WWindow *wwin);
|
||||||
|
|
||||||
|
void wFullscreenWindow(WWindow *wwin);
|
||||||
|
void wUnfullscreenWindow(WWindow *wwin);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -407,7 +407,7 @@ setIconCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
||||||
|
|
||||||
if (result && !icon->destroyed) {
|
if (result && !icon->destroyed) {
|
||||||
if (file[0]==0) {
|
if (file && *file==0) {
|
||||||
wfree(file);
|
wfree(file);
|
||||||
file = NULL;
|
file = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-11
@@ -50,6 +50,8 @@
|
|||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
#include "wsound.h"
|
#include "wsound.h"
|
||||||
|
|
||||||
|
#include "xinerama.h"
|
||||||
|
|
||||||
|
|
||||||
/******** Global variables ********/
|
/******** Global variables ********/
|
||||||
|
|
||||||
@@ -123,16 +125,14 @@ findDockIconFor(WDock *dock, Window main_window)
|
|||||||
static void
|
static void
|
||||||
extractIcon(WWindow *wwin)
|
extractIcon(WWindow *wwin)
|
||||||
{
|
{
|
||||||
int argc;
|
char *progname;
|
||||||
char **argv;
|
|
||||||
|
|
||||||
if (!XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc < 1)
|
progname = GetProgramNameForWindow(wwin->client_win);
|
||||||
return;
|
if (progname) {
|
||||||
|
wApplicationExtractDirPackIcon(wwin->screen_ptr, progname,
|
||||||
wApplicationExtractDirPackIcon(wwin->screen_ptr,argv[0],
|
wwin->wm_instance, wwin->wm_class);
|
||||||
wwin->wm_instance,
|
wfree(progname);
|
||||||
wwin->wm_class);
|
}
|
||||||
XFreeStringList(argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
|||||||
val = WMGetFromPLDictionary(adict, iconk);
|
val = WMGetFromPLDictionary(adict, iconk);
|
||||||
} else {
|
} else {
|
||||||
/* no dictionary for app, so create one */
|
/* no dictionary for app, so create one */
|
||||||
adict = WMCreatePLDictionary(NULL, NULL, NULL);
|
adict = WMCreatePLDictionary(NULL, NULL);
|
||||||
WMPutInPLDictionary(dict, key, adict);
|
WMPutInPLDictionary(dict, key, adict);
|
||||||
WMReleasePropList(adict);
|
WMReleasePropList(adict);
|
||||||
val = NULL;
|
val = NULL;
|
||||||
@@ -246,8 +246,10 @@ extractClientIcon(WAppIcon *icon)
|
|||||||
|
|
||||||
|
|
||||||
WApplication*
|
WApplication*
|
||||||
wApplicationCreate(WScreen *scr, Window main_window)
|
wApplicationCreate(WWindow *wwin)
|
||||||
{
|
{
|
||||||
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
Window main_window = wwin->main_window;
|
||||||
WApplication *wapp;
|
WApplication *wapp;
|
||||||
WWindow *leader;
|
WWindow *leader;
|
||||||
|
|
||||||
@@ -295,6 +297,11 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
return NULL;
|
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);
|
extractIcon(wapp->main_window_desc);
|
||||||
|
|
||||||
leader = wWindowFor(main_window);
|
leader = wWindowFor(main_window);
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ typedef struct WApplication {
|
|||||||
} WApplication;
|
} WApplication;
|
||||||
|
|
||||||
|
|
||||||
WApplication *wApplicationCreate(WScreen *scr, Window main_window);
|
WApplication *wApplicationCreate(struct WWindow *wwin);
|
||||||
void wApplicationDestroy(WApplication *wapp);
|
void wApplicationDestroy(WApplication *wapp);
|
||||||
|
|
||||||
WApplication *wApplicationOf(Window window);
|
WApplication *wApplicationOf(Window window);
|
||||||
|
|||||||
+23
-18
@@ -46,6 +46,9 @@
|
|||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
#include "kwm.h"
|
#include "kwm.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
# include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****** Global Variables ******/
|
/****** 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 the window is shaded, wrong height will be set for the window */
|
||||||
if (xcre->value_mask & CWX) {
|
if (xcre->value_mask & CWX) {
|
||||||
nx = xcre->x;
|
nx = xcre->x;
|
||||||
if (!WFLAGP(wwin, no_border))
|
if (HAS_BORDER(wwin))
|
||||||
nx -= FRAME_BORDER_WIDTH;
|
nx -= FRAME_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -247,7 +250,7 @@ wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
|
|||||||
|
|
||||||
if (xcre->value_mask & CWY) {
|
if (xcre->value_mask & CWY) {
|
||||||
ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
|
ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
|
||||||
if (!WFLAGP(wwin, no_border))
|
if (HAS_BORDER(wwin))
|
||||||
ny -= FRAME_BORDER_WIDTH;
|
ny -= FRAME_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -353,21 +356,16 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
case XA_WM_COMMAND:
|
case XA_WM_COMMAND:
|
||||||
if (wwin->main_window!=None) {
|
if (wwin->main_window!=None) {
|
||||||
WApplication *wapp = wApplicationOf(wwin->main_window);
|
WApplication *wapp = wApplicationOf(wwin->main_window);
|
||||||
char **argv;
|
char *command;
|
||||||
int argc;
|
|
||||||
|
|
||||||
if (!wapp || !wapp->app_icon)
|
if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (XGetCommand(dpy, wwin->main_window, &argv, &argc)) {
|
command = GetCommandForWindow(wwin->main_window);
|
||||||
if (argc > 0 && argv != NULL) {
|
if (command) {
|
||||||
if (wapp->app_icon->command)
|
if (wapp->app_icon->command)
|
||||||
wfree(wapp->app_icon->command);
|
wfree(wapp->app_icon->command);
|
||||||
wapp->app_icon->command = wtokenjoin(argv, argc);
|
wapp->app_icon->command = command;
|
||||||
}
|
|
||||||
if (argv) {
|
|
||||||
XFreeStringList(argv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -457,7 +455,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
wApplicationDestroy(wApplicationOf(wwin->main_window));
|
wApplicationDestroy(wApplicationOf(wwin->main_window));
|
||||||
wwin->main_window = wwin->client_leader;
|
wwin->main_window = wwin->client_leader;
|
||||||
wwin->group_id = None;
|
wwin->group_id = None;
|
||||||
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
|
wApplicationCreate(wwin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* 1,2,4 - change leader to new value of window_group */
|
/* 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));
|
wApplicationDestroy(wApplicationOf(wwin->main_window));
|
||||||
wwin->main_window = new_hints->window_group;
|
wwin->main_window = new_hints->window_group;
|
||||||
wwin->group_id = wwin->main_window;
|
wwin->group_id = wwin->main_window;
|
||||||
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
|
wApplicationCreate(wwin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* 5 - destroy application */
|
/* 5 - destroy application */
|
||||||
@@ -481,7 +479,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
case 6:
|
case 6:
|
||||||
wwin->main_window = new_hints->window_group;
|
wwin->main_window = new_hints->window_group;
|
||||||
wwin->group_id = wwin->main_window;
|
wwin->group_id = wwin->main_window;
|
||||||
wApplicationCreate(wwin->screen_ptr, wwin->main_window);
|
wApplicationCreate(wwin);
|
||||||
break;
|
break;
|
||||||
/* 7 - we have a fake window group id, so just ignore anything else */
|
/* 7 - we have a fake window group id, so just ignore anything else */
|
||||||
case 7:
|
case 7:
|
||||||
@@ -630,7 +628,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
else
|
else
|
||||||
foo->main_window = None;
|
foo->main_window = None;
|
||||||
if (foo->main_window) {
|
if (foo->main_window) {
|
||||||
wapp = wApplicationCreate(scr, foo->main_window);
|
wapp = wApplicationCreate(foo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foo = foo->prev;
|
foo = foo->prev;
|
||||||
@@ -665,11 +663,18 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
|
|
||||||
XFree(attr);
|
XFree(attr);
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(KWM_HINTS) || defined(NETWM_HINTS)
|
||||||
|
Bool done = False;
|
||||||
|
#endif
|
||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
Bool done;
|
if (!done)
|
||||||
|
|
||||||
done = wKWMCheckClientHintChange(wwin, event);
|
done = wKWMCheckClientHintChange(wwin, event);
|
||||||
#endif /* KWM_HINTS */
|
#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) {
|
if (hasModifier) {
|
||||||
keymap = XGetModifierMapping(dpy);
|
keymap = XGetModifierMapping(dpy);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Grabbing keyboard\n");
|
||||||
|
#endif
|
||||||
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
}
|
}
|
||||||
@@ -223,11 +225,6 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
wWindowFocus(newFocused, scr->focused_window);
|
wWindowFocus(newFocused, scr->focused_window);
|
||||||
oldFocused = newFocused;
|
oldFocused = newFocused;
|
||||||
|
|
||||||
if (hasModifier)
|
|
||||||
done = False;
|
|
||||||
else
|
|
||||||
done = True;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (wPreferences.popup_switchmenu &&
|
if (wPreferences.popup_switchmenu &&
|
||||||
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
||||||
@@ -236,8 +233,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
openedSwitchMenu = True;
|
openedSwitchMenu = True;
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (ev.type != KeyRelease && ev.type != KeyPress) {
|
||||||
WMHandleEvent(&ev);
|
WMHandleEvent(&ev);
|
||||||
@@ -247,6 +245,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
modifiers = ev.xkey.state & ValidModMask;
|
modifiers = ev.xkey.state & ValidModMask;
|
||||||
|
|
||||||
if (ev.type == KeyPress) {
|
if (ev.type == KeyPress) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Got key press\n");
|
||||||
|
#endif
|
||||||
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
||||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
||||||
|
|
||||||
@@ -274,12 +275,18 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Got something else\n");
|
||||||
|
#endif
|
||||||
somethingElse = True;
|
somethingElse = True;
|
||||||
done = True;
|
done = True;
|
||||||
}
|
}
|
||||||
} else if (ev.type == KeyRelease) {
|
} else if (ev.type == KeyRelease) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Got key release\n");
|
||||||
|
#endif
|
||||||
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
||||||
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
||||||
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
||||||
@@ -294,6 +301,9 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
XFreeModifiermap(keymap);
|
XFreeModifiermap(keymap);
|
||||||
|
|
||||||
if (hasModifier) {
|
if (hasModifier) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Ungrabbing keyboard\n");
|
||||||
|
#endif
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
}
|
}
|
||||||
wSetFocusTo(scr, newFocused);
|
wSetFocusTo(scr, newFocused);
|
||||||
|
|||||||
+32
-7
@@ -155,6 +155,9 @@ static int setUTitleBack();
|
|||||||
static int setResizebarBack();
|
static int setResizebarBack();
|
||||||
static int setWorkspaceBack();
|
static int setWorkspaceBack();
|
||||||
static int setWorkspaceSpecificBack();
|
static int setWorkspaceSpecificBack();
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
static int setVirtualEdgeThickness();
|
||||||
|
#endif
|
||||||
static int setMenuTitleColor();
|
static int setMenuTitleColor();
|
||||||
static int setMenuTextColor();
|
static int setMenuTextColor();
|
||||||
static int setMenuDisabledColor();
|
static int setMenuDisabledColor();
|
||||||
@@ -436,22 +439,34 @@ WDefaultEntry optionList[] = {
|
|||||||
},
|
},
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
{"VirtualEdgeThickness", "1", NULL,
|
{"VirtualEdgeThickness", "1", NULL,
|
||||||
&wPreferences.vedge_thickness, getInt, NULL
|
&wPreferences.vedge_thickness, getInt, setVirtualEdgeThickness
|
||||||
},
|
},
|
||||||
{"VirtualEdgeExtendSpace", "0", NULL,
|
{"VirtualEdgeExtendSpace", "0", NULL,
|
||||||
&wPreferences.vedge_bordersize, getInt, NULL
|
&wPreferences.vedge_bordersize, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeHorizonScrollSpeed", "1", NULL,
|
{"VirtualEdgeHorizonScrollSpeed", "30", NULL,
|
||||||
&wPreferences.vedge_hscrollspeed, getInt, NULL
|
&wPreferences.vedge_hscrollspeed, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeVerticalScrollSpeed", "1", NULL,
|
{"VirtualEdgeVerticalScrollSpeed", "30", NULL,
|
||||||
&wPreferences.vedge_vscrollspeed, getInt, NULL
|
&wPreferences.vedge_vscrollspeed, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeMaximumWidth", "3000", NULL,
|
{"VirtualEdgeResistance", "30", NULL,
|
||||||
&wPreferences.vedge_maxwidth, getInt, NULL
|
&wPreferences.vedge_resistance, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeMaximumHeight", "3000", NULL,
|
{"VirtualEdgeAttraction", "30", NULL,
|
||||||
&wPreferences.vedge_maxheight, getInt, 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
|
#endif
|
||||||
{"StickyIcons", "NO", NULL,
|
{"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
|
static int
|
||||||
setWidgetColor(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
|
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
|
/* check if the file the user selected is not the one that
|
||||||
* would be loaded by default with the current search path */
|
* would be loaded by default with the current search path */
|
||||||
*file = WMGetListSelectedItem(panel->iconList)->text;
|
*file = WMGetListSelectedItem(panel->iconList)->text;
|
||||||
if ((*file)[0]==0) {
|
if (**file==0) {
|
||||||
wfree(*file);
|
wfree(*file);
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -804,6 +804,8 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
*file = NULL;
|
*file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = panel->result;
|
||||||
|
|
||||||
WMReleaseFont(panel->normalfont);
|
WMReleaseFont(panel->normalfont);
|
||||||
|
|
||||||
WMUnmapWidget(panel->win);
|
WMUnmapWidget(panel->win);
|
||||||
@@ -812,8 +814,6 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
|
|
||||||
wUnmanageWindow(wwin, False, False);
|
wUnmanageWindow(wwin, False, False);
|
||||||
|
|
||||||
result= panel->result;
|
|
||||||
|
|
||||||
wfree(panel);
|
wfree(panel);
|
||||||
|
|
||||||
XDestroyWindow(dpy, parent);
|
XDestroyWindow(dpy, parent);
|
||||||
@@ -862,8 +862,8 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
#define COPYRIGHT_TEXT \
|
#define COPYRIGHT_TEXT \
|
||||||
"Copyright © 1997-2004 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
|
"Copyright \xc2\xa9 1997-2004 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
|
||||||
"Copyright © 1998-2004 Dan Pascu <dan@windowmaker.org>"
|
"Copyright \xc2\xa9 1998-2004 Dan Pascu <dan@windowmaker.org>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1314,8 +1314,6 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
WMMoveWidget(panel->copyrL, 15, 185);
|
WMMoveWidget(panel->copyrL, 15, 185);
|
||||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
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);
|
font = WMSystemFontOfSize(scr->wmscreen, 11);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMSetLabelFont(panel->copyrL, font);
|
WMSetLabelFont(panel->copyrL, font);
|
||||||
@@ -1368,7 +1366,7 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
|
|
||||||
strbuf = wstrappend(strbuf, _("\nAdditional support for: "));
|
strbuf = wstrappend(strbuf, _("\nAdditional support for: "));
|
||||||
{
|
{
|
||||||
char *list[8];
|
char *list[9];
|
||||||
char buf[80];
|
char buf[80];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
@@ -1384,6 +1382,9 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
#ifdef OLWM_HINTS
|
#ifdef OLWM_HINTS
|
||||||
list[j++] = "OLWM";
|
list[j++] = "OLWM";
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
list[j++] = "WMSPEC";
|
||||||
|
#endif
|
||||||
|
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
for (i = 0; i < j; i++) {
|
for (i = 0; i < j; i++) {
|
||||||
@@ -1408,6 +1409,23 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
strbuf = wstrappend(strbuf, _("; Antialiased text"));
|
strbuf = wstrappend(strbuf, _("; Antialiased text"));
|
||||||
#endif
|
#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);
|
panel->infoL = WMCreateLabel(panel->win);
|
||||||
WMResizeWidget(panel->infoL, 350, 75);
|
WMResizeWidget(panel->infoL, 350, 75);
|
||||||
|
|||||||
+50
-63
@@ -956,9 +956,8 @@ launchDockedApplication(WAppIcon *btn, Bool withSelection)
|
|||||||
btn->drop_launch = 0;
|
btn->drop_launch = 0;
|
||||||
btn->paste_launch = withSelection;
|
btn->paste_launch = withSelection;
|
||||||
scr->last_dock = btn->dock;
|
scr->last_dock = btn->dock;
|
||||||
btn->pid = execCommand(btn,
|
btn->pid = execCommand(btn, (withSelection ? btn->paste_command :
|
||||||
withSelection ? btn->paste_command : btn->command,
|
btn->command), NULL);
|
||||||
NULL);
|
|
||||||
if (btn->pid>0) {
|
if (btn->pid>0) {
|
||||||
if (btn->buggy_app) {
|
if (btn->buggy_app) {
|
||||||
/* give feedback that the app was launched */
|
/* give feedback that the app was launched */
|
||||||
@@ -972,10 +971,11 @@ launchDockedApplication(WAppIcon *btn, Bool withSelection)
|
|||||||
} else {
|
} else {
|
||||||
wwarning(_("could not launch application %s\n"), btn->command);
|
wwarning(_("could not launch application %s\n"), btn->command);
|
||||||
btn->launching = 0;
|
btn->launching = 0;
|
||||||
if (!btn->relaunching)
|
if (!btn->relaunching) {
|
||||||
btn->running = 0;
|
btn->running = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1450,8 +1450,7 @@ dockSaveState(WDock *dock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dock_state = WMCreatePLDictionary(dApplications, list,
|
dock_state = WMCreatePLDictionary(dApplications, list, NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (dock->type == WM_DOCK) {
|
if (dock->type == WM_DOCK) {
|
||||||
snprintf(buffer, sizeof(buffer), "Applications%i", dock->screen_ptr->scr_height);
|
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
|
if (strncasecmp(WMGetFromPLString(tmp), "applications", 12) == 0
|
||||||
&& !WMGetFromPLDictionary(dock_state, tmp)) {
|
&& !WMGetFromPLDictionary(dock_state, tmp)) {
|
||||||
|
|
||||||
WMPutInPLDictionary(dock_state,
|
WMPutInPLDictionary(dock_state, tmp,
|
||||||
tmp,
|
|
||||||
WMGetFromPLDictionary(old_state, tmp));
|
WMGetFromPLDictionary(old_state, tmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1774,9 +1772,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dPosition);
|
value = WMGetFromPLDictionary(dock_state, dPosition);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
else {
|
} else {
|
||||||
WMRect rect;
|
WMRect rect;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
@@ -1795,12 +1793,13 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
wScreenKeepInside(scr, &x, &dock->y_pos, ICON_SIZE, ICON_SIZE);
|
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 (type == WM_CLIP) {
|
||||||
if (dock->x_pos < 0)
|
if (dock->x_pos < 0) {
|
||||||
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;
|
dock->x_pos = scr->scr_width-ICON_SIZE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (dock->x_pos >= 0) {
|
if (dock->x_pos >= 0) {
|
||||||
dock->x_pos = DOCK_EXTRA_SPACE;
|
dock->x_pos = DOCK_EXTRA_SPACE;
|
||||||
@@ -1820,13 +1819,14 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dLowered);
|
value = WMGetFromPLDictionary(dock_state, dLowered);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("Lowered");
|
COMPLAIN("Lowered");
|
||||||
else {
|
} else {
|
||||||
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->lowered = 1;
|
dock->lowered = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* restore collapsed state */
|
/* restore collapsed state */
|
||||||
@@ -1836,13 +1836,14 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dCollapsed);
|
value = WMGetFromPLDictionary(dock_state, dCollapsed);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("Collapsed");
|
COMPLAIN("Collapsed");
|
||||||
else {
|
} else {
|
||||||
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->collapsed = 1;
|
dock->collapsed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* restore auto-collapsed state */
|
/* restore auto-collapsed state */
|
||||||
@@ -1850,9 +1851,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dAutoCollapse);
|
value = WMGetFromPLDictionary(dock_state, dAutoCollapse);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("AutoCollapse");
|
COMPLAIN("AutoCollapse");
|
||||||
else {
|
} else {
|
||||||
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->auto_collapse = 1;
|
dock->auto_collapse = 1;
|
||||||
dock->collapsed = 1;
|
dock->collapsed = 1;
|
||||||
@@ -1866,9 +1867,9 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dAutoRaiseLower);
|
value = WMGetFromPLDictionary(dock_state, dAutoRaiseLower);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("AutoRaiseLower");
|
COMPLAIN("AutoRaiseLower");
|
||||||
else {
|
} else {
|
||||||
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->auto_raise_lower = 1;
|
dock->auto_raise_lower = 1;
|
||||||
}
|
}
|
||||||
@@ -1882,13 +1883,14 @@ wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
|||||||
value = WMGetFromPLDictionary(dock_state, dAutoAttractIcons);
|
value = WMGetFromPLDictionary(dock_state, dAutoAttractIcons);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!WMIsPLString(value))
|
if (!WMIsPLString(value)) {
|
||||||
COMPLAIN("AutoAttractIcons");
|
COMPLAIN("AutoAttractIcons");
|
||||||
else {
|
} else {
|
||||||
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->attract_icons = 1;
|
dock->attract_icons = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* application list */
|
/* application list */
|
||||||
@@ -2136,21 +2138,19 @@ Bool
|
|||||||
wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
|
wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
|
||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
char **argv;
|
|
||||||
int argc;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
wwin = icon->icon->owner;
|
wwin = icon->icon->owner;
|
||||||
if (icon->command==NULL) {
|
if (icon->command==NULL) {
|
||||||
|
char *command;
|
||||||
|
|
||||||
icon->editing = 0;
|
icon->editing = 0;
|
||||||
if (XGetCommand(dpy, wwin->client_win, &argv, &argc) && argc>0) {
|
|
||||||
|
|
||||||
icon->command = wtokenjoin(argv, argc);
|
command = GetCommandForWindow(wwin->client_win);
|
||||||
XFreeStringList(argv);
|
if (command) {
|
||||||
|
icon->command = command;
|
||||||
} else {
|
} else {
|
||||||
char *command=NULL;
|
/* icon->forced_dock = 1;*/
|
||||||
|
|
||||||
/* icon->forced_dock = 1;*/
|
|
||||||
if (dock->type!=WM_CLIP || !icon->attracted) {
|
if (dock->type!=WM_CLIP || !icon->attracted) {
|
||||||
icon->editing = 1;
|
icon->editing = 1;
|
||||||
if (wInputDialog(dock->screen_ptr, _("Dock Icon"),
|
if (wInputDialog(dock->screen_ptr, _("Dock Icon"),
|
||||||
@@ -2266,8 +2266,7 @@ Bool
|
|||||||
moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
|
moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
|
||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
char **argv;
|
char *command;
|
||||||
int argc;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (src == dest)
|
if (src == dest)
|
||||||
@@ -2285,15 +2284,12 @@ moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y)
|
|||||||
* moved icons it applies. -Dan
|
* moved icons it applies. -Dan
|
||||||
*/
|
*/
|
||||||
if ((dest->type==WM_DOCK /*|| dest->keep_attracted*/) && icon->command==NULL) {
|
if ((dest->type==WM_DOCK /*|| dest->keep_attracted*/) && icon->command==NULL) {
|
||||||
if (XGetCommand(dpy, wwin->client_win, &argv, &argc) && argc>0) {
|
command = GetCommandForWindow(wwin->client_win);
|
||||||
|
if (command) {
|
||||||
icon->command = wtokenjoin(argv, argc);
|
icon->command = command;
|
||||||
XFreeStringList(argv);
|
|
||||||
} else {
|
} else {
|
||||||
char *command=NULL;
|
|
||||||
|
|
||||||
icon->editing = 1;
|
icon->editing = 1;
|
||||||
/* icon->forced_dock = 1;*/
|
/* icon->forced_dock = 1;*/
|
||||||
if (wInputDialog(src->screen_ptr, _("Dock Icon"),
|
if (wInputDialog(src->screen_ptr, _("Dock Icon"),
|
||||||
_("Type the command used to launch the application"),
|
_("Type the command used to launch the application"),
|
||||||
&command)) {
|
&command)) {
|
||||||
@@ -3177,22 +3173,15 @@ wDockTrackWindowLaunch(WDock *dock, Window window)
|
|||||||
Bool found = False;
|
Bool found = False;
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
|
|
||||||
{
|
command = GetCommandForWindow(window);
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
|
|
||||||
if (XGetCommand(dpy, window, &argv, &argc)) {
|
|
||||||
if (argc > 0 && argv != NULL)
|
|
||||||
command = wtokenjoin(argv, argc);
|
|
||||||
if (argv) {
|
|
||||||
XFreeStringList(argv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PropGetWMClass(window, &wm_class, &wm_instance) ||
|
if (!PropGetWMClass(window, &wm_class, &wm_instance) ||
|
||||||
(!wm_class && !wm_instance))
|
(!wm_class && !wm_instance)) {
|
||||||
|
|
||||||
|
if (command)
|
||||||
|
wfree(command);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
for (i=0; i<dock->max_icons; i++) {
|
for (i=0; i<dock->max_icons; i++) {
|
||||||
@@ -3232,9 +3221,9 @@ retry:
|
|||||||
icon->forced_dock = 1;
|
icon->forced_dock = 1;
|
||||||
icon->running = 0;
|
icon->running = 0;
|
||||||
}
|
}
|
||||||
if (!icon->forced_dock)
|
if (!icon->forced_dock) {
|
||||||
icon->main_window = window;
|
icon->main_window = window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
found = True;
|
found = True;
|
||||||
if (!wPreferences.no_animations && !icon->launching &&
|
if (!wPreferences.no_animations && !icon->launching &&
|
||||||
@@ -3598,8 +3587,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
wWorkspaceChange(dock->screen_ptr, wapp->last_workspace);
|
wWorkspaceChange(dock->screen_ptr, wapp->last_workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
wUnhideApplication(wapp, event->xbutton.button==Button2,
|
wUnhideApplication(wapp, event->xbutton.button==Button2, unhideHere);
|
||||||
unhideHere);
|
|
||||||
|
|
||||||
if (event->xbutton.state & MOD_MASK) {
|
if (event->xbutton.state & MOD_MASK) {
|
||||||
wHideOtherApplications(btn->icon->owner);
|
wHideOtherApplications(btn->icon->owner);
|
||||||
@@ -3620,9 +3608,8 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
(!btn->running || (event->xbutton.state & ControlMask))) {
|
(!btn->running || (event->xbutton.state & ControlMask))) {
|
||||||
launchDockedApplication(btn, False);
|
launchDockedApplication(btn, False);
|
||||||
}
|
}
|
||||||
} else if (btn->xindex == 0 && btn->yindex == 0
|
} else if (btn->xindex==0 && btn->yindex==0 &&
|
||||||
&& btn->dock->type == WM_DOCK) {
|
btn->dock->type==WM_DOCK) {
|
||||||
|
|
||||||
wShowGNUstepPanel(dock->screen_ptr);
|
wShowGNUstepPanel(dock->screen_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+83
-39
@@ -66,9 +66,13 @@
|
|||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
# include "kwm.h"
|
# include "kwm.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
# include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/******** Global Variables **********/
|
/******** Global Variables **********/
|
||||||
extern XContext wWinContext;
|
extern XContext wWinContext;
|
||||||
|
extern XContext wVEdgeContext;
|
||||||
|
|
||||||
extern Cursor wCursor[WCUR_LAST];
|
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
|
Bool
|
||||||
IsDoubleClick(WScreen *scr, XEvent *event)
|
IsDoubleClick(WScreen *scr, XEvent *event)
|
||||||
@@ -478,7 +515,7 @@ handleMapRequest(XEvent *ev)
|
|||||||
Window window = ev->xmaprequest.window;
|
Window window = ev->xmaprequest.window;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got map request for %x\n", (unsigned)window);
|
printf("got map request for %x\n", (unsigned)window);
|
||||||
#endif
|
#endif
|
||||||
if ((wwin = wWindowFor(window))) {
|
if ((wwin = wWindowFor(window))) {
|
||||||
if (wwin->flags.shaded) {
|
if (wwin->flags.shaded) {
|
||||||
@@ -553,7 +590,7 @@ handleDestroyNotify(XEvent *event)
|
|||||||
int index;
|
int index;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got destroy notify");
|
printf("got destroy notify\n");
|
||||||
#endif
|
#endif
|
||||||
wwin = wWindowFor(window);
|
wwin = wWindowFor(window);
|
||||||
if (wwin) {
|
if (wwin) {
|
||||||
@@ -607,7 +644,7 @@ handleExpose(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got expose");
|
printf("got expose\n");
|
||||||
#endif
|
#endif
|
||||||
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
||||||
|
|
||||||
@@ -662,7 +699,7 @@ handleButtonPress(XEvent *event)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got button press");
|
printf("got button press\n");
|
||||||
#endif
|
#endif
|
||||||
scr = wScreenForRootWindow(event->xbutton.root);
|
scr = wScreenForRootWindow(event->xbutton.root);
|
||||||
|
|
||||||
@@ -749,7 +786,7 @@ handleMapNotify(XEvent *event)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got map");
|
printf("got map\n");
|
||||||
#endif
|
#endif
|
||||||
wwin = wWindowFor(event->xmap.event);
|
wwin = wWindowFor(event->xmap.event);
|
||||||
if (wwin && wwin->client_win == event->xmap.event) {
|
if (wwin && wwin->client_win == event->xmap.event) {
|
||||||
@@ -772,7 +809,7 @@ handleUnmapNotify(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
Bool withdraw = False;
|
Bool withdraw = False;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got unmap");
|
printf("got unmap\n");
|
||||||
#endif
|
#endif
|
||||||
/* only process windows with StructureNotify selected
|
/* only process windows with StructureNotify selected
|
||||||
* (ignore SubstructureNotify) */
|
* (ignore SubstructureNotify) */
|
||||||
@@ -824,7 +861,7 @@ handleConfigureRequest(XEvent *event)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got configure request");
|
printf("got configure request\n");
|
||||||
#endif
|
#endif
|
||||||
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
||||||
/*
|
/*
|
||||||
@@ -847,7 +884,7 @@ handlePropertyNotify(XEvent *event)
|
|||||||
unsigned int ju;
|
unsigned int ju;
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got property notify");
|
printf("got property notify\n");
|
||||||
#endif
|
#endif
|
||||||
if ((wwin=wWindowFor(event->xproperty.window))) {
|
if ((wwin=wWindowFor(event->xproperty.window))) {
|
||||||
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
||||||
@@ -876,7 +913,7 @@ handleClientMessage(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WObjDescriptor *desc;
|
WObjDescriptor *desc;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got client message");
|
printf("got client message\n");
|
||||||
#endif
|
#endif
|
||||||
/* handle transition from Normal to Iconic state */
|
/* handle transition from Normal to Iconic state */
|
||||||
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
||||||
@@ -962,6 +999,10 @@ handleClientMessage(XEvent *event)
|
|||||||
wFrameWindowChangeState(wwin->frame, WS_FOCUSED);
|
wFrameWindowChangeState(wwin->frame, WS_FOCUSED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
} else if (wNETWMProcessClientMessage(&event->xclient)) {
|
||||||
|
/* do nothing */
|
||||||
|
#endif
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
} else if (wGNOMEProcessClientMessage(&event->xclient)) {
|
} else if (wGNOMEProcessClientMessage(&event->xclient)) {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
@@ -1035,34 +1076,19 @@ handleEnterNotify(XEvent *event)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WObjDescriptor *desc = NULL;
|
WObjDescriptor *desc = NULL;
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
void (*vdHandler)(XEvent * event);
|
||||||
|
#endif
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got enter notify");
|
printf("got enter notify\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
/* TODO: acceleration code */
|
if (XFindContext(dpy, event->xcrossing.window, wVEdgeContext,
|
||||||
if (wPreferences.vedge_thickness) {
|
(XPointer *)&vdHandler)!=XCNOENT) {
|
||||||
int x,y;
|
(*vdHandler)( event);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1178,7 +1204,7 @@ handleShapeNotify(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got shape notify");
|
printf("got shape notify\n");
|
||||||
#endif
|
#endif
|
||||||
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
||||||
XShapeEvent *sev = (XShapeEvent*)&ev;
|
XShapeEvent *sev = (XShapeEvent*)&ev;
|
||||||
@@ -1446,7 +1472,7 @@ handleKeyPress(XEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WKBD_MAXIMIZE:
|
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);
|
int newdir = (MAX_VERTICAL|MAX_HORIZONTAL);
|
||||||
|
|
||||||
CloseWindowMenu(scr);
|
CloseWindowMenu(scr);
|
||||||
@@ -1459,7 +1485,7 @@ handleKeyPress(XEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WKBD_VMAXIMIZE:
|
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);
|
int newdir = (MAX_VERTICAL ^ wwin->flags.maximized);
|
||||||
|
|
||||||
CloseWindowMenu(scr);
|
CloseWindowMenu(scr);
|
||||||
@@ -1472,7 +1498,7 @@ handleKeyPress(XEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WKBD_HMAXIMIZE:
|
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);
|
int newdir = (MAX_HORIZONTAL ^ wwin->flags.maximized);
|
||||||
|
|
||||||
CloseWindowMenu(scr);
|
CloseWindowMenu(scr);
|
||||||
@@ -1515,7 +1541,8 @@ handleKeyPress(XEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WKBD_MOVERESIZE:
|
case WKBD_MOVERESIZE:
|
||||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
if (ISMAPPED(wwin) && ISFOCUSED(wwin) &&
|
||||||
|
(IS_RESIZABLE(wwin) || IS_MOVABLE(wwin))) {
|
||||||
CloseWindowMenu(scr);
|
CloseWindowMenu(scr);
|
||||||
|
|
||||||
wKeyboardMoveResizeWindow(wwin);
|
wKeyboardMoveResizeWindow(wwin);
|
||||||
@@ -1718,6 +1745,23 @@ handleKeyPress(XEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#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)) {
|
p.y >= (rect.pos.y + rect.size.height - 2)) {
|
||||||
WMenu *menu;
|
WMenu *menu;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("pointer at screen edge");
|
printf("pointer at screen edge\n");
|
||||||
#endif
|
#endif
|
||||||
menu = wMenuUnderPointer(scr);
|
menu = wMenuUnderPointer(scr);
|
||||||
if (menu!=NULL)
|
if (menu!=NULL)
|
||||||
@@ -1773,13 +1817,13 @@ handleMotionNotify(XEvent *event)
|
|||||||
&& event->xmotion.x_root >= wwin->frame_x
|
&& event->xmotion.x_root >= wwin->frame_x
|
||||||
&& event->xmotion.x_root <= wwin->frame_x + wwin->frame->core->width) {
|
&& 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) {
|
&& wwin->frame_y <= - wwin->frame->top_width) {
|
||||||
|
|
||||||
wWindowMove(wwin, wwin->frame_x, 0);
|
wWindowMove(wwin, wwin->frame_x, 0);
|
||||||
wwin->flags.dragged_while_fmaximized = 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 >=
|
&& wwin->frame_y + wwin->frame->core->height >=
|
||||||
scr->scr_height + wwin->frame->bottom_width) {
|
scr->scr_height + wwin->frame->bottom_width) {
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -1488,12 +1488,14 @@ titlebarMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
WCoreWindow *titlebar = desc->self;
|
WCoreWindow *titlebar = desc->self;
|
||||||
|
|
||||||
if (IsDoubleClick(fwin->core->screen_ptr, event)) {
|
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);
|
(*fwin->on_dblclick_titlebar)(titlebar, fwin->child, event);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fwin->on_mousedown_titlebar)
|
if (fwin->on_mousedown_titlebar) {
|
||||||
(*fwin->on_mousedown_titlebar)(titlebar, fwin->child, event);
|
(*fwin->on_mousedown_titlebar)(titlebar, fwin->child, event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1534,7 +1536,8 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
if (button == fwin->language_button) {
|
if (button == fwin->language_button) {
|
||||||
if (!wPreferences.modelock) return;
|
if (!wPreferences.modelock)
|
||||||
|
return;
|
||||||
image = fwin->languagebutton_image;
|
image = fwin->languagebutton_image;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+12
@@ -152,6 +152,18 @@ void ExecExitScript();
|
|||||||
Bool wFetchName(Display *dpy, Window win, char **winname);
|
Bool wFetchName(Display *dpy, Window win, char **winname);
|
||||||
Bool wGetIconName(Display *dpy, Window win, char **iconname);
|
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
|
#endif
|
||||||
|
|||||||
+10
-1
@@ -165,6 +165,11 @@ wIconCreate(WWindow *wwin)
|
|||||||
icon->show_title = 0;
|
icon->show_title = 0;
|
||||||
#else
|
#else
|
||||||
icon->show_title = 1;
|
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
|
#endif
|
||||||
icon->image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class);
|
icon->image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class);
|
||||||
|
|
||||||
@@ -631,7 +636,11 @@ wIconUpdate(WIcon *icon)
|
|||||||
icon->pixmap = None;
|
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;
|
goto user_icon;
|
||||||
|
|
||||||
/* use client specified icon window */
|
/* use client specified icon window */
|
||||||
|
|||||||
+13
-3
@@ -80,10 +80,20 @@
|
|||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
# define WKBD_TOGGLE 46
|
# define WKBD_TOGGLE 46
|
||||||
# define WKBD_LAST 47
|
# define WKBD_TMP 47
|
||||||
#else
|
#else
|
||||||
# define WKBD_LAST 46
|
# define WKBD_TMP 46
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#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 {
|
typedef struct WShortKey {
|
||||||
|
|||||||
+16
-8
@@ -85,6 +85,7 @@ WDDomain *WDRootMenu = NULL;
|
|||||||
XContext wWinContext;
|
XContext wWinContext;
|
||||||
XContext wAppWinContext;
|
XContext wAppWinContext;
|
||||||
XContext wStackContext;
|
XContext wStackContext;
|
||||||
|
XContext wVEdgeContext;
|
||||||
|
|
||||||
/* Atoms */
|
/* Atoms */
|
||||||
Atom _XA_WM_STATE;
|
Atom _XA_WM_STATE;
|
||||||
@@ -123,9 +124,9 @@ Atom _XA_DND_SELECTION;
|
|||||||
Cursor wCursor[WCUR_LAST];
|
Cursor wCursor[WCUR_LAST];
|
||||||
|
|
||||||
/* last event timestamp for XSetInputFocus */
|
/* last event timestamp for XSetInputFocus */
|
||||||
Time LastTimestamp;
|
Time LastTimestamp = CurrentTime;
|
||||||
/* timestamp on the last time we did XSetInputFocus() */
|
/* timestamp on the last time we did XSetInputFocus() */
|
||||||
Time LastFocusChange;
|
Time LastFocusChange = CurrentTime;
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
Bool wShapeSupported;
|
Bool wShapeSupported;
|
||||||
@@ -494,8 +495,10 @@ check_defaults()
|
|||||||
static void
|
static void
|
||||||
execInitScript()
|
execInitScript()
|
||||||
{
|
{
|
||||||
char *file;
|
char *file, *paths;
|
||||||
char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
|
|
||||||
|
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
|
||||||
|
paths = wstrappend(paths, ":"DEF_CONFIG_PATHS);
|
||||||
|
|
||||||
file = wfindfile(paths, DEF_INIT_SCRIPT);
|
file = wfindfile(paths, DEF_INIT_SCRIPT);
|
||||||
wfree(paths);
|
wfree(paths);
|
||||||
@@ -519,8 +522,10 @@ execInitScript()
|
|||||||
void
|
void
|
||||||
ExecExitScript()
|
ExecExitScript()
|
||||||
{
|
{
|
||||||
char *file;
|
char *file, *paths;
|
||||||
char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
|
|
||||||
|
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
|
||||||
|
paths = wstrappend(paths, ":"DEF_CONFIG_PATHS);
|
||||||
|
|
||||||
file = wfindfile(paths, DEF_EXIT_SCRIPT);
|
file = wfindfile(paths, DEF_EXIT_SCRIPT);
|
||||||
wfree(paths);
|
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");
|
Locale = getenv("LC_ALL");
|
||||||
}
|
|
||||||
if (!Locale) {
|
if (!Locale) {
|
||||||
Locale = getenv("LANG");
|
Locale = getenv("LANG");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -43,6 +43,7 @@
|
|||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "xinerama.h"
|
#include "xinerama.h"
|
||||||
|
#include "workspace.h"
|
||||||
|
|
||||||
|
|
||||||
/****** Global Variables ******/
|
/****** Global Variables ******/
|
||||||
@@ -2259,9 +2260,7 @@ byebye:
|
|||||||
|
|
||||||
((WMenu*)desc->parent)->flags.inside_handler = 0;
|
((WMenu*)desc->parent)->flags.inside_handler = 0;
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
if (wPreferences.vedge_thickness) {
|
|
||||||
wWorkspaceRaiseEdge(scr);
|
wWorkspaceRaiseEdge(scr);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2510,7 +2509,7 @@ wMenuSaveState(WScreen *scr)
|
|||||||
WMPropList *menus, *key;
|
WMPropList *menus, *key;
|
||||||
int save_menus = 0;
|
int save_menus = 0;
|
||||||
|
|
||||||
menus = WMCreatePLDictionary(NULL, NULL, NULL);
|
menus = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
|
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
|
||||||
|
|||||||
+120
-3
@@ -52,8 +52,6 @@
|
|||||||
|
|
||||||
/**** global variables *****/
|
/**** global variables *****/
|
||||||
|
|
||||||
extern char *DisplayName;
|
|
||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
extern Time LastTimestamp;
|
extern Time LastTimestamp;
|
||||||
@@ -1244,7 +1242,6 @@ UpdateDomainFile(WDDomain *domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
StrConcatDot(char *a, char *b)
|
StrConcatDot(char *a, char *b)
|
||||||
{
|
{
|
||||||
@@ -1263,3 +1260,123 @@ StrConcatDot(char *a, char *b)
|
|||||||
|
|
||||||
return str;
|
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
|
/* True if window currently has a border. This also includes borderless
|
||||||
* windows which are currently selected
|
* 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 ******/
|
/****** Global Variables ******/
|
||||||
@@ -236,8 +236,7 @@ mapPositionDisplay(WWindow *wwin, int x, int y, int w, int h)
|
|||||||
return;
|
return;
|
||||||
} else if (wPreferences.move_display == WDIS_CENTER) {
|
} else if (wPreferences.move_display == WDIS_CENTER) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
||||||
moveGeometryDisplayCentered(scr,
|
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
|
||||||
rect.pos.x + rect.size.width/2,
|
|
||||||
rect.pos.y + rect.size.height/2);
|
rect.pos.y + rect.size.height/2);
|
||||||
} else if (wPreferences.move_display == WDIS_TOPLEFT) {
|
} else if (wPreferences.move_display == WDIS_TOPLEFT) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
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? */
|
* x2-1 everywhere below in the code). But why only for x? */
|
||||||
x1--; x2--;
|
x1--; x2--;
|
||||||
|
|
||||||
if (HAS_BORDER(wwin)) {
|
if (HAS_BORDER_WITH_SELECT(wwin)) {
|
||||||
x1 += FRAME_BORDER_WIDTH;
|
x1 += FRAME_BORDER_WIDTH;
|
||||||
x2 += FRAME_BORDER_WIDTH;
|
x2 += FRAME_BORDER_WIDTH;
|
||||||
y1 += 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 {
|
} else {
|
||||||
if (wPreferences.size_display == WDIS_CENTER) {
|
if (wPreferences.size_display == WDIS_CENTER) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
||||||
moveGeometryDisplayCentered(scr,
|
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
|
||||||
rect.pos.x + rect.size.width/2,
|
|
||||||
rect.pos.y + rect.size.height/2);
|
rect.pos.y + rect.size.height/2);
|
||||||
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
|
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
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) {
|
if (wPreferences.size_display == WDIS_CENTER) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
||||||
moveGeometryDisplayCentered(scr,
|
moveGeometryDisplayCentered(scr, rect.pos.x + rect.size.width/2,
|
||||||
rect.pos.x + rect.size.width/2,
|
|
||||||
rect.pos.y + rect.size.height/2);
|
rect.pos.y + rect.size.height/2);
|
||||||
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
|
} else if (wPreferences.size_display == WDIS_TOPLEFT) {
|
||||||
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
rect = wGetRectForHead(scr, wGetHeadForWindow(wwin));
|
||||||
@@ -497,15 +494,15 @@ drawTransparentFrame(WWindow *wwin, int x, int y, int width, int height)
|
|||||||
int h = 0;
|
int h = 0;
|
||||||
int bottom = 0;
|
int bottom = 0;
|
||||||
|
|
||||||
if (HAS_BORDER(wwin)) {
|
if (HAS_BORDER_WITH_SELECT(wwin)) {
|
||||||
x += FRAME_BORDER_WIDTH;
|
x += FRAME_BORDER_WIDTH;
|
||||||
y += 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;
|
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
|
/* Can't use wwin-frame->bottom_width because, in some cases
|
||||||
(e.g. interactive placement), frame does not point to anything. */
|
(e.g. interactive placement), frame does not point to anything. */
|
||||||
bottom = RESIZEBAR_HEIGHT;
|
bottom = RESIZEBAR_HEIGHT;
|
||||||
@@ -640,9 +637,9 @@ typedef struct {
|
|||||||
#define WTOP(w) (w)->frame_y
|
#define WTOP(w) (w)->frame_y
|
||||||
#define WLEFT(w) (w)->frame_x
|
#define WLEFT(w) (w)->frame_x
|
||||||
#define WRIGHT(w) ((w)->frame_x + (int)(w)->frame->core->width - 1 + \
|
#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 + \
|
#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
|
static int
|
||||||
compareWTop(const void *a, const void *b)
|
compareWTop(const void *a, const void *b)
|
||||||
@@ -900,9 +897,9 @@ initMoveData(WWindow *wwin, MoveData *data)
|
|||||||
data->calcY = wwin->frame_y;
|
data->calcY = wwin->frame_y;
|
||||||
|
|
||||||
data->winWidth = wwin->frame->core->width +
|
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 +
|
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 _KS KEY_CONTROL_WINDOW_WEIGHT
|
||||||
|
|
||||||
|
#define MOVABLE_BIT 0x01
|
||||||
|
#define RESIZABLE_BIT 0x02
|
||||||
|
|
||||||
int
|
int
|
||||||
wKeyboardMoveResizeWindow(WWindow *wwin)
|
wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||||
{
|
{
|
||||||
@@ -1309,15 +1309,24 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
int done,off_x,off_y,ww,wh;
|
int done,off_x,off_y,ww,wh;
|
||||||
int kspeed = _KS;
|
int kspeed = _KS;
|
||||||
Time lastTime = 0;
|
Time lastTime = 0;
|
||||||
|
KeyCode shiftl, shiftr, ctrll, ctrlmode;
|
||||||
KeySym keysym=NoSymbol;
|
KeySym keysym=NoSymbol;
|
||||||
int moment=0;
|
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);
|
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||||
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
|
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
|
||||||
ctrll = XKeysymToKeycode(dpy, XK_Control_L);
|
ctrll = XKeysymToKeycode(dpy, XK_Control_L);
|
||||||
ctrlmode=done=off_x=off_y=0;
|
ctrlmode=done=off_x=off_y=0;
|
||||||
|
|
||||||
|
if (modes == RESIZABLE_BIT) {
|
||||||
|
ctrlmode = 1;
|
||||||
|
}
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
wusleep(10000);
|
wusleep(10000);
|
||||||
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
|
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
@@ -1383,14 +1392,15 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
}
|
}
|
||||||
if (kspeed < _KS) kspeed = _KS;
|
if (kspeed < _KS) kspeed = _KS;
|
||||||
lastTime = event.xkey.time;
|
lastTime = event.xkey.time;
|
||||||
|
if (modes == (MOVABLE_BIT|RESIZABLE_BIT)) {
|
||||||
if (event.xkey.state & ControlMask && !wwin->flags.shaded) {
|
if ((event.xkey.state & ControlMask) && !wwin->flags.shaded) {
|
||||||
ctrlmode=1;
|
ctrlmode=1;
|
||||||
wUnselectWindows(scr);
|
wUnselectWindows(scr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ctrlmode=0;
|
ctrlmode=0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) {
|
if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) {
|
||||||
if (ctrlmode)
|
if (ctrlmode)
|
||||||
cycleGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh, 0);
|
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);
|
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)
|
} else if(!scr->selected_windows)
|
||||||
showPosition(wwin, src_x+off_x, src_y+off_y);
|
showPosition(wwin, src_x+off_x, src_y+off_y);
|
||||||
/**/
|
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
scr->keymove_tick=0;
|
scr->keymove_tick=0;
|
||||||
@@ -1599,6 +1609,17 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
||||||
wSetFocusTo(scr, wwin);
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1638,12 +1659,15 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
|
|||||||
/* This needs not to change while moving, else bad things can happen */
|
/* This needs not to change while moving, else bad things can happen */
|
||||||
int opaqueMove = wPreferences.opaque_move;
|
int opaqueMove = wPreferences.opaque_move;
|
||||||
MoveData moveData;
|
MoveData moveData;
|
||||||
|
int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1)
|
||||||
|
? wGetHeadForWindow(wwin)
|
||||||
|
: scr->xine_info.primary_head);
|
||||||
#ifdef GHOST_WINDOW_MOVE
|
#ifdef GHOST_WINDOW_MOVE
|
||||||
RImage *rimg;
|
RImage *rimg = InitGhostWindowMove(scr);
|
||||||
|
|
||||||
rimg = InitGhostWindowMove(scr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!IS_MOVABLE(wwin))
|
||||||
|
return False;
|
||||||
|
|
||||||
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
|
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
@@ -1873,7 +1897,6 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
|
|||||||
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
|
if (wPreferences.opaque_move && !wPreferences.use_saveunders) {
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
|
||||||
|
|
||||||
attr.save_under = False;
|
attr.save_under = False;
|
||||||
XChangeWindowAttributes(dpy, wwin->frame->core->window,
|
XChangeWindowAttributes(dpy, wwin->frame->core->window,
|
||||||
CWSaveUnder, &attr);
|
CWSaveUnder, &attr);
|
||||||
@@ -1882,6 +1905,16 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
|
|||||||
|
|
||||||
freeMoveData(&moveData);
|
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;
|
return started;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1964,6 +1997,12 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
|
|||||||
int orig_fy = fy;
|
int orig_fy = fy;
|
||||||
int orig_fw = fw;
|
int orig_fw = fw;
|
||||||
int orig_fh = fh;
|
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) {
|
if (wwin->flags.shaded) {
|
||||||
wwarning("internal error: tryein");
|
wwarning("internal error: tryein");
|
||||||
@@ -1984,7 +2023,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
|
|||||||
ry2 = fy + fh - 1;
|
ry2 = fy + fh - 1;
|
||||||
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
|
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||||
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
|
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;
|
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
|
||||||
else
|
else
|
||||||
h = 0;
|
h = 0;
|
||||||
@@ -2165,6 +2204,15 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
|
|||||||
WMHandleEvent(&event);
|
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
|
#undef LEFT
|
||||||
@@ -2316,11 +2364,11 @@ InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
*y_ret = 0;
|
*y_ret = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_titlebar)) {
|
if (HAS_TITLEBAR(wwin)) {
|
||||||
h = WMFontHeight(scr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
|
h = WMFontHeight(scr->title_font) + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) * 2;
|
||||||
height += h;
|
height += h;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_resizebar)) {
|
if (HAS_RESIZEBAR(wwin)) {
|
||||||
height += RESIZEBAR_HEIGHT;
|
height += RESIZEBAR_HEIGHT;
|
||||||
}
|
}
|
||||||
XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
|
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,
|
unsigned int width, unsigned int height,
|
||||||
WArea usableArea)
|
WArea usableArea)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
//WScreen *scr = wwin->screen_ptr;
|
||||||
int test_x = 0, test_y = Y_ORIGIN(scr);
|
int test_x = 0, test_y = Y_ORIGIN(scr);
|
||||||
int from_x, to_x, from_y, to_y;
|
int from_x, to_x, from_y, to_y;
|
||||||
int sx;
|
int sx;
|
||||||
int min_isect, min_isect_x, min_isect_y;
|
int min_isect, min_isect_x, min_isect_y;
|
||||||
int sum_isect;
|
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);
|
sx = X_ORIGIN(scr);
|
||||||
|
|
||||||
min_isect = INT_MAX;
|
min_isect = INT_MAX;
|
||||||
min_isect_x = sx;
|
min_isect_x = sx;
|
||||||
min_isect_y = test_y;
|
min_isect_y = test_y;
|
||||||
|
|
||||||
height += extra_height;
|
|
||||||
|
|
||||||
while (((test_y + height) < usableArea.y2)) {
|
while (((test_y + height) < usableArea.y2)) {
|
||||||
|
|
||||||
test_x = sx;
|
test_x = sx;
|
||||||
|
|
||||||
while ((test_x + width) < usableArea.x2) {
|
while ((test_x + width) < usableArea.x2) {
|
||||||
|
|
||||||
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
sum_isect = calcSumOfCoveredAreas(wwin, test_x, test_y,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
@@ -430,21 +429,23 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
int loc_ok = False, tw,tx,ty,th;
|
int loc_ok = False, tw,tx,ty,th;
|
||||||
int swidth, sx;
|
int swidth, sx;
|
||||||
WWindow *test_window;
|
WWindow *test_window;
|
||||||
int extra_height;
|
|
||||||
|
|
||||||
|
if (wwin->frame) {
|
||||||
if (wwin->frame)
|
height += wwin->frame->top_width + wwin->frame->bottom_width;
|
||||||
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
|
} else {
|
||||||
else
|
if (HAS_TITLEBAR(wwin)) height += 18;
|
||||||
extra_height = 24; /* random value */
|
if (HAS_RESIZEBAR(wwin)) height += 8;
|
||||||
|
}
|
||||||
|
if (HAS_BORDER(wwin)) {
|
||||||
|
height += 2;
|
||||||
|
width += 2;
|
||||||
|
}
|
||||||
|
|
||||||
swidth = usableArea.x2-usableArea.x1;
|
swidth = usableArea.x2-usableArea.x1;
|
||||||
sx = X_ORIGIN(scr);
|
sx = X_ORIGIN(scr);
|
||||||
|
|
||||||
/* this was based on fvwm2's smart placement */
|
/* this was based on fvwm2's smart placement */
|
||||||
|
|
||||||
height += extra_height;
|
|
||||||
|
|
||||||
while (((test_y + height) < (usableArea.y2 - usableArea.y1)) && !loc_ok) {
|
while (((test_y + height) < (usableArea.y2 - usableArea.y1)) && !loc_ok) {
|
||||||
test_x = sx;
|
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,
|
unsigned int width, unsigned int height, int h,
|
||||||
WArea usableArea)
|
WArea usableArea)
|
||||||
{
|
{
|
||||||
unsigned int extra_height;
|
if (wwin->frame) {
|
||||||
|
height += wwin->frame->top_width + wwin->frame->bottom_width;
|
||||||
|
} else {
|
||||||
if (wwin->frame)
|
if (HAS_TITLEBAR(wwin)) height += 18;
|
||||||
extra_height = wwin->frame->top_width + wwin->frame->bottom_width;
|
if (HAS_RESIZEBAR(wwin)) height += 8;
|
||||||
else
|
}
|
||||||
extra_height = 24; /* random value */
|
if (HAS_BORDER(wwin)) {
|
||||||
|
height += 2;
|
||||||
|
width += 2;
|
||||||
|
}
|
||||||
|
|
||||||
*x_ret = h * scr->cascade_index + X_ORIGIN(scr);
|
*x_ret = h * scr->cascade_index + X_ORIGIN(scr);
|
||||||
*y_ret = h * scr->cascade_index + Y_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) {
|
if (width + *x_ret > usableArea.x2 || height + *y_ret > usableArea.y2) {
|
||||||
scr->cascade_index = 0;
|
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,
|
unsigned int width, unsigned int height,
|
||||||
WArea usableArea)
|
WArea usableArea)
|
||||||
{
|
{
|
||||||
int w, h, extra_height;
|
int w, h;
|
||||||
|
|
||||||
if (wwin->frame)
|
if (wwin->frame) {
|
||||||
extra_height = wwin->frame->top_width + wwin->frame->bottom_width + 2;
|
height += wwin->frame->top_width + wwin->frame->bottom_width;
|
||||||
else
|
} else {
|
||||||
extra_height = 24; /* random value */
|
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);
|
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 (w<1) w = 1;
|
||||||
if (h<1) h = 1;
|
if (h<1) h = 1;
|
||||||
*x_ret = X_ORIGIN(scr) + rand()%w;
|
*x_ret = X_ORIGIN(scr) + rand()%w;
|
||||||
|
|||||||
+37
-13
@@ -62,6 +62,9 @@
|
|||||||
#ifdef OLWM_HINTS
|
#ifdef OLWM_HINTS
|
||||||
# include "openlook.h"
|
# include "openlook.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
# include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "xinerama.h"
|
#include "xinerama.h"
|
||||||
|
|
||||||
@@ -787,6 +790,10 @@ wScreenInit(int screen_number)
|
|||||||
wOLWMInitStuff(scr);
|
wOLWMInitStuff(scr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMInitStuff(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* create initial workspace */
|
/* create initial workspace */
|
||||||
wWorkspaceNew(scr);
|
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
|
#ifdef KWM_HINTS
|
||||||
{
|
{
|
||||||
WArea area;
|
WArea area;
|
||||||
|
|
||||||
if (wKWMGetUsableArea(scr, &area)) {
|
if (wKWMGetUsableArea(scr, &area)) {
|
||||||
scr->totalUsableArea.x1 = WMAX(scr->totalUsableArea.x1, area.x1);
|
scr->totalUsableArea.x1 = WMAX(scr->totalUsableArea.x1, area.x1);
|
||||||
scr->totalUsableArea.y1 = WMAX(scr->totalUsableArea.y1, area.y1);
|
scr->totalUsableArea.y1 = WMAX(scr->totalUsableArea.y1, area.y1);
|
||||||
@@ -1094,6 +1112,10 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateWorkarea(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned size = wPreferences.workspace_border_size;
|
unsigned size = wPreferences.workspace_border_size;
|
||||||
unsigned position = wPreferences.workspace_border_position;
|
unsigned position = wPreferences.workspace_border_position;
|
||||||
@@ -1146,7 +1168,16 @@ wScreenRestoreState(WScreen *scr)
|
|||||||
wfree(path);
|
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);
|
state = WMGetFromPLDictionary(scr->session_state, dClip);
|
||||||
scr->clip_icon = wClipRestoreState(scr, state);
|
scr->clip_icon = wClipRestoreState(scr, state);
|
||||||
}
|
}
|
||||||
@@ -1154,17 +1185,10 @@ wScreenRestoreState(WScreen *scr)
|
|||||||
wWorkspaceRestoreState(scr);
|
wWorkspaceRestoreState(scr);
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
/*
|
/* create inputonly windows at the border of screen */
|
||||||
* * create inputonly windows at the border of screen
|
|
||||||
* */
|
|
||||||
wWorkspaceManageEdge(scr);
|
wWorkspaceManageEdge(scr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!wPreferences.flags.nodock && scr->session_state) {
|
|
||||||
state = WMGetFromPLDictionary(scr->session_state, dDock);
|
|
||||||
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
wScreenUpdateUsableArea(scr);
|
wScreenUpdateUsableArea(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,7 +1225,7 @@ wScreenSaveState(WScreen *scr)
|
|||||||
|
|
||||||
|
|
||||||
old_state = scr->session_state;
|
old_state = scr->session_state;
|
||||||
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
|
scr->session_state = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
WMPLSetCaseSensitive(True);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
@@ -1239,9 +1263,9 @@ wScreenSaveState(WScreen *scr)
|
|||||||
|
|
||||||
wMenuSaveState(scr);
|
wMenuSaveState(scr);
|
||||||
|
|
||||||
if (wScreenCount == 1)
|
if (wScreenCount == 1) {
|
||||||
str = wdefaultspathfordomain("WMState");
|
str = wdefaultspathfordomain("WMState");
|
||||||
else {
|
} else {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||||
str = wdefaultspathfordomain(buf);
|
str = wdefaultspathfordomain(buf);
|
||||||
|
|||||||
+3
-4
@@ -77,10 +77,8 @@ typedef struct _WScreen {
|
|||||||
int scr_height;
|
int scr_height;
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
Window virtual_edge_u;
|
int virtual_nr_edges;
|
||||||
Window virtual_edge_d;
|
Window * virtual_edges;
|
||||||
Window virtual_edge_l;
|
|
||||||
Window virtual_edge_r;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Window root_win; /* root window of screen */
|
Window root_win; /* root window of screen */
|
||||||
@@ -328,6 +326,7 @@ typedef struct _WScreen {
|
|||||||
unsigned int colormap_stuff_blocked:1;
|
unsigned int colormap_stuff_blocked:1;
|
||||||
unsigned int doing_alt_tab:1;
|
unsigned int doing_alt_tab:1;
|
||||||
unsigned int jump_back_pending:1;
|
unsigned int jump_back_pending:1;
|
||||||
|
unsigned int ignore_focus_events:1;
|
||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
unsigned int kwm_syncing_name:1;
|
unsigned int kwm_syncing_name:1;
|
||||||
unsigned int kwm_syncing_count:1;
|
unsigned int kwm_syncing_count:1;
|
||||||
|
|||||||
+2
-7
@@ -211,8 +211,6 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
Window win;
|
Window win;
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
int i;
|
int i;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
char *class, *instance, *command=NULL, buffer[512];
|
char *class, *instance, *command=NULL, buffer[512];
|
||||||
@@ -225,10 +223,7 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
else
|
else
|
||||||
win = wwin->client_win;
|
win = wwin->client_win;
|
||||||
|
|
||||||
if (XGetCommand(dpy, win, &argv, &argc) && argc>0) {
|
command = GetCommandForWindow(win);
|
||||||
command = wtokenjoin(argv, argc);
|
|
||||||
XFreeStringList(argv);
|
|
||||||
}
|
|
||||||
if (!command)
|
if (!command)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -321,7 +316,7 @@ wSessionSaveState(WScreen *scr)
|
|||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
if (!scr->session_state) {
|
if (!scr->session_state) {
|
||||||
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
|
scr->session_state = WMCreatePLDictionary(NULL, NULL);
|
||||||
if (!scr->session_state)
|
if (!scr->session_state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
|
#include "workspace.h"
|
||||||
|
|
||||||
|
|
||||||
/*** Global Variables ***/
|
/*** Global Variables ***/
|
||||||
@@ -152,6 +153,9 @@ CommitStacking(WScreen *scr)
|
|||||||
XRestackWindows(dpy, windows, i);
|
XRestackWindows(dpy, windows, i);
|
||||||
wfree(windows);
|
wfree(windows);
|
||||||
|
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
wWorkspaceRaiseEdge(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
||||||
}
|
}
|
||||||
@@ -376,6 +380,10 @@ wLowerFrame(WCoreWindow *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifyStackChange(frame, "lower");
|
notifyStackChange(frame, "lower");
|
||||||
|
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
wWorkspaceRaiseEdge(scr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -510,6 +518,10 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
||||||
|
|
||||||
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
wWorkspaceRaiseEdge(scr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+14
-1
@@ -111,6 +111,7 @@ extern int wXkbEventBase;
|
|||||||
extern XContext wWinContext;
|
extern XContext wWinContext;
|
||||||
extern XContext wAppWinContext;
|
extern XContext wAppWinContext;
|
||||||
extern XContext wStackContext;
|
extern XContext wStackContext;
|
||||||
|
extern XContext wVEdgeContext;
|
||||||
|
|
||||||
/* atoms */
|
/* atoms */
|
||||||
extern Atom _XA_WM_STATE;
|
extern Atom _XA_WM_STATE;
|
||||||
@@ -756,6 +757,7 @@ StartUp(Bool defaultScreenOnly)
|
|||||||
wWinContext = XUniqueContext();
|
wWinContext = XUniqueContext();
|
||||||
wAppWinContext = XUniqueContext();
|
wAppWinContext = XUniqueContext();
|
||||||
wStackContext = XUniqueContext();
|
wStackContext = XUniqueContext();
|
||||||
|
wVEdgeContext = XUniqueContext();
|
||||||
|
|
||||||
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False);*/
|
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False);*/
|
||||||
|
|
||||||
@@ -820,6 +822,17 @@ StartUp(Bool defaultScreenOnly)
|
|||||||
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
||||||
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name???*/
|
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name???*/
|
||||||
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
|
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 */
|
/* signal handler stuff that gets called when a signal is caught */
|
||||||
WMAddPersistentTimerHandler(500, delayedAction, NULL);
|
WMAddPersistentTimerHandler(500, delayedAction, NULL);
|
||||||
@@ -1119,7 +1132,7 @@ manageAllWindows(WScreen *scr, int crashRecovery)
|
|||||||
if (crashRecovery) {
|
if (crashRecovery) {
|
||||||
int border;
|
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,
|
wWindowMove(wwin, wwin->frame_x - border,
|
||||||
wwin->frame_y - border -
|
wwin->frame_y - border -
|
||||||
|
|||||||
+10
-9
@@ -28,6 +28,7 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
@@ -42,14 +43,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#ifdef DEBUG
|
||||||
# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X);
|
# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X);
|
||||||
# define LEAVE(X) fprintf(stderr,"Leaving: %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
|
#else
|
||||||
# define ENTER(X)
|
# define ENTER(X)
|
||||||
# define LEAVE(X)
|
# define LEAVE(X)
|
||||||
# define DEBUG(X)
|
# define PDEBUG(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern Cursor wCursor[WCUR_LAST];
|
extern Cursor wCursor[WCUR_LAST];
|
||||||
@@ -582,32 +583,32 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
|
|||||||
* text so we can wTextRefresh() */
|
* text so we can wTextRefresh() */
|
||||||
if( event->xmotion.state & (Button1Mask|Button3Mask|Button2Mask) )
|
if( event->xmotion.state & (Button1Mask|Button3Mask|Button2Mask) )
|
||||||
{
|
{
|
||||||
DEBUG("MotionNotify");
|
PDEBUG("MotionNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.endPos = textXtoPos( wtext, event->xmotion.x );
|
wtext->text.endPos = textXtoPos( wtext, event->xmotion.x );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
DEBUG("ButtonPress");
|
PDEBUG("ButtonPress");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.startPos = textXtoPos( wtext, event->xbutton.x );
|
wtext->text.startPos = textXtoPos( wtext, event->xbutton.x );
|
||||||
wtext->text.endPos = wtext->text.startPos;
|
wtext->text.endPos = wtext->text.startPos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
DEBUG("ButtonRelease");
|
PDEBUG("ButtonRelease");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.endPos = textXtoPos( wtext, event->xbutton.x );
|
wtext->text.endPos = textXtoPos( wtext, event->xbutton.x );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
DEBUG("KeyPress");
|
PDEBUG("KeyPress");
|
||||||
handled = handleKeyPress( wtext, &event->xkey );
|
handled = handleKeyPress( wtext, &event->xkey );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
DEBUG("EnterNotify");
|
PDEBUG("EnterNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
#if 0
|
#if 0
|
||||||
if (!wtext->magic)
|
if (!wtext->magic)
|
||||||
@@ -621,7 +622,7 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
DEBUG("LeaveNotify");
|
PDEBUG("LeaveNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
#if 0
|
#if 0
|
||||||
wtext->blinking = 0;
|
wtext->blinking = 0;
|
||||||
|
|||||||
+1
-1
@@ -500,7 +500,7 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
|||||||
int same = 0;
|
int same = 0;
|
||||||
|
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = WMCreatePLDictionary(NULL, NULL, NULL);
|
dict = WMCreatePLDictionary(NULL, NULL);
|
||||||
if (dict) {
|
if (dict) {
|
||||||
db->dictionary = dict;
|
db->dictionary = dict;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+139
-39
@@ -68,6 +68,9 @@
|
|||||||
#ifdef OLWM_HINTS
|
#ifdef OLWM_HINTS
|
||||||
# include "openlook.h"
|
# include "openlook.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
# include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/****** Global Variables ******/
|
/****** Global Variables ******/
|
||||||
|
|
||||||
@@ -278,12 +281,16 @@ wWindowDestroy(WWindow *wwin)
|
|||||||
if (wPreferences.auto_arrange_icons)
|
if (wPreferences.auto_arrange_icons)
|
||||||
wArrangeIcons(wwin->screen_ptr, True);
|
wArrangeIcons(wwin->screen_ptr, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
if (wwin->net_icon_image)
|
||||||
|
RReleaseImage(wwin->net_icon_image);
|
||||||
|
#endif
|
||||||
|
|
||||||
wrelease(wwin);
|
wrelease(wwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setupGNUstepHints(WWindow *wwin, GNUstepWMAttributes *gs_hints)
|
setupGNUstepHints(WWindow *wwin, GNUstepWMAttributes *gs_hints)
|
||||||
{
|
{
|
||||||
@@ -431,13 +438,19 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
|||||||
wMWMCheckClientHints(wwin);
|
wMWMCheckClientHints(wwin);
|
||||||
#endif /* MWM_HINTS */
|
#endif /* MWM_HINTS */
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
if (!check)
|
||||||
|
check = wNETWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
|
if (!check)
|
||||||
check = wGNOMECheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
check = wGNOMECheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||||
#endif /* GNOME_STUFF */
|
#endif /* GNOME_STUFF */
|
||||||
|
|
||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
if (!check)
|
if (!check)
|
||||||
wKWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
check = wKWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||||
#endif /* KWM_HINTS */
|
#endif /* KWM_HINTS */
|
||||||
|
|
||||||
#ifdef OLWM_HINTS
|
#ifdef OLWM_HINTS
|
||||||
@@ -458,6 +471,14 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
|||||||
*level = tmp_level;
|
*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) {
|
if (tmp_workspace >= 0) {
|
||||||
*workspace = tmp_workspace % scr->workspace_count;
|
*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
|
static Window
|
||||||
createFakeWindowGroupLeader(WScreen *scr, Window win, char *instance, char *class)
|
createFakeWindowGroupLeader(WScreen *scr, Window win, char *instance, char *class)
|
||||||
{
|
{
|
||||||
@@ -812,6 +905,8 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
wwin->main_window = wwin->client_win;
|
wwin->main_window = wwin->client_win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixLeaderProperties(wwin);
|
||||||
|
|
||||||
wwin->orig_main_window = wwin->main_window;
|
wwin->orig_main_window = wwin->main_window;
|
||||||
|
|
||||||
if (wwin->flags.is_gnustep) {
|
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)
|
#define ADEQUATE(x) ((x)!=None && (x)!=wwin->client_win && (x)!=fPtr->leader)
|
||||||
|
|
||||||
|
// only enter here if PropGetWMClass() succeds
|
||||||
PropGetWMClass(wwin->main_window, &class, &instance);
|
PropGetWMClass(wwin->main_window, &class, &instance);
|
||||||
buffer = StrConcatDot(instance, class);
|
buffer = StrConcatDot(instance, class);
|
||||||
|
|
||||||
@@ -924,20 +1019,26 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
wwin->flags.miniaturized = 1;
|
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;
|
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
|
#ifdef GNOME_STUFF
|
||||||
|
if (!bla)
|
||||||
bla = wGNOMECheckInitialClientState(wwin);
|
bla = wGNOMECheckInitialClientState(wwin);
|
||||||
#endif
|
#endif
|
||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
if (!bla)
|
if (!bla)
|
||||||
wKWMCheckClientInitialState(wwin);
|
bla = wKWMCheckClientInitialState(wwin);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1145,9 +1246,9 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
* Make spash screens come out in the center of a head
|
* Make spash screens come out in the center of a head
|
||||||
* trouble is that most splashies never get here
|
* trouble is that most splashies never get here
|
||||||
* they are managed trough atoms but god knows where.
|
* 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
|
* OverrideRedirect, which means we can't do anything about
|
||||||
* them. -alfredo
|
* them. -alfredo
|
||||||
*/
|
*/
|
||||||
@@ -1213,6 +1314,10 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
wScreenBringInside(scr, &x, &y, width, height);
|
wScreenBringInside(scr, &x, &y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMPositionSplash(wwin, &x, &y, width, height);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (wwin->flags.urgent) {
|
if (wwin->flags.urgent) {
|
||||||
if (!IS_OMNIPRESENT(wwin))
|
if (!IS_OMNIPRESENT(wwin))
|
||||||
wwin->flags.omnipresent ^= 1;
|
wwin->flags.omnipresent ^= 1;
|
||||||
@@ -1230,11 +1335,11 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
if (wPreferences.modelock)
|
if (wPreferences.modelock)
|
||||||
foo |= WFF_LANGUAGE_BUTTON;
|
foo |= WFF_LANGUAGE_BUTTON;
|
||||||
#endif
|
#endif
|
||||||
if (!WFLAGP(wwin, no_titlebar))
|
if (HAS_TITLEBAR(wwin))
|
||||||
foo |= WFF_TITLEBAR;
|
foo |= WFF_TITLEBAR;
|
||||||
if (!WFLAGP(wwin, no_resizebar))
|
if (HAS_RESIZEBAR(wwin))
|
||||||
foo |= WFF_RESIZEBAR;
|
foo |= WFF_RESIZEBAR;
|
||||||
if (!WFLAGP(wwin, no_border))
|
if (HAS_BORDER(wwin))
|
||||||
foo |= WFF_BORDER;
|
foo |= WFF_BORDER;
|
||||||
|
|
||||||
wwin->frame = wFrameWindowCreate(scr, window_level,
|
wwin->frame = wFrameWindowCreate(scr, window_level,
|
||||||
@@ -1342,12 +1447,10 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
if (leader && leader->main_window==None) {
|
if (leader && leader->main_window==None) {
|
||||||
leader->main_window = leader->client_win;
|
leader->main_window = leader->client_win;
|
||||||
}
|
}
|
||||||
app = wApplicationCreate(scr, wwin->main_window);
|
app = wApplicationCreate(wwin);
|
||||||
if (app) {
|
if (app) {
|
||||||
app->last_workspace = workspace;
|
app->last_workspace = workspace;
|
||||||
|
|
||||||
app->main_window_desc->fake_group = wwin->fake_group;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do application specific stuff, like setting application
|
* Do application specific stuff, like setting application
|
||||||
* wide attributes.
|
* wide attributes.
|
||||||
@@ -2218,7 +2321,7 @@ wWindowSynthConfigureNotify(WWindow *wwin)
|
|||||||
sevent.xconfigure.height = wwin->client.height;
|
sevent.xconfigure.height = wwin->client.height;
|
||||||
|
|
||||||
sevent.xconfigure.border_width = wwin->old_border_width;
|
sevent.xconfigure.border_width = wwin->old_border_width;
|
||||||
if (WFLAGP(wwin, no_titlebar))
|
if (!HAS_TITLEBAR(wwin))
|
||||||
sevent.xconfigure.above = None;
|
sevent.xconfigure.above = None;
|
||||||
else
|
else
|
||||||
sevent.xconfigure.above = wwin->frame->titlebar->window;
|
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_x = req_x;
|
||||||
wwin->frame_y = req_y;
|
wwin->frame_y = req_y;
|
||||||
if (!WFLAGP(wwin, no_border)) {
|
if (HAS_BORDER(wwin)) {
|
||||||
wwin->client.x += FRAME_BORDER_WIDTH;
|
wwin->client.x += FRAME_BORDER_WIDTH;
|
||||||
wwin->client.y += 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.x = req_x;
|
||||||
wwin->client.y = req_y + wwin->frame->top_width;
|
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.x += FRAME_BORDER_WIDTH;
|
||||||
wwin->client.y += FRAME_BORDER_WIDTH;
|
wwin->client.y += FRAME_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
@@ -2380,7 +2483,7 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
|||||||
Pixmap pixmap, mask;
|
Pixmap pixmap, mask;
|
||||||
WFrameWindow *fwin = wwin->frame;
|
WFrameWindow *fwin = wwin->frame;
|
||||||
|
|
||||||
if (WFLAGP(wwin, no_titlebar))
|
if (!HAS_TITLEBAR(wwin))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* miniaturize button */
|
/* miniaturize button */
|
||||||
@@ -2429,7 +2532,7 @@ wWindowUpdateButtonImages(WWindow *wwin)
|
|||||||
|
|
||||||
/* close button */
|
/* 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
|
#define MGFLAGP(wwin, FLAG) (wwin)->client_flags.FLAG
|
||||||
|
|
||||||
if (!WFLAGP(wwin, no_close_button)) {
|
if (!WFLAGP(wwin, no_close_button)) {
|
||||||
@@ -2498,14 +2601,16 @@ wWindowConfigureBorders(WWindow *wwin)
|
|||||||
int newy, oldh;
|
int newy, oldh;
|
||||||
|
|
||||||
flags = WFF_LEFT_BUTTON|WFF_RIGHT_BUTTON;
|
flags = WFF_LEFT_BUTTON|WFF_RIGHT_BUTTON;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
flags |= WFF_LANGUAGE_BUTTON;
|
flags |= WFF_LANGUAGE_BUTTON;
|
||||||
#endif
|
#endif
|
||||||
if (!WFLAGP(wwin, no_titlebar))
|
|
||||||
|
if (HAS_TITLEBAR(wwin))
|
||||||
flags |= WFF_TITLEBAR;
|
flags |= WFF_TITLEBAR;
|
||||||
if (!WFLAGP(wwin, no_resizebar) && !WFLAGP(wwin, no_resizable))
|
if (HAS_RESIZEBAR(wwin) && IS_RESIZABLE(wwin))
|
||||||
flags |= WFF_RESIZEBAR;
|
flags |= WFF_RESIZEBAR;
|
||||||
if (!WFLAGP(wwin, no_border))
|
if (HAS_BORDER(wwin))
|
||||||
flags |= WFF_BORDER;
|
flags |= WFF_BORDER;
|
||||||
if (wwin->flags.shaded)
|
if (wwin->flags.shaded)
|
||||||
flags |= WFF_IS_SHADED;
|
flags |= WFF_IS_SHADED;
|
||||||
@@ -2527,8 +2632,9 @@ wWindowConfigureBorders(WWindow *wwin)
|
|||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
if (!WFLAGP(wwin, no_language_button)
|
if (!WFLAGP(wwin, no_language_button)
|
||||||
&& wwin->frame->flags.hide_language_button)
|
&& wwin->frame->flags.hide_language_button) {
|
||||||
flags |= WFF_LANGUAGE_BUTTON;
|
flags |= WFF_LANGUAGE_BUTTON;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!WFLAGP(wwin, no_close_button)
|
if (!WFLAGP(wwin, no_close_button)
|
||||||
@@ -2659,7 +2765,7 @@ wWindowSetShape(WWindow *wwin)
|
|||||||
int ordering;
|
int ordering;
|
||||||
|
|
||||||
/* only shape is the client's */
|
/* 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;
|
goto alt_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2680,14 +2786,14 @@ wWindowSetShape(WWindow *wwin)
|
|||||||
memcpy(urec, rects, sizeof(XRectangle)*count);
|
memcpy(urec, rects, sizeof(XRectangle)*count);
|
||||||
XFree(rects);
|
XFree(rects);
|
||||||
|
|
||||||
if (!WFLAGP(wwin, no_titlebar)) {
|
if (HAS_TITLEBAR(wwin)) {
|
||||||
urec[count].x = -1;
|
urec[count].x = -1;
|
||||||
urec[count].y = -1 - wwin->frame->top_width;
|
urec[count].y = -1 - wwin->frame->top_width;
|
||||||
urec[count].width = wwin->frame->core->width + 2;
|
urec[count].width = wwin->frame->core->width + 2;
|
||||||
urec[count].height = wwin->frame->top_width + 1;
|
urec[count].height = wwin->frame->top_width + 1;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_resizebar)) {
|
if (HAS_RESIZEBAR(wwin)) {
|
||||||
urec[count].x = -1;
|
urec[count].x = -1;
|
||||||
urec[count].y = wwin->frame->core->height
|
urec[count].y = wwin->frame->core->height
|
||||||
- wwin->frame->bottom_width - wwin->frame->top_width;
|
- wwin->frame->bottom_width - wwin->frame->top_width;
|
||||||
@@ -2707,14 +2813,14 @@ wWindowSetShape(WWindow *wwin)
|
|||||||
alt_code:
|
alt_code:
|
||||||
#endif /* OPTIMIZE_SHAPE */
|
#endif /* OPTIMIZE_SHAPE */
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!WFLAGP(wwin, no_titlebar)) {
|
if (HAS_TITLEBAR(wwin)) {
|
||||||
rect[count].x = -1;
|
rect[count].x = -1;
|
||||||
rect[count].y = -1;
|
rect[count].y = -1;
|
||||||
rect[count].width = wwin->frame->core->width + 2;
|
rect[count].width = wwin->frame->core->width + 2;
|
||||||
rect[count].height = wwin->frame->top_width + 1;
|
rect[count].height = wwin->frame->top_width + 1;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_resizebar)) {
|
if (HAS_RESIZEBAR(wwin)) {
|
||||||
rect[count].x = -1;
|
rect[count].x = -1;
|
||||||
rect[count].y = wwin->frame->core->height - wwin->frame->bottom_width;
|
rect[count].y = wwin->frame->core->height - wwin->frame->bottom_width;
|
||||||
rect[count].width = wwin->frame->core->width + 2;
|
rect[count].width = wwin->frame->core->width + 2;
|
||||||
@@ -2878,17 +2984,11 @@ wWindowGetSavedState(Window win)
|
|||||||
{
|
{
|
||||||
char *instance, *class, *command=NULL;
|
char *instance, *class, *command=NULL;
|
||||||
WWindowState *wstate = windowState;
|
WWindowState *wstate = windowState;
|
||||||
char **argv;
|
|
||||||
int argc;
|
|
||||||
|
|
||||||
if (!wstate)
|
if (!wstate)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (XGetCommand(dpy, win, &argv, &argc)) {
|
command = GetCommandForWindow(win);
|
||||||
if (argc > 0)
|
|
||||||
command = wtokenjoin(argv, argc);
|
|
||||||
XFreeStringList(argv);
|
|
||||||
}
|
|
||||||
if (!command)
|
if (!command)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -3094,7 +3194,7 @@ titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* maximize window */
|
/* maximize window */
|
||||||
if (dir!=0 && !WFLAGP(wwin, no_resizable)) {
|
if (dir!=0 && IS_RESIZABLE(wwin)) {
|
||||||
int ndir = dir ^ wwin->flags.maximized;
|
int ndir = dir ^ wwin->flags.maximized;
|
||||||
|
|
||||||
if (ndir != 0) {
|
if (ndir != 0) {
|
||||||
@@ -3147,7 +3247,7 @@ frameMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event->xbutton.button == Button3 && !WFLAGP(wwin, no_resizable))
|
if (event->xbutton.button == Button3)
|
||||||
wMouseResizeWindow(wwin, event);
|
wMouseResizeWindow(wwin, event);
|
||||||
else if (event->xbutton.button==Button1 || event->xbutton.button==Button2)
|
else if (event->xbutton.button==Button1 || event->xbutton.button==Button2)
|
||||||
wMouseMoveWindow(wwin, event);
|
wMouseMoveWindow(wwin, event);
|
||||||
|
|||||||
+31
-3
@@ -95,6 +95,7 @@ typedef struct {
|
|||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
unsigned int no_language_button:1;
|
unsigned int no_language_button:1;
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int no_movable:1;
|
||||||
|
|
||||||
/* decorations */
|
/* decorations */
|
||||||
unsigned int no_resizebar:1; /* draw the bottom handle? */
|
unsigned int no_resizebar:1; /* draw the bottom handle? */
|
||||||
@@ -135,6 +136,10 @@ typedef struct {
|
|||||||
|
|
||||||
unsigned int full_maximize:1;
|
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
|
* emulate_app_icon must be automatically disabled for apps that can
|
||||||
* generate their own appicons and for apps that have no_appicon=1
|
* 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 */
|
unsigned int width, height; /* original geometry of the window */
|
||||||
} old_geometry; /* (before things like maximize) */
|
} 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 */
|
/* client window info */
|
||||||
short old_border_width; /* original border width of client_win*/
|
short old_border_width; /* original border width of client_win*/
|
||||||
Window client_win; /* the window we're managing */
|
Window client_win; /* the window we're managing */
|
||||||
@@ -257,6 +267,7 @@ typedef struct WWindow {
|
|||||||
unsigned int hidden:1;
|
unsigned int hidden:1;
|
||||||
unsigned int shaded:1;
|
unsigned int shaded:1;
|
||||||
unsigned int maximized:2;
|
unsigned int maximized:2;
|
||||||
|
unsigned int fullscreen:1;
|
||||||
unsigned int omnipresent:1;
|
unsigned int omnipresent:1;
|
||||||
|
|
||||||
unsigned int semi_focused: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_push_pin_out:1;/* emulate pushpin behaviour */
|
||||||
unsigned int olwm_limit_menu:1;
|
unsigned int olwm_limit_menu:1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef NET_HINTS
|
#ifdef NETWM_HINTS
|
||||||
unsigned int net_state_from_client:1; /* state hint was set by client */
|
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_skip_pager:1;
|
||||||
|
unsigned int net_handle_icon:1;
|
||||||
|
unsigned int net_show_desktop:1;
|
||||||
#endif
|
#endif
|
||||||
} flags; /* state of the window */
|
} flags; /* state of the window */
|
||||||
|
|
||||||
struct WIcon *icon; /* icon info for the window */
|
struct WIcon *icon; /* icon info for the window */
|
||||||
int icon_x, icon_y; /* position of the icon */
|
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;
|
} 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)
|
#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;
|
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);
|
&& !wwin->flags.miniaturized);
|
||||||
|
|
||||||
if (wwin->flags.shaded) {
|
if (wwin->flags.shaded) {
|
||||||
|
|||||||
+11
-3
@@ -47,6 +47,11 @@
|
|||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
#include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "xinerama.h"
|
||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
@@ -540,7 +545,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = WMCreatePLDictionary(NULL, NULL, NULL);
|
dict = WMCreatePLDictionary(NULL, NULL);
|
||||||
if (dict) {
|
if (dict) {
|
||||||
db->dictionary = dict;
|
db->dictionary = dict;
|
||||||
} else {
|
} else {
|
||||||
@@ -555,8 +560,8 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
|
|
||||||
WMPLSetCaseSensitive(True);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
winDic = WMCreatePLDictionary(NULL, NULL, NULL);
|
winDic = WMCreatePLDictionary(NULL, NULL);
|
||||||
appDic = WMCreatePLDictionary(NULL, NULL, NULL);
|
appDic = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
/* Update icon for window */
|
/* Update icon for window */
|
||||||
icon_file = WMGetTextFieldText(panel->fileText);
|
icon_file = WMGetTextFieldText(panel->fileText);
|
||||||
@@ -875,6 +880,9 @@ applySettings(WMButton *button, InspectorPanel *panel)
|
|||||||
wwin->frame->flags.need_texture_change = 1;
|
wwin->frame->flags.need_texture_change = 1;
|
||||||
wWindowConfigureBorders(wwin);
|
wWindowConfigureBorders(wwin);
|
||||||
wFrameWindowPaint(wwin->frame);
|
wFrameWindowPaint(wwin->frame);
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateActions(wwin, False);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can't apply emulate_appicon because it will probably cause problems.
|
* 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_
|
#ifndef _WMSPEC_H_
|
||||||
#define _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
|
#endif
|
||||||
|
|||||||
+543
-103
@@ -33,6 +33,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "wcore.h"
|
#include "wcore.h"
|
||||||
@@ -49,11 +50,18 @@
|
|||||||
#ifdef KWM_HINTS
|
#ifdef KWM_HINTS
|
||||||
#include "kwm.h"
|
#include "kwm.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
#include "wmspec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "xinerama.h"
|
||||||
|
|
||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
extern XContext wWinContext;
|
extern XContext wWinContext;
|
||||||
|
extern XContext wVEdgeContext;
|
||||||
|
|
||||||
|
extern void ProcessPendingEvents();
|
||||||
|
|
||||||
static WMPropList *dWorkspaces=NULL;
|
static WMPropList *dWorkspaces=NULL;
|
||||||
static WMPropList *dClip, *dName;
|
static WMPropList *dClip, *dName;
|
||||||
@@ -62,6 +70,7 @@ static WMPropList *dClip, *dName;
|
|||||||
static BOOL initVDesk = False;
|
static BOOL initVDesk = False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_keys()
|
make_keys()
|
||||||
{
|
{
|
||||||
@@ -129,17 +138,21 @@ wWorkspaceNew(WScreen *scr)
|
|||||||
wspace->height = scr->scr_height;
|
wspace->height = scr->scr_height;
|
||||||
wspace->width = scr->scr_width;
|
wspace->width = scr->scr_width;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateDesktop(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
WMPostNotificationName(WMNWorkspaceCreated, scr,
|
WMPostNotificationName(WMNWorkspaceCreated, scr,
|
||||||
(void*)(scr->workspace_count-1));
|
(void*)(scr->workspace_count-1));
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
return scr->workspace_count-1;
|
return scr->workspace_count-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
wWorkspaceDelete(WScreen *scr, int workspace)
|
wWorkspaceDelete(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
@@ -147,7 +160,6 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
|||||||
WWorkspace **list;
|
WWorkspace **list;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
|
||||||
if (workspace<=0)
|
if (workspace<=0)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
@@ -167,9 +179,9 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
|||||||
list = wmalloc(sizeof(WWorkspace*)*(scr->workspace_count-1));
|
list = wmalloc(sizeof(WWorkspace*)*(scr->workspace_count-1));
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i=0; i<scr->workspace_count; i++) {
|
for (i=0; i<scr->workspace_count; i++) {
|
||||||
if (i!=workspace)
|
if (i!=workspace) {
|
||||||
list[j++] = scr->workspaces[i];
|
list[j++] = scr->workspaces[i];
|
||||||
else {
|
} else {
|
||||||
if (scr->workspaces[i]->name)
|
if (scr->workspaces[i]->name)
|
||||||
wfree(scr->workspaces[i]->name);
|
wfree(scr->workspaces[i]->name);
|
||||||
wfree(scr->workspaces[i]);
|
wfree(scr->workspaces[i]);
|
||||||
@@ -205,6 +217,10 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
|||||||
wMenuRealize(menu);
|
wMenuRealize(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateDesktop(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
WMPostNotificationName(WMNWorkspaceDestroyed, scr,
|
WMPostNotificationName(WMNWorkspaceDestroyed, scr,
|
||||||
(void*)(scr->workspace_count-1));
|
(void*)(scr->workspace_count-1));
|
||||||
|
|
||||||
@@ -223,7 +239,6 @@ typedef struct WorkspaceNameData {
|
|||||||
} WorkspaceNameData;
|
} WorkspaceNameData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hideWorkspaceName(void *data)
|
hideWorkspaceName(void *data)
|
||||||
{
|
{
|
||||||
@@ -246,8 +261,7 @@ hideWorkspaceName(void *data)
|
|||||||
Pixmap pix;
|
Pixmap pix;
|
||||||
|
|
||||||
scr->workspace_name_timer =
|
scr->workspace_name_timer =
|
||||||
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkspaceName,
|
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkspaceName, scr);
|
||||||
scr);
|
|
||||||
|
|
||||||
RCombineImagesWithOpaqueness(img, scr->workspace_name_data->text,
|
RCombineImagesWithOpaqueness(img, scr->workspace_name_data->text,
|
||||||
scr->workspace_name_data->count*255/10);
|
scr->workspace_name_data->count*255/10);
|
||||||
@@ -266,7 +280,6 @@ hideWorkspaceName(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
showWorkspaceName(WScreen *scr, int workspace)
|
showWorkspaceName(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
@@ -279,9 +292,10 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
int len = strlen(name);
|
int len = strlen(name);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (wPreferences.workspace_name_display_position == WD_NONE
|
if (wPreferences.workspace_name_display_position == WD_NONE ||
|
||||||
|| scr->workspace_count < 2)
|
scr->workspace_count < 2) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (scr->workspace_name_timer) {
|
if (scr->workspace_name_timer) {
|
||||||
WMDeleteTimerHandler(scr->workspace_name_timer);
|
WMDeleteTimerHandler(scr->workspace_name_timer);
|
||||||
@@ -298,6 +312,7 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = wmalloc(sizeof(WorkspaceNameData));
|
data = wmalloc(sizeof(WorkspaceNameData));
|
||||||
|
data->back = NULL;
|
||||||
|
|
||||||
w = WMWidthOfString(scr->workspace_name_font, name, len);
|
w = WMWidthOfString(scr->workspace_name_font, name, len);
|
||||||
h = WMFontHeight(scr->workspace_name_font);
|
h = WMFontHeight(scr->workspace_name_font);
|
||||||
@@ -452,25 +467,23 @@ wWorkspaceRelativeChange(WScreen *scr, int amount)
|
|||||||
w = scr->current_workspace + amount;
|
w = scr->current_workspace + amount;
|
||||||
|
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
|
if (w >= 0) {
|
||||||
if (w >= 0)
|
|
||||||
wWorkspaceChange(scr, w);
|
wWorkspaceChange(scr, w);
|
||||||
else if (wPreferences.ws_cycle)
|
} else if (wPreferences.ws_cycle) {
|
||||||
wWorkspaceChange(scr, scr->workspace_count + w);
|
wWorkspaceChange(scr, scr->workspace_count + w);
|
||||||
|
}
|
||||||
} else if (amount > 0) {
|
} else if (amount > 0) {
|
||||||
|
if (w < scr->workspace_count) {
|
||||||
if (w < scr->workspace_count)
|
|
||||||
wWorkspaceChange(scr, w);
|
wWorkspaceChange(scr, w);
|
||||||
else if (wPreferences.ws_advance)
|
} else if (wPreferences.ws_advance) {
|
||||||
wWorkspaceChange(scr, WMIN(w, MAX_WORKSPACES-1));
|
wWorkspaceChange(scr, WMIN(w, MAX_WORKSPACES-1));
|
||||||
else if (wPreferences.ws_cycle)
|
} else if (wPreferences.ws_cycle) {
|
||||||
wWorkspaceChange(scr, w % scr->workspace_count);
|
wWorkspaceChange(scr, w % scr->workspace_count);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceForceChange(WScreen *scr, int workspace)
|
wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
@@ -494,29 +507,24 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||||
|
|
||||||
if ((tmp = scr->focused_window)!= NULL) {
|
if ((tmp = scr->focused_window)!= NULL) {
|
||||||
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded)
|
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
|
||||||
&& !WFLAGP(tmp, no_focusable))
|
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
|
||||||
|| tmp->flags.changing_workspace) {
|
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* foc2 = tmp; will fix annoyance with gnome panel
|
/* foc2 = tmp; will fix annoyance with gnome panel
|
||||||
* but will create annoyance for every other application
|
* but will create annoyance for every other application
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (tmp->frame->workspace!=workspace && !tmp->flags.selected) {
|
if (tmp->frame->workspace!=workspace && !tmp->flags.selected) {
|
||||||
/* unmap windows not on this workspace */
|
/* unmap windows not on this workspace */
|
||||||
if ((tmp->flags.mapped||tmp->flags.shaded)
|
if ((tmp->flags.mapped||tmp->flags.shaded) &&
|
||||||
&& !IS_OMNIPRESENT(tmp)
|
!IS_OMNIPRESENT(tmp) && !tmp->flags.changing_workspace) {
|
||||||
&& !tmp->flags.changing_workspace) {
|
|
||||||
|
|
||||||
wWindowUnmap(tmp);
|
wWindowUnmap(tmp);
|
||||||
}
|
}
|
||||||
/* also unmap miniwindows not on this workspace */
|
/* also unmap miniwindows not on this workspace */
|
||||||
if (!wPreferences.sticky_icons && tmp->flags.miniaturized &&
|
if (!wPreferences.sticky_icons && tmp->flags.miniaturized &&
|
||||||
tmp->icon && !IS_OMNIPRESENT(tmp)) {
|
tmp->icon && !IS_OMNIPRESENT(tmp)) {
|
||||||
|
|
||||||
XUnmapWindow(dpy, tmp->icon->core->window);
|
XUnmapWindow(dpy, tmp->icon->core->window);
|
||||||
tmp->icon->mapped = 0;
|
tmp->icon->mapped = 0;
|
||||||
}
|
}
|
||||||
@@ -529,9 +537,10 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
if (wapp) {
|
if (wapp) {
|
||||||
wapp->last_workspace = workspace;
|
wapp->last_workspace = workspace;
|
||||||
}
|
}
|
||||||
if (!foc2 && (tmp->flags.mapped || tmp->flags.shaded))
|
if (!foc2 && (tmp->flags.mapped || tmp->flags.shaded)) {
|
||||||
foc2 = tmp;
|
foc2 = tmp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* change selected windows' workspace */
|
/* change selected windows' workspace */
|
||||||
if (tmp->flags.selected) {
|
if (tmp->flags.selected) {
|
||||||
@@ -544,9 +553,10 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
if (!(tmp->flags.mapped || tmp->flags.miniaturized)) {
|
if (!(tmp->flags.mapped || tmp->flags.miniaturized)) {
|
||||||
/* remap windows that are on this workspace */
|
/* remap windows that are on this workspace */
|
||||||
wWindowMap(tmp);
|
wWindowMap(tmp);
|
||||||
if (!foc && !WFLAGP(tmp, no_focusable))
|
if (!foc && !WFLAGP(tmp, no_focusable)) {
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Also map miniwindow if not omnipresent */
|
/* Also map miniwindow if not omnipresent */
|
||||||
if (!wPreferences.sticky_icons &&
|
if (!wPreferences.sticky_icons &&
|
||||||
tmp->flags.miniaturized &&
|
tmp->flags.miniaturized &&
|
||||||
@@ -560,6 +570,16 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
tmp = tmp->prev;
|
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)
|
if (!foc)
|
||||||
foc = foc2;
|
foc = foc2;
|
||||||
|
|
||||||
@@ -579,6 +599,12 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
&foo, &foo, &foo, &foo, &mask)) {
|
&foo, &foo, &foo, &foo, &mask)) {
|
||||||
tmp = wWindowFor(win);
|
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) {
|
if (!tmp && wPreferences.focus_mode == WKF_SLOPPY) {
|
||||||
wSetFocusTo(scr, foc);
|
wSetFocusTo(scr, foc);
|
||||||
} else {
|
} else {
|
||||||
@@ -609,9 +635,12 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KWM_HINTS
|
#if defined KWM_HINTS || defined NETWM_HINTS
|
||||||
wScreenUpdateUsableArea(scr);
|
wScreenUpdateUsableArea(scr);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateDesktop(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
showWorkspaceName(scr, workspace);
|
showWorkspaceName(scr, workspace);
|
||||||
|
|
||||||
@@ -620,23 +649,320 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
/* XSync(dpy, False); */
|
/* XSync(dpy, False); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* 1) Allow border around each window so the scrolling
|
*
|
||||||
* won't just stop at the border.
|
* 1) Allow border around each window so the scrolling
|
||||||
* 2) Make pager.
|
* 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
|
void
|
||||||
wWorkspaceManageEdge(WScreen *scr)
|
wWorkspaceManageEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
int w;
|
if (!initVDesk && wPreferences.vedge_thickness) {
|
||||||
|
int i, j, w;
|
||||||
int vmask;
|
int vmask;
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
|
|
||||||
/* puts("wWorkspaceManageEdge()"); */
|
int heads = wXineramaHeads(scr);
|
||||||
if (wPreferences.vedge_thickness) {
|
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;
|
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++) {
|
for (w = 0; w < scr->workspace_count; w++) {
|
||||||
/* puts("reset workspace"); */
|
/* puts("reset workspace"); */
|
||||||
wWorkspaceSetViewPort(scr, w, 0, 0);
|
wWorkspaceSetViewPort(scr, w, 0, 0);
|
||||||
@@ -645,93 +971,202 @@ wWorkspaceManageEdge(WScreen *scr)
|
|||||||
vmask = CWEventMask|CWOverrideRedirect;
|
vmask = CWEventMask|CWOverrideRedirect;
|
||||||
attribs.event_mask = (EnterWindowMask | LeaveWindowMask | VisibilityChangeMask);
|
attribs.event_mask = (EnterWindowMask | LeaveWindowMask | VisibilityChangeMask);
|
||||||
attribs.override_redirect = True;
|
attribs.override_redirect = True;
|
||||||
scr->virtual_edge_u =
|
|
||||||
XCreateWindow(dpy, scr->root_win, 0, 0,
|
for (head=0; head<wXineramaHeads(scr); ++head) {
|
||||||
scr->scr_width, wPreferences.vedge_thickness, 0,
|
WMRect rect = wGetRectForHead(scr, head);
|
||||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
|
||||||
scr->virtual_edge_d =
|
if (hasEdges[head] & TOP_EDGE) {
|
||||||
XCreateWindow(dpy, scr->root_win, 0, scr->scr_height-wPreferences.vedge_thickness,
|
edges[nr_edges] =
|
||||||
scr->scr_width, wPreferences.vedge_thickness, 0,
|
XCreateWindow(dpy, scr->root_win, rect.pos.x, rect.pos.y,
|
||||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
rect.size.width, thickness, 0,
|
||||||
scr->virtual_edge_l =
|
CopyFromParent, InputOnly, CopyFromParent,
|
||||||
XCreateWindow(dpy, scr->root_win, 0, 0,
|
vmask, &attribs);
|
||||||
wPreferences.vedge_thickness, scr->scr_height, 0,
|
XSaveContext(dpy, edges[nr_edges], wVEdgeContext,
|
||||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
(XPointer)vdHandleEnter_u);
|
||||||
scr->virtual_edge_r =
|
++nr_edges;
|
||||||
XCreateWindow(dpy, scr->root_win, scr->scr_width-wPreferences.vedge_thickness, 0,
|
}
|
||||||
wPreferences.vedge_thickness, scr->scr_height, 0,
|
|
||||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
if (hasEdges[head] & BOTTOM_EDGE) {
|
||||||
XMapWindow(dpy, scr->virtual_edge_u);
|
edges[nr_edges] =
|
||||||
XMapWindow(dpy, scr->virtual_edge_d);
|
XCreateWindow(dpy, scr->root_win, rect.pos.x,
|
||||||
XMapWindow(dpy, scr->virtual_edge_l);
|
rect.pos.y+rect.size.height-thickness,
|
||||||
XMapWindow(dpy, scr->virtual_edge_r);
|
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);
|
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
|
void
|
||||||
wWorkspaceRaiseEdge(WScreen *scr)
|
wWorkspaceRaiseEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
puts("raise edge");
|
static int toggle = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
if (wPreferences.vedge_thickness && initVDesk) {
|
||||||
XRaiseWindow(dpy, scr->virtual_edge_u);
|
if (toggle) {
|
||||||
XRaiseWindow(dpy, scr->virtual_edge_d);
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
XRaiseWindow(dpy, scr->virtual_edge_l);
|
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||||
XRaiseWindow(dpy, scr->virtual_edge_r);
|
}
|
||||||
|
} else {
|
||||||
|
for (i=scr->virtual_nr_edges-1; i>=0; --i) {
|
||||||
|
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle ^= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceLowerEdge(WScreen *scr)
|
wWorkspaceLowerEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
puts("lower edge");
|
int i;
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
if (wPreferences.vedge_thickness && initVDesk) {
|
||||||
XLowerWindow(dpy, scr->virtual_edge_u);
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
XLowerWindow(dpy, scr->virtual_edge_d);
|
XLowerWindow(dpy, scr->virtual_edges[i]);
|
||||||
XLowerWindow(dpy, scr->virtual_edge_l);
|
}
|
||||||
XLowerWindow(dpy, scr->virtual_edge_r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height)
|
wWorkspaceResizeViewPort(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
scr->workspaces[workspace]->width = WMAX(width,scr->scr_width);
|
int x, y;
|
||||||
scr->workspaces[workspace]->height = WMAX(height,scr->scr_height);
|
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
||||||
|
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
updateWorkspaceGeometry(WScreen *scr, int workspace, int *view_x, int *view_y)
|
updateWorkspaceGeometry(WScreen *scr, int workspace, int *view_x, int *view_y)
|
||||||
{
|
{
|
||||||
int most_left, most_right, most_top, most_bottom;
|
int most_left, most_right, most_top, most_bottom;
|
||||||
WWindow *wwin;
|
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 */
|
/* adjust workspace layout */
|
||||||
wwin = scr->focused_window;
|
wwin = scr->focused_window;
|
||||||
most_right = scr->scr_width;
|
most_right = 0;
|
||||||
most_bottom = scr->scr_height;
|
most_bottom = 0;
|
||||||
most_left = 0;
|
most_left = scr->scr_width;
|
||||||
most_top = 0;
|
most_top = scr->scr_height;
|
||||||
for(;wwin; wwin = wwin->prev) {
|
for(;wwin; wwin = wwin->prev) {
|
||||||
if (wwin->frame->workspace == workspace) {
|
if (wwin->frame->workspace == workspace) {
|
||||||
if (!wwin->flags.miniaturized
|
if (!wwin->flags.miniaturized && !IS_VSTUCK(wwin) &&
|
||||||
&& !wwin->flags.hidden) {
|
!wwin->flags.hidden) {
|
||||||
if (wwin->frame_x < most_left) { /* record positions, should this be cached? */
|
|
||||||
most_left = wwin->frame_x;
|
head = wGetHeadForWindow(wwin);
|
||||||
}
|
|
||||||
if ((int)wwin->frame_x + (int)wwin->frame->core->width > most_right) {
|
i = wwin->frame_x - strut[head][0];
|
||||||
most_right = wwin->frame_x + wwin->frame->core->width;
|
if (i < most_left) /* record positions, should this be cached? */
|
||||||
}
|
most_left = i;
|
||||||
if (wwin->frame_y < most_top) {
|
i = wwin->frame_x + wwin->frame->core->width + strut[head][1];
|
||||||
most_top = wwin->frame_y;
|
if (HAS_BORDER(wwin))
|
||||||
}
|
i+=2;
|
||||||
if (wwin->frame_y + wwin->frame->core->height > most_bottom) {
|
if (i > most_right)
|
||||||
most_bottom = wwin->frame_y + wwin->frame->core->height;
|
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]->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);
|
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;
|
*view_y += -most_top - scr->workspaces[workspace]->view_y;
|
||||||
scr->workspaces[workspace]->view_y = -most_top;
|
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;
|
Bool adjust_flag = False;
|
||||||
int diff_x, diff_y;
|
int diff_x, diff_y;
|
||||||
static _delay_configure delay_configure = {NULL, 0};
|
static _delay_configure delay_configure = {NULL, 0};
|
||||||
|
WWorkspace *wptr;
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
|
wptr = scr->workspaces[workspace];
|
||||||
|
|
||||||
/*printf("wWorkspaceSetViewPort %d %d\n", view_x, view_y);*/
|
/*printf("wWorkspaceSetViewPort %d %d\n", view_x, view_y);*/
|
||||||
|
|
||||||
updateWorkspaceGeometry(scr, workspace, &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"); */
|
/* 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) {
|
if (view_x < 0) {
|
||||||
/* puts("left edge of vdesk"); */
|
/* puts("left edge of vdesk"); */
|
||||||
view_x = 0;
|
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"); */
|
/* 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) {
|
if (view_y < 0) {
|
||||||
/* puts("left edge of vdesk"); */
|
/* puts("left edge of vdesk"); */
|
||||||
view_y = 0;
|
view_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff_x = scr->workspaces[workspace]->view_x - view_x;
|
diff_x = wptr->view_x - view_x;
|
||||||
diff_y = scr->workspaces[workspace]->view_y - view_y;
|
diff_y = wptr->view_y - view_y;
|
||||||
if (!diff_x && !diff_y)
|
if (!diff_x && !diff_y)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
scr->workspaces[workspace]->view_x = view_x;
|
wptr->view_x = view_x;
|
||||||
scr->workspaces[workspace]->view_y = view_y;
|
wptr->view_y = view_y;
|
||||||
|
|
||||||
|
#ifdef NETWM_HINTS
|
||||||
|
wNETWMUpdateDesktop(scr);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
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);
|
wWindowMove(wwin, wwin->frame_x + diff_x, wwin->frame_y + diff_y);
|
||||||
|
adjust_flag = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (1) { /* if delay*/
|
if (1) { /* if delay*/
|
||||||
@@ -818,15 +1261,14 @@ wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
|||||||
|
|
||||||
|
|
||||||
void
|
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;
|
*x = scr->workspaces[workspace]->view_x;
|
||||||
if (view_y) *view_y = scr->workspaces[workspace]->view_y;
|
*y = scr->workspaces[workspace]->view_y;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
@@ -834,7 +1276,6 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
@@ -843,7 +1284,6 @@ deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
newWSCommand(WMenu *menu, WMenuEntry *foo)
|
newWSCommand(WMenu *menu, WMenuEntry *foo)
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-1
@@ -41,12 +41,21 @@ void wWorkspaceChange(WScreen *scr, int workspace);
|
|||||||
void wWorkspaceForceChange(WScreen *scr, int workspace);
|
void wWorkspaceForceChange(WScreen *scr, int workspace);
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
void wWorkspaceManageEdge(WScreen *scr);
|
void wWorkspaceManageEdge(WScreen *scr);
|
||||||
|
void wWorkspaceUpdateEdge(WScreen *scr);
|
||||||
|
void wWorkspaceDestroyEdge(WScreen *scr);
|
||||||
void wWorkspaceRaiseEdge(WScreen *scr);
|
void wWorkspaceRaiseEdge(WScreen *scr);
|
||||||
void wWorkspaceLowerEdge(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 wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y);
|
||||||
Bool wWorkspaceAdjustViewPort(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);
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ void wXDNDMakeAwareness(Window window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wXDNDClearAwareness(Window window) {
|
void wXDNDClearAwareness(Window window) {
|
||||||
long int xdnd_version = 3;
|
//long int xdnd_version = 3;
|
||||||
XDeleteProperty (dpy, window, _XA_XdndAware);
|
XDeleteProperty (dpy, window, _XA_XdndAware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "wconfig.h"
|
#include "wconfig.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|||||||
+5
-2
@@ -3,9 +3,10 @@ AUTOMAKE_OPTIONS = no-dependencies
|
|||||||
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
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
|
wcopy wpaste
|
||||||
|
|
||||||
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wsetfont directjpeg.c \
|
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wsetfont directjpeg.c \
|
||||||
@@ -31,6 +32,8 @@ setstyle_LDADD = \
|
|||||||
$(top_builddir)/WINGs/libWUtil.a \
|
$(top_builddir)/WINGs/libWUtil.a \
|
||||||
@XLFLAGS@ @XLIBS@ $(liblist)
|
@XLFLAGS@ @XLIBS@ $(liblist)
|
||||||
|
|
||||||
|
convertfonts_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
||||||
|
|
||||||
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
||||||
|
|
||||||
geticonset_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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
iconset = WMCreatePLDictionary(NULL, NULL, NULL);
|
iconset = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
keylist = WMGetPLDictionaryKeys(all_windows);
|
keylist = WMGetPLDictionaryKeys(all_windows);
|
||||||
icon_key = WMCreatePLString("Icon");
|
icon_key = WMCreatePLString("Icon");
|
||||||
@@ -122,10 +122,7 @@ main(int argc, char **argv)
|
|||||||
if (window_attrs && WMIsPLDictionary(window_attrs)) {
|
if (window_attrs && WMIsPLDictionary(window_attrs)) {
|
||||||
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
|
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
|
||||||
if (icon_value) {
|
if (icon_value) {
|
||||||
|
icondic = WMCreatePLDictionary(icon_key, icon_value, NULL);
|
||||||
icondic = WMCreatePLDictionary(icon_key, icon_value,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
WMPutInPLDictionary(iconset, window_name, icondic);
|
WMPutInPLDictionary(iconset, window_name, icondic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -589,7 +589,7 @@ findCopyFile(char *dir, char *file)
|
|||||||
if (!fullPath) {
|
if (!fullPath) {
|
||||||
char buffer[4000];
|
char buffer[4000];
|
||||||
|
|
||||||
sprintf(buffer, "coould not find file %s", file);
|
sprintf(buffer, "could not find file %s", file);
|
||||||
abortar(buffer);
|
abortar(buffer);
|
||||||
}
|
}
|
||||||
copyFile(dir, fullPath);
|
copyFile(dir, fullPath);
|
||||||
@@ -763,7 +763,7 @@ main(int argc, char **argv)
|
|||||||
prop = val;
|
prop = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
style = WMCreatePLDictionary(NULL, NULL, NULL);
|
style = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
for (i=0; options[i]!=NULL; i++) {
|
for (i=0; options[i]!=NULL; i++) {
|
||||||
key = WMCreatePLString(options[i]);
|
key = WMCreatePLString(options[i]);
|
||||||
@@ -776,7 +776,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
oldfont = WMGetFromPLString(val);
|
oldfont = WMGetFromPLString(val);
|
||||||
newfont = convertFont(oldfont);
|
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) {
|
if (newfont != oldfont) {
|
||||||
WMReleasePropList(val);
|
WMReleasePropList(val);
|
||||||
val = WMCreatePLString(newfont);
|
val = WMCreatePLString(newfont);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+1
-1
@@ -495,7 +495,7 @@ parseTexture(RContext *rc, char *text)
|
|||||||
XColor color;
|
XColor color;
|
||||||
Pixmap pixmap = None;
|
Pixmap pixmap = None;
|
||||||
RImage *image = NULL;
|
RImage *image = NULL;
|
||||||
int w, h;
|
//int w, h;
|
||||||
int iwidth, iheight;
|
int iwidth, iheight;
|
||||||
RColor rcolor;
|
RColor rcolor;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "WMaker.h"
|
#include "WMaker.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|||||||
+2
-1
@@ -678,7 +678,8 @@ image2StandardPseudoColor(RContext *ctx, RImage *image)
|
|||||||
int x1, ofs;
|
int x1, ofs;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#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
|
#endif
|
||||||
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
||||||
nerr = (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) {
|
} else if (ocode & RIG) {
|
||||||
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
|
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
|
||||||
x = xmax;
|
x = xmax;
|
||||||
} else if (ocode & LEF) {
|
} else { //if (ocode & LEF) {
|
||||||
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
|
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
|
||||||
x = xmin;
|
x = xmin;
|
||||||
}
|
}
|
||||||
|
|||||||
+477
-415
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user