mirror of
https://github.com/gryf/wmaker.git
synced 2026-07-10 12:46:36 +02:00
Compare commits
78 Commits
next
..
038a3588d6
| Author | SHA1 | Date | |
|---|---|---|---|
| 038a3588d6 | |||
| 0b2fd6a8c8 | |||
| 3e991badf7 | |||
| ac6d284269 | |||
| 83b94b1616 | |||
| d045ffcf7d | |||
| 6c69dc32a0 | |||
| 3b1c00ad06 | |||
| dd6fe27858 | |||
| 45f3f5d0ae | |||
| 7185af15cf | |||
| 80e8dd43f7 | |||
| a383074c99 | |||
| 52a623729d | |||
| d4ee17f0b5 | |||
| 7475bc5d0a | |||
| 35f87b5592 | |||
| 5e37d13eb6 | |||
| 4b1aee3e79 | |||
| 0ccc5bbde7 | |||
| 59a686d22e | |||
| 26d46f6e16 | |||
| ceafbf0629 | |||
| cf178d011b | |||
| 682c2767c2 | |||
| 0e00c6b605 | |||
| e9717ed719 | |||
| 9e59d19507 | |||
| 94f98dcd25 | |||
| 6c7266c338 | |||
| b4bd6d0cad | |||
| c7f7c10d7c | |||
| d831766572 | |||
| e2ecfbfd54 | |||
| a8ec32d41a | |||
| 1215680b6d | |||
| 77df89396c | |||
| c8883fdbb0 | |||
| 3cc5808dcd | |||
| 8ca89f0141 | |||
| 76fa91d21e | |||
| d2d5297a1e | |||
| 7b317a5fba | |||
| 9f8dc6f5dc | |||
| bc56db0776 | |||
| 15d06ff064 | |||
| 2dd98666f1 | |||
| d1a7db8aea | |||
| 64a8ecb390 | |||
| a9e336256b | |||
| e9b20b51e9 | |||
| 1d8b38b6e0 | |||
| 82ad19d420 | |||
| 492b22d975 | |||
| 62405fbb75 | |||
| f1fef40f0d | |||
| 2fb9308a67 | |||
| d902477efd | |||
| 5ee19c2308 | |||
| fabd4252ab | |||
| 630e9292c2 | |||
| 14d1b8197a | |||
| 4d658341d2 | |||
| ac75047aef | |||
| 6d6f9f6ff5 | |||
| 370adc94e7 | |||
| 532acdc443 | |||
| d7d38aa443 | |||
| a6209cc89b | |||
| 01bd523cee | |||
| 45ab72a78a | |||
| 437b76812d | |||
| e3ee459a78 | |||
| d70b546f2e | |||
| 812930b7cd | |||
| 2a14004fc3 | |||
| 04e9f33437 | |||
| 150816c687 |
@@ -1,7 +1,32 @@
|
|||||||
NEWS for veteran Window Maker users
|
NEWS for veteran Window Maker users
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
-- 0.95.10
|
-- 0.96.0
|
||||||
|
|
||||||
|
Screenshot capture feature
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
In WPrefs "Keyboard Shortcut Preferences" tab, three new actions can
|
||||||
|
be configured: "Capture a portion of the screen", "Capture a window",
|
||||||
|
"Capture the entire screen". The file is saved in
|
||||||
|
~/GNUstep/Library/WindowMaker/Screenshots directory under a filename
|
||||||
|
format "screenshot_%Y-%m-%d_at_%H:%M:%S" followed by the extension.
|
||||||
|
Which can be png or jpg based on WRaster dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
libXRes is now an optional dependency
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
XRes the resource extension for the X protocol is used to find the
|
||||||
|
underlying processes (and PIDs) responsible for displaying the windows.
|
||||||
|
|
||||||
|
|
||||||
|
Support for _NET_WM_FULLSCREEN_MONITORS hint
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
That hint allows applications that support it to be set as fullscreen on multiple heads.
|
||||||
|
It depends on Xinerama extension support.
|
||||||
|
|
||||||
|
|
||||||
Keep dock on primary head
|
Keep dock on primary head
|
||||||
-------------------------
|
-------------------------
|
||||||
@@ -10,6 +35,7 @@ To keep the dock on the primary head in a multi-head setup, set the option
|
|||||||
"KeepDockOnPrimaryHead" in ~/GNUstep/Defaults/WindowMaker to "YES" or click
|
"KeepDockOnPrimaryHead" in ~/GNUstep/Defaults/WindowMaker to "YES" or click
|
||||||
"Keep dock on primary head" under the WPrefs "Expert User Preferences" tab.
|
"Keep dock on primary head" under the WPrefs "Expert User Preferences" tab.
|
||||||
|
|
||||||
|
|
||||||
-- 0.95.9
|
-- 0.95.9
|
||||||
|
|
||||||
Configurable SwitchPanel
|
Configurable SwitchPanel
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
Changes since wmaker 0.96.0:
|
||||||
|
............................
|
||||||
|
|
||||||
|
- added W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.92.0:
|
Changes since wmaker 0.92.0:
|
||||||
............................
|
............................
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
** API and ABI modifications since wmaker 0.92.0
|
** API and ABI modifications since wmaker 0.96.0
|
||||||
|
----------------------------------------------------
|
||||||
|
|
||||||
** libWINGs **
|
** libWINGs **
|
||||||
<WINGsP.h>
|
<WINGsP.h>
|
||||||
|
W_KeycodeToKeysym ADDED
|
||||||
struct W_DragDestinationInfo: new members added SIZE CHANGE
|
struct W_DragDestinationInfo: new members added SIZE CHANGE
|
||||||
|
|
||||||
<WINGs.h>
|
<WINGs.h>
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
|
|||||||
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
|
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
AM_CPPFLAGS = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@
|
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@ \
|
||||||
|
@PANGO_CFLAGS@
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ static W_Class myWidgetClass = 0;
|
|||||||
*/
|
*/
|
||||||
W_Class InitMyWidget(WMScreen * scr)
|
W_Class InitMyWidget(WMScreen * scr)
|
||||||
{
|
{
|
||||||
|
(void)scr;
|
||||||
/* register our widget with WINGs and get our widget class ID */
|
/* register our widget with WINGs and get our widget class ID */
|
||||||
if (!myWidgetClass) {
|
if (!myWidgetClass) {
|
||||||
myWidgetClass = W_RegisterUserWidget();
|
myWidgetClass = W_RegisterUserWidget();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "mywidget.h"
|
#include "mywidget.h"
|
||||||
|
|
||||||
void wAbort()
|
_Noreturn void wAbort(void)
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
#include "logo.xpm"
|
#include "logo.xpm"
|
||||||
|
|
||||||
void wAbort()
|
_Noreturn void wAbort(void)
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ProgName;
|
char *ProgName;
|
||||||
|
|
||||||
void usage(void)
|
_Noreturn void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage:\n"
|
"usage:\n"
|
||||||
@@ -53,13 +53,10 @@ int main(int argc, char **argv)
|
|||||||
WMPixmap *pixmap;
|
WMPixmap *pixmap;
|
||||||
WMOpenPanel *oPanel;
|
WMOpenPanel *oPanel;
|
||||||
WMSavePanel *sPanel;
|
WMSavePanel *sPanel;
|
||||||
/* RImage *image; */
|
|
||||||
char *title = NULL;
|
char *title = NULL;
|
||||||
char *initial = "/";
|
char *initial = "/";
|
||||||
int ch;
|
int ch;
|
||||||
int panelType = OPEN_PANEL_TYPE;
|
int panelType = OPEN_PANEL_TYPE;
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
puts("could not open display");
|
puts("could not open display");
|
||||||
@@ -96,14 +93,14 @@ int main(int argc, char **argv)
|
|||||||
if (panelType == SAVE_PANEL_TYPE) {
|
if (panelType == SAVE_PANEL_TYPE) {
|
||||||
sPanel = WMGetSavePanel(scr);
|
sPanel = WMGetSavePanel(scr);
|
||||||
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
|
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
|
||||||
/*title */ NULL, NULL) == True)
|
title, NULL) == True)
|
||||||
printf("%s\n", WMGetFilePanelFileName(sPanel));
|
printf("%s\n", WMGetFilePanelFileName(sPanel));
|
||||||
else
|
else
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
oPanel = WMGetOpenPanel(scr);
|
oPanel = WMGetOpenPanel(scr);
|
||||||
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
|
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
|
||||||
/*title */ NULL, NULL) == True)
|
title, NULL) == True)
|
||||||
printf("%s\n", WMGetFilePanelFileName(oPanel));
|
printf("%s\n", WMGetFilePanelFileName(oPanel));
|
||||||
else
|
else
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
|
|
||||||
#include "logo.xpm"
|
#include "logo.xpm"
|
||||||
|
|
||||||
void wAbort()
|
_Noreturn void wAbort(void)
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ProgName;
|
char *ProgName;
|
||||||
|
|
||||||
void usage(void)
|
_Noreturn void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage:\n"
|
"usage:\n"
|
||||||
@@ -45,8 +45,6 @@ int main(int argc, char **argv)
|
|||||||
char *initial = NULL;
|
char *initial = NULL;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
int ch;
|
int ch;
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
|
|
||||||
WMInitializeApplication("WMQuery", &argc, argv);
|
WMInitializeApplication("WMQuery", &argc, argv);
|
||||||
|
|
||||||
|
|||||||
+13
-2
@@ -14,7 +14,7 @@
|
|||||||
* This will be called when the application will be terminated because
|
* This will be called when the application will be terminated because
|
||||||
* of a fatal error (only for memory allocation failures ATM).
|
* of a fatal error (only for memory allocation failures ATM).
|
||||||
*/
|
*/
|
||||||
void wAbort()
|
_Noreturn void wAbort(void)
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ int windowCount = 0;
|
|||||||
|
|
||||||
void closeAction(WMWidget * self, void *data)
|
void closeAction(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
WMDestroyWidget(self);
|
WMDestroyWidget(self);
|
||||||
windowCount--;
|
windowCount--;
|
||||||
printf("window closed, window count = %d\n", windowCount);
|
printf("window closed, window count = %d\n", windowCount);
|
||||||
@@ -165,10 +166,13 @@ void testBox(WMScreen * scr)
|
|||||||
|
|
||||||
static void singleClick(WMWidget * self, void *data)
|
static void singleClick(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)self;
|
||||||
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doubleClick(WMWidget * self, void *data)
|
static void doubleClick(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
WMSelectAllListItems((WMList *) self);
|
WMSelectAllListItems((WMList *) self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,6 +484,7 @@ void testColorPanel(WMScreen * scr)
|
|||||||
|
|
||||||
void sliderCallback(WMWidget * w, void *data)
|
void sliderCallback(WMWidget * w, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
printf("SLIDER == %i\n", WMGetSliderValue(w));
|
printf("SLIDER == %i\n", WMGetSliderValue(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,6 +754,8 @@ void testTabView(WMScreen * scr)
|
|||||||
|
|
||||||
void splitViewConstrainProc(WMSplitView * sPtr, int indView, int *minSize, int *maxSize)
|
void splitViewConstrainProc(WMSplitView * sPtr, int indView, int *minSize, int *maxSize)
|
||||||
{
|
{
|
||||||
|
(void)sPtr;
|
||||||
|
|
||||||
switch (indView) {
|
switch (indView) {
|
||||||
case 0:
|
case 0:
|
||||||
*minSize = 20;
|
*minSize = 20;
|
||||||
@@ -782,6 +789,7 @@ static void resizeSplitView(XEvent * event, void *data)
|
|||||||
|
|
||||||
void appendSubviewButtonAction(WMWidget * self, void *data)
|
void appendSubviewButtonAction(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)self;
|
||||||
WMSplitView *sPtr = (WMSplitView *) data;
|
WMSplitView *sPtr = (WMSplitView *) data;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
WMLabel *label = WMCreateLabel(sPtr);
|
WMLabel *label = WMCreateLabel(sPtr);
|
||||||
@@ -796,6 +804,7 @@ void appendSubviewButtonAction(WMWidget * self, void *data)
|
|||||||
|
|
||||||
void removeSubviewButtonAction(WMWidget * self, void *data)
|
void removeSubviewButtonAction(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)self;
|
||||||
WMSplitView *sPtr = (WMSplitView *) data;
|
WMSplitView *sPtr = (WMSplitView *) data;
|
||||||
int count = WMGetSplitViewSubviewsCount(sPtr);
|
int count = WMGetSplitViewSubviewsCount(sPtr);
|
||||||
|
|
||||||
@@ -808,12 +817,14 @@ void removeSubviewButtonAction(WMWidget * self, void *data)
|
|||||||
|
|
||||||
void orientationButtonAction(WMWidget * self, void *data)
|
void orientationButtonAction(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)self;
|
||||||
WMSplitView *sPtr = (WMSplitView *) data;
|
WMSplitView *sPtr = (WMSplitView *) data;
|
||||||
WMSetSplitViewVertical(sPtr, !WMGetSplitViewVertical(sPtr));
|
WMSetSplitViewVertical(sPtr, !WMGetSplitViewVertical(sPtr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustSubviewsButtonAction(WMWidget * self, void *data)
|
void adjustSubviewsButtonAction(WMWidget * self, void *data)
|
||||||
{
|
{
|
||||||
|
(void)self;
|
||||||
WMAdjustSplitViewSubviews((WMSplitView *) data);
|
WMAdjustSplitViewSubviews((WMSplitView *) data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -902,7 +913,7 @@ void testSplitView(WMScreen * scr)
|
|||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testUD()
|
void testUD(void)
|
||||||
{
|
{
|
||||||
WMUserDefaults *defs;
|
WMUserDefaults *defs;
|
||||||
char str[32];
|
char str[32];
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define WINGS_H_VERSION 20210726
|
#define WINGS_H_VERSION 20230226
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -494,6 +494,8 @@ void W_SetPreeditPositon(W_View *view, int x, int y);
|
|||||||
int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer,
|
int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer,
|
||||||
int buflen, KeySym *keysym, Status *status);
|
int buflen, KeySym *keysym, Status *status);
|
||||||
|
|
||||||
|
KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index);
|
||||||
|
|
||||||
|
|
||||||
/* ---[ wmisc.c ]--------------------------------------------------------- */
|
/* ---[ wmisc.c ]--------------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -612,10 +612,10 @@ static void menu_parser_condition_ifmacro(WMenuParser parser, Bool check_exists)
|
|||||||
macro = menu_parser_find_macro(parser, macro_name);
|
macro = menu_parser_find_macro(parser, macro_name);
|
||||||
parser->cond.stack[0].skip =
|
parser->cond.stack[0].skip =
|
||||||
((check_exists) && (macro == NULL)) ||
|
((check_exists) && (macro == NULL)) ||
|
||||||
((!check_exists) && (macro != NULL)) ;
|
((!check_exists) && (macro != NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(parser->cond.stack[0].name, cmd_name);
|
strncpy(parser->cond.stack[0].name, cmd_name, sizeof(parser->cond.stack[0].name) - 1);
|
||||||
parser->cond.stack[0].line = parser->line_number;
|
parser->cond.stack[0].line = parser->line_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ void menu_parser_define_macro(WMenuParser parser)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
macro = wmalloc(sizeof(*macro));
|
macro = wmalloc(sizeof(*macro));
|
||||||
|
memset(arg_name, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
|
||||||
|
|
||||||
/* Isolate name of macro */
|
/* Isolate name of macro */
|
||||||
idx = 0;
|
idx = 0;
|
||||||
@@ -279,7 +280,8 @@ WParserMacro *menu_parser_find_macro(WMenuParser parser, const char *name)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
return macro;
|
return macro;
|
||||||
check_next_macro: ;
|
check_next_macro:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -391,6 +393,8 @@ void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro)
|
|||||||
unsigned int size;
|
unsigned int size;
|
||||||
int i, space_left;
|
int i, space_left;
|
||||||
|
|
||||||
|
memset(arg_value, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
|
||||||
|
|
||||||
/* Skip the name of the macro, this was not done by caller */
|
/* Skip the name of the macro, this was not done by caller */
|
||||||
for (i = 0; macro->name[i] != '\0'; i++)
|
for (i = 0; macro->name[i] != '\0'; i++)
|
||||||
parser->rd++;
|
parser->rd++;
|
||||||
@@ -692,7 +696,7 @@ static void w_create_macro(WMenuParser parser, const char *name, WParserMacroFun
|
|||||||
WParserMacro *macro;
|
WParserMacro *macro;
|
||||||
|
|
||||||
macro = wmalloc(sizeof(*macro));
|
macro = wmalloc(sizeof(*macro));
|
||||||
strcpy(macro->name, name);
|
strncpy(macro->name, name, sizeof(macro->name) - 1);
|
||||||
macro->function = handler;
|
macro->function = handler;
|
||||||
macro->arg_count = -1;
|
macro->arg_count = -1;
|
||||||
macro->next = parser->macros;
|
macro->next = parser->macros;
|
||||||
|
|||||||
+3
-3
@@ -51,7 +51,7 @@ static WMColor *findCloseColor(WMScreen * scr, unsigned short red, unsigned shor
|
|||||||
color->refCount = 1;
|
color->refCount = 1;
|
||||||
color->color = xcolor;
|
color->color = xcolor;
|
||||||
color->alpha = alpha;
|
color->alpha = alpha;
|
||||||
color->flags.exact = 1;
|
color->flags.exact = 0;
|
||||||
color->gc = NULL;
|
color->gc = NULL;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
@@ -91,7 +91,7 @@ WMColor *WMCreateRGBColor(WMScreen * scr, unsigned short red, unsigned short gre
|
|||||||
color = findCloseColor(scr, red, green, blue, 0xffff);
|
color = findCloseColor(scr, red, green, blue, 0xffff);
|
||||||
}
|
}
|
||||||
if (!color)
|
if (!color)
|
||||||
color = WMBlackColor(scr);
|
color = scr->black;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ WMColor *WMCreateRGBAColor(WMScreen * scr, unsigned short red, unsigned short gr
|
|||||||
color = findCloseColor(scr, red, green, blue, alpha);
|
color = findCloseColor(scr, red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
if (!color)
|
if (!color)
|
||||||
color = WMBlackColor(scr);
|
color = scr->black;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -2259,7 +2259,7 @@ static void wheelPositionSelectionOutBounds(W_ColorPanel * panel, int x, int y)
|
|||||||
|
|
||||||
static void wheelUpdateBrightnessGradientFromLocation(W_ColorPanel * panel)
|
static void wheelUpdateBrightnessGradientFromLocation(W_ColorPanel * panel)
|
||||||
{
|
{
|
||||||
CPColor from;
|
CPColor from = {};
|
||||||
unsigned long ofs;
|
unsigned long ofs;
|
||||||
|
|
||||||
ofs = panel->coly * panel->wheelMtrx->width + panel->colx;
|
ofs = panel->coly * panel->wheelMtrx->width + panel->colx;
|
||||||
@@ -2604,7 +2604,7 @@ static void cmykTextFieldCallback(void *observerData, WMNotification * notificat
|
|||||||
|
|
||||||
static void hsbSliderCallback(WMWidget * w, void *data)
|
static void hsbSliderCallback(WMWidget * w, void *data)
|
||||||
{
|
{
|
||||||
CPColor cpColor;
|
CPColor cpColor = {};
|
||||||
int value[3];
|
int value[3];
|
||||||
char tmp[4];
|
char tmp[4];
|
||||||
W_ColorPanel *panel = (W_ColorPanel *) data;
|
W_ColorPanel *panel = (W_ColorPanel *) data;
|
||||||
@@ -2640,7 +2640,7 @@ static void hsbSliderCallback(WMWidget * w, void *data)
|
|||||||
|
|
||||||
static void hsbTextFieldCallback(void *observerData, WMNotification * notification)
|
static void hsbTextFieldCallback(void *observerData, WMNotification * notification)
|
||||||
{
|
{
|
||||||
CPColor cpColor;
|
CPColor cpColor = {};
|
||||||
int value[3];
|
int value[3];
|
||||||
char tmp[12]; /* We only 4 bytes needed, but compilers cannot know that */
|
char tmp[12]; /* We only 4 bytes needed, but compilers cannot know that */
|
||||||
int n;
|
int n;
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ WMFrame *WMCreateFrame(WMWidget * parent)
|
|||||||
|
|
||||||
static void destroyFrame(Frame * fPtr)
|
static void destroyFrame(Frame * fPtr)
|
||||||
{
|
{
|
||||||
|
if (fPtr->textColor)
|
||||||
|
WMReleaseColor(fPtr->textColor);
|
||||||
|
|
||||||
if (fPtr->caption)
|
if (fPtr->caption)
|
||||||
wfree(fPtr->caption);
|
wfree(fPtr->caption);
|
||||||
|
|
||||||
|
|||||||
@@ -213,3 +213,32 @@ int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer, int bufl
|
|||||||
#endif
|
#endif
|
||||||
return XLookupString(event, buffer, buflen, keysym, (XComposeStatus *) status);
|
return XLookupString(event, buffer, buflen, keysym, (XComposeStatus *) status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map a keycode to the corresponding keysym
|
||||||
|
* To replace the deprecated X11 function XKeycodeToKeysym
|
||||||
|
*/
|
||||||
|
KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index)
|
||||||
|
{
|
||||||
|
static int min_kc = -1;
|
||||||
|
static int max_kc;
|
||||||
|
int num_syms;
|
||||||
|
KeySym *key_syms;
|
||||||
|
KeySym ks;
|
||||||
|
|
||||||
|
XDisplayKeycodes(display, &min_kc, &max_kc);
|
||||||
|
if (keycode < min_kc || keycode > max_kc || index < 0) {
|
||||||
|
return NoSymbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
key_syms = XGetKeyboardMapping(display, keycode, 1, &num_syms);
|
||||||
|
if (index >= num_syms) {
|
||||||
|
XFree(key_syms);
|
||||||
|
return NoSymbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
ks = key_syms[index];
|
||||||
|
XFree(key_syms);
|
||||||
|
|
||||||
|
return ks;
|
||||||
|
}
|
||||||
|
|||||||
+3
-3
@@ -25,7 +25,7 @@ static void handleKeyPress(XEvent * event, void *clientData)
|
|||||||
|
|
||||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||||
|
|
||||||
if (ksym == XK_Return && panel->defBtn) {
|
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||||
WMPerformButtonClick(panel->defBtn);
|
WMPerformButtonClick(panel->defBtn);
|
||||||
} else if (ksym == XK_Escape) {
|
} else if (ksym == XK_Escape) {
|
||||||
if (panel->altBtn || panel->othBtn) {
|
if (panel->altBtn || panel->othBtn) {
|
||||||
@@ -421,7 +421,7 @@ static void handleKeyPress2(XEvent * event, void *clientData)
|
|||||||
|
|
||||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||||
|
|
||||||
if (ksym == XK_Return && panel->defBtn) {
|
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||||
WMPerformButtonClick(panel->defBtn);
|
WMPerformButtonClick(panel->defBtn);
|
||||||
} else if (ksym == XK_Escape) {
|
} else if (ksym == XK_Escape) {
|
||||||
if (panel->altBtn) {
|
if (panel->altBtn) {
|
||||||
@@ -709,7 +709,7 @@ static void handleKeyPress3(XEvent * event, void *clientData)
|
|||||||
|
|
||||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||||
|
|
||||||
if (ksym == XK_Return && panel->defBtn) {
|
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||||
WMPerformButtonClick(panel->defBtn);
|
WMPerformButtonClick(panel->defBtn);
|
||||||
} else if (ksym == XK_Escape) {
|
} else if (ksym == XK_Escape) {
|
||||||
if (panel->altBtn) {
|
if (panel->altBtn) {
|
||||||
|
|||||||
+4
-1
@@ -166,12 +166,15 @@ typedef struct W_Text {
|
|||||||
WMArray *xdndDestinationTypes;
|
WMArray *xdndDestinationTypes;
|
||||||
} Text;
|
} Text;
|
||||||
|
|
||||||
|
/* not used */
|
||||||
|
#if 0
|
||||||
#define NOTIFY(T,C,N,A) {\
|
#define NOTIFY(T,C,N,A) {\
|
||||||
WMNotification *notif = WMCreateNotification(N,T,A);\
|
WMNotification *notif = WMCreateNotification(N,T,A);\
|
||||||
if ((T)->delegate && (T)->delegate->C)\
|
if ((T)->delegate && (T)->delegate->C)\
|
||||||
(*(T)->delegate->C)((T)->delegate,notif);\
|
(*(T)->delegate->C)((T)->delegate,notif);\
|
||||||
WMPostNotification(notif);\
|
WMPostNotification(notif);\
|
||||||
WMReleaseNotification(notif);}
|
WMReleaseNotification(notif);}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TYPETEXT 0
|
#define TYPETEXT 0
|
||||||
|
|
||||||
@@ -622,7 +625,7 @@ static void paintText(Text * tPtr)
|
|||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
const char *text;
|
const char *text;
|
||||||
int len, y, c, s, done = False, dir /* 1 = down */ ;
|
int len, y, c, s, done = False, dir; /* dir 1 = down */
|
||||||
WMScreen *scr = tPtr->view->screen;
|
WMScreen *scr = tPtr->view->screen;
|
||||||
Display *dpy = tPtr->view->screen->display;
|
Display *dpy = tPtr->view->screen->display;
|
||||||
Window win = tPtr->view->window;
|
Window win = tPtr->view->window;
|
||||||
|
|||||||
+1
-1
@@ -661,7 +661,7 @@ static void didResizeTextField(W_ViewDelegate * self, WMView * view)
|
|||||||
|
|
||||||
tPtr->offsetWidth = WMAX((tPtr->view->size.height - WMFontHeight(tPtr->font)) / 2, 1);
|
tPtr->offsetWidth = WMAX((tPtr->view->size.height - WMFontHeight(tPtr->font)) / 2, 1);
|
||||||
|
|
||||||
tPtr->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth /*+ 2 */ ;
|
tPtr->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *makeHiddenString(int length)
|
static char *makeHiddenString(int length)
|
||||||
|
|||||||
@@ -395,7 +395,11 @@ static void setWindowMakerHints(WMWindow * win)
|
|||||||
|
|
||||||
memset(&attribs, 0, sizeof(GNUstepWMAttributes));
|
memset(&attribs, 0, sizeof(GNUstepWMAttributes));
|
||||||
attribs.flags = GSWindowStyleAttr | GSWindowLevelAttr | GSExtraFlagsAttr;
|
attribs.flags = GSWindowStyleAttr | GSWindowLevelAttr | GSExtraFlagsAttr;
|
||||||
|
|
||||||
|
if (win->minSize.width == win->maxSize.width && win->minSize.height == win->maxSize.height)
|
||||||
|
win->flags.style &= ~WMResizableWindowMask;
|
||||||
attribs.window_style = win->flags.style;
|
attribs.window_style = win->flags.style;
|
||||||
|
|
||||||
attribs.window_level = win->level;
|
attribs.window_level = win->level;
|
||||||
if (win->flags.documentEdited)
|
if (win->flags.documentEdited)
|
||||||
attribs.extra_flags = GSDocumentEditedFlag;
|
attribs.extra_flags = GSDocumentEditedFlag;
|
||||||
|
|||||||
+17
-5
@@ -1076,6 +1076,8 @@ static void deleteTexture(WMWidget * w, void *data)
|
|||||||
(void) w;
|
(void) w;
|
||||||
|
|
||||||
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
||||||
|
if (section < 0)
|
||||||
|
return;
|
||||||
row = WMGetListSelectedItemRow(panel->texLs);
|
row = WMGetListSelectedItemRow(panel->texLs);
|
||||||
item = WMGetListItem(panel->texLs, row);
|
item = WMGetListItem(panel->texLs, row);
|
||||||
titem = (TextureListItem *) item->clientData;
|
titem = (TextureListItem *) item->clientData;
|
||||||
@@ -1134,6 +1136,8 @@ static void changePage(WMWidget * w, void *data)
|
|||||||
|
|
||||||
if (w) {
|
if (w) {
|
||||||
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
||||||
|
if (section < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
WMSelectListItem(panel->texLs, panel->textureIndex[section]);
|
WMSelectListItem(panel->texLs, panel->textureIndex[section]);
|
||||||
|
|
||||||
@@ -1233,6 +1237,8 @@ static void textureDoubleClick(WMWidget * w, void *data)
|
|||||||
|
|
||||||
/* unselect old texture */
|
/* unselect old texture */
|
||||||
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
section = WMGetPopUpButtonSelectedItem(panel->secP);
|
||||||
|
if (section < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
|
item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
|
||||||
titem = (TextureListItem *) item->clientData;
|
titem = (TextureListItem *) item->clientData;
|
||||||
@@ -1261,7 +1267,7 @@ static void paintListItem(WMList * lPtr, int index, Drawable d, char *text, int
|
|||||||
{
|
{
|
||||||
_Panel *panel = (_Panel *) WMGetHangedData(lPtr);
|
_Panel *panel = (_Panel *) WMGetHangedData(lPtr);
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
int width, height, x, y;
|
int width, height, x, y, tmp;
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
WMColor *back = (state & WLDSSelected) ? WMWhiteColor(scr) : WMGrayColor(scr);
|
WMColor *back = (state & WLDSSelected) ? WMWhiteColor(scr) : WMGrayColor(scr);
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
@@ -1290,7 +1296,8 @@ static void paintListItem(WMList * lPtr, int index, Drawable d, char *text, int
|
|||||||
XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0,
|
XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0,
|
||||||
TEXPREV_WIDTH, TEXPREV_HEIGHT, x + 5, y + 5);
|
TEXPREV_WIDTH, TEXPREV_HEIGHT, x + 5, y + 5);
|
||||||
|
|
||||||
if ((1 << WMGetPopUpButtonSelectedItem(panel->secP)) & titem->selectedFor)
|
tmp = WMGetPopUpButtonSelectedItem(panel->secP);
|
||||||
|
if ((tmp >= 0) && ((1 << tmp) & titem->selectedFor))
|
||||||
WMDrawPixmap(panel->onLed, d, x + TEXPREV_WIDTH + 10, y + 6);
|
WMDrawPixmap(panel->onLed, d, x + TEXPREV_WIDTH + 10, y + 6);
|
||||||
else if (titem->selectedFor)
|
else if (titem->selectedFor)
|
||||||
WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6);
|
WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6);
|
||||||
@@ -1425,6 +1432,10 @@ static void changeColorPage(WMWidget * w, void *data)
|
|||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
RContext *rc = WMScreenRContext(scr);
|
RContext *rc = WMScreenRContext(scr);
|
||||||
|
|
||||||
|
section = WMGetPopUpButtonSelectedItem(panel->colP);
|
||||||
|
if (section < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (panel->preview) {
|
if (panel->preview) {
|
||||||
GC gc;
|
GC gc;
|
||||||
|
|
||||||
@@ -1436,7 +1447,6 @@ static void changeColorPage(WMWidget * w, void *data)
|
|||||||
colorOptions[panel->oldcsection].hand.y);
|
colorOptions[panel->oldcsection].hand.y);
|
||||||
}
|
}
|
||||||
if (w) {
|
if (w) {
|
||||||
section = WMGetPopUpButtonSelectedItem(panel->colP);
|
|
||||||
|
|
||||||
panel->oldcsection = section;
|
panel->oldcsection = section;
|
||||||
if (panel->preview)
|
if (panel->preview)
|
||||||
@@ -1737,6 +1747,8 @@ static void colorWellObserver(void *self, WMNotification * n)
|
|||||||
(void) n;
|
(void) n;
|
||||||
|
|
||||||
p = WMGetPopUpButtonSelectedItem(panel->colP);
|
p = WMGetPopUpButtonSelectedItem(panel->colP);
|
||||||
|
if (p < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
WMReleaseColor(panel->colors[p]);
|
WMReleaseColor(panel->colors[p]);
|
||||||
|
|
||||||
@@ -1831,7 +1843,7 @@ static void createPanel(Panel * p)
|
|||||||
panel->fprefix = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
|
panel->fprefix = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
|
||||||
|
|
||||||
if (access(panel->fprefix, F_OK) != 0) {
|
if (access(panel->fprefix, F_OK) != 0) {
|
||||||
if (mkdir(panel->fprefix, 0755) < 0) {
|
if (-1 == mkdir(panel->fprefix, 0755) && errno != EEXIST) {
|
||||||
werror("%s", panel->fprefix);
|
werror("%s", panel->fprefix);
|
||||||
ok = False;
|
ok = False;
|
||||||
}
|
}
|
||||||
@@ -1841,7 +1853,7 @@ static void createPanel(Panel * p)
|
|||||||
wfree(panel->fprefix);
|
wfree(panel->fprefix);
|
||||||
panel->fprefix = tmp;
|
panel->fprefix = tmp;
|
||||||
if (access(panel->fprefix, F_OK) != 0) {
|
if (access(panel->fprefix, F_OK) != 0) {
|
||||||
if (mkdir(panel->fprefix, 0755) < 0) {
|
if (-1 == mkdir(panel->fprefix, 0755) && errno != EEXIST) {
|
||||||
werror("%s", panel->fprefix);
|
werror("%s", panel->fprefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -25,7 +25,7 @@
|
|||||||
/* This structure containts the list of all the check-buttons to display in the
|
/* This structure containts the list of all the check-buttons to display in the
|
||||||
* expert tab of the window with the corresponding information for effect
|
* expert tab of the window with the corresponding information for effect
|
||||||
*/
|
*/
|
||||||
static const struct {
|
static struct expert_option {
|
||||||
const char *label; /* Text displayed to user */
|
const char *label; /* Text displayed to user */
|
||||||
|
|
||||||
int def_state; /* True/False: the default value, if not defined in current config */
|
int def_state; /* True/False: the default value, if not defined in current config */
|
||||||
@@ -172,6 +172,19 @@ static void upButtonCallback(WMWidget *self, void *data)
|
|||||||
changeIntTextfield(data, 1);
|
changeIntTextfield(data, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cmpExpertOptions(const void *v1, const void *v2)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
const struct expert_option *opt1 = (struct expert_option *)v1;
|
||||||
|
const struct expert_option *opt2 = (struct expert_option *)v2;
|
||||||
|
|
||||||
|
if ((rc = strcmp(opt1->label, opt2->label)) < 0)
|
||||||
|
return -1;
|
||||||
|
else if (rc > 0)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void createPanel(Panel *p)
|
static void createPanel(Panel *p)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel *) p;
|
_Panel *panel = (_Panel *) p;
|
||||||
@@ -195,6 +208,7 @@ static void createPanel(Panel *p)
|
|||||||
WMSetFrameRelief(f, WRFlat);
|
WMSetFrameRelief(f, WRFlat);
|
||||||
|
|
||||||
udb = WMGetStandardUserDefaults();
|
udb = WMGetStandardUserDefaults();
|
||||||
|
qsort(expert_options, wlengthof(expert_options), sizeof(expert_options[0]), cmpExpertOptions);
|
||||||
for (i = 0; i < wlengthof(expert_options); i++) {
|
for (i = 0; i < wlengthof(expert_options); i++) {
|
||||||
if (expert_options[i].class != OPTION_WMAKER_INT) {
|
if (expert_options[i].class != OPTION_WMAKER_INT) {
|
||||||
panel->swi[i] = WMCreateSwitchButton(f);
|
panel->swi[i] = WMCreateSwitchButton(f);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ typedef struct _Panel {
|
|||||||
* First parameter is the internal keyword known by WMaker
|
* First parameter is the internal keyword known by WMaker
|
||||||
* Second is the text displayed to the user
|
* Second is the text displayed to the user
|
||||||
*/
|
*/
|
||||||
static const struct {
|
static struct keyOption {
|
||||||
const char *key;
|
const char *key;
|
||||||
const char *title;
|
const char *title;
|
||||||
} keyOptions[] = {
|
} keyOptions[] = {
|
||||||
@@ -156,8 +156,12 @@ static const struct {
|
|||||||
{ "WindowRelaunchKey", N_("Launch new instance of application") },
|
{ "WindowRelaunchKey", N_("Launch new instance of application") },
|
||||||
{ "ScreenSwitchKey", N_("Switch to Next Screen/Monitor") },
|
{ "ScreenSwitchKey", N_("Switch to Next Screen/Monitor") },
|
||||||
{ "RunKey", N_("Run application") },
|
{ "RunKey", N_("Run application") },
|
||||||
|
{ "ExitKey", N_("Exit Window Maker") },
|
||||||
{ "DockRaiseLowerKey", N_("Raise/Lower Dock") },
|
{ "DockRaiseLowerKey", N_("Raise/Lower Dock") },
|
||||||
{ "ClipRaiseLowerKey", N_("Raise/Lower Clip") }
|
{ "ClipRaiseLowerKey", N_("Raise/Lower Clip") },
|
||||||
|
{ "ScreenCaptureKey", N_("Capture the entire screen") },
|
||||||
|
{ "WindowCaptureKey", N_("Capture a window") },
|
||||||
|
{ "PartialCaptureKey", N_("Capture a portion of the screen") }
|
||||||
#ifdef XKB_MODELOCK
|
#ifdef XKB_MODELOCK
|
||||||
,{ "ToggleKbdModeKey", N_("Toggle keyboard language") }
|
,{ "ToggleKbdModeKey", N_("Toggle keyboard language") }
|
||||||
#endif /* XKB_MODELOCK */
|
#endif /* XKB_MODELOCK */
|
||||||
@@ -316,11 +320,8 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
|
|||||||
if (ev.type == KeyPress && ev.xkey.keycode != 0) {
|
if (ev.type == KeyPress && ev.xkey.keycode != 0) {
|
||||||
numlock_mask = NumLockMask(dpy);
|
numlock_mask = NumLockMask(dpy);
|
||||||
|
|
||||||
if (xext_xkb_supported)
|
/* conditional mask check to get numeric keypad keys */
|
||||||
/* conditional mask check to get numeric keypad keys */
|
ksym = W_KeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0);
|
||||||
ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0);
|
|
||||||
else
|
|
||||||
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
|
|
||||||
|
|
||||||
if (!IsModifierKey(ksym)) {
|
if (!IsModifierKey(ksym)) {
|
||||||
if (convert_case) {
|
if (convert_case) {
|
||||||
@@ -368,6 +369,36 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
|
|||||||
return wstrdup(buffer);
|
return wstrdup(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check if the keystr entered is already set to another action
|
||||||
|
* if found it returns the position in the keyOptions
|
||||||
|
*/
|
||||||
|
static int isKeySet(_Panel *panel, char *keystr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
for (i = 0; i < panel->actionCount; i++) {
|
||||||
|
str = NULL;
|
||||||
|
if (panel->shortcuts[i]) {
|
||||||
|
str = wtrimspace(panel->shortcuts[i]);
|
||||||
|
if (strlen(str) == 0) {
|
||||||
|
wfree(str);
|
||||||
|
str = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str) {
|
||||||
|
if (strcmp(keystr, str) == 0) {
|
||||||
|
wfree(str);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
wfree(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static void captureClick(WMWidget * w, void *data)
|
static void captureClick(WMWidget * w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel *) data;
|
_Panel *panel = (_Panel *) data;
|
||||||
@@ -382,17 +413,31 @@ static void captureClick(WMWidget * w, void *data)
|
|||||||
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
shortcut = capture_shortcut(dpy, &panel->capturing, 1);
|
shortcut = capture_shortcut(dpy, &panel->capturing, 1);
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
|
int key_idx = -1;
|
||||||
int row = WMGetListSelectedItemRow(panel->actLs);
|
int row = WMGetListSelectedItemRow(panel->actLs);
|
||||||
|
|
||||||
WMSetTextFieldText(panel->shoT, shortcut);
|
key_idx = isKeySet(panel, shortcut);
|
||||||
if (row >= 0) {
|
if (key_idx >= 0 && (key_idx != row)) {
|
||||||
if (panel->shortcuts[row])
|
char *msg;
|
||||||
wfree(panel->shortcuts[row]);
|
|
||||||
panel->shortcuts[row] = shortcut;
|
|
||||||
|
|
||||||
WMRedisplayWidget(panel->actLs);
|
msg = wstrconcat(_("Key shortcut already in use by the "), _(keyOptions[key_idx].title));
|
||||||
} else {
|
WMRunAlertPanel(WMWidgetScreen(w), GetWindow(),
|
||||||
|
_("Error"),
|
||||||
|
msg,
|
||||||
|
_("OK"), NULL, NULL);
|
||||||
|
wfree(msg);
|
||||||
wfree(shortcut);
|
wfree(shortcut);
|
||||||
|
} else {
|
||||||
|
WMSetTextFieldText(panel->shoT, shortcut);
|
||||||
|
if (row >= 0) {
|
||||||
|
if (panel->shortcuts[row])
|
||||||
|
wfree(panel->shortcuts[row]);
|
||||||
|
panel->shortcuts[row] = shortcut;
|
||||||
|
|
||||||
|
WMRedisplayWidget(panel->actLs);
|
||||||
|
} else {
|
||||||
|
wfree(shortcut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,6 +544,20 @@ static void paintItem(WMList * lPtr, int index, Drawable d, char *text, int stat
|
|||||||
WMDrawString(scr, d, panel->black, panel->font, x + 20, y, text, strlen(text));
|
WMDrawString(scr, d, panel->black, panel->font, x + 20, y, text, strlen(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cmpKeyOptions(const void *v1, const void *v2)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
const struct keyOption *opt1 = (struct keyOption *)v1;
|
||||||
|
const struct keyOption *opt2 = (struct keyOption *)v2;
|
||||||
|
|
||||||
|
if ((rc = strcmp(opt1->title, opt2->title)) < 0)
|
||||||
|
return -1;
|
||||||
|
else if (rc > 0)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void createPanel(Panel * p)
|
static void createPanel(Panel * p)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel *) p;
|
_Panel *panel = (_Panel *) p;
|
||||||
@@ -538,6 +597,7 @@ static void createPanel(Panel * p)
|
|||||||
WMSetListUserDrawProc(panel->actLs, paintItem);
|
WMSetListUserDrawProc(panel->actLs, paintItem);
|
||||||
WMHangData(panel->actLs, panel);
|
WMHangData(panel->actLs, panel);
|
||||||
|
|
||||||
|
qsort(keyOptions, wlengthof(keyOptions), sizeof(keyOptions[0]), cmpKeyOptions);
|
||||||
for (i = 0; i < wlengthof(keyOptions); i++) {
|
for (i = 0; i < wlengthof(keyOptions); i++) {
|
||||||
WMAddListItem(panel->actLs, _(keyOptions[i].title));
|
WMAddListItem(panel->actLs, _(keyOptions[i].title));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,6 +291,8 @@ static void changedItemPad(WMWidget * w, void *data)
|
|||||||
_Panel *panel = (_Panel *) data;
|
_Panel *panel = (_Panel *) data;
|
||||||
int padn = WMGetPopUpButtonSelectedItem(w);
|
int padn = WMGetPopUpButtonSelectedItem(w);
|
||||||
|
|
||||||
|
if (padn < 0)
|
||||||
|
return;
|
||||||
WMUnmapWidget(panel->itemPad[panel->currentPad]);
|
WMUnmapWidget(panel->itemPad[panel->currentPad]);
|
||||||
WMMapWidget(panel->itemPad[padn]);
|
WMMapWidget(panel->itemPad[padn]);
|
||||||
|
|
||||||
|
|||||||
@@ -381,10 +381,7 @@ static void fillModifierPopUp(WMPopUpButton * pop)
|
|||||||
if (mapping->modifiermap[idx] != 0) {
|
if (mapping->modifiermap[idx] != 0) {
|
||||||
int l;
|
int l;
|
||||||
for (l = 0; l < 4; l++) {
|
for (l = 0; l < 4; l++) {
|
||||||
if (xext_xkb_supported)
|
ksym = W_KeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
|
||||||
ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l);
|
|
||||||
else
|
|
||||||
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0);
|
|
||||||
if (ksym != NoSymbol)
|
if (ksym != NoSymbol)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -751,6 +748,8 @@ static void storeData(_Panel * panel)
|
|||||||
int action;
|
int action;
|
||||||
|
|
||||||
action = WMGetPopUpButtonSelectedItem(panel->mouse_action[i].popup);
|
action = WMGetPopUpButtonSelectedItem(panel->mouse_action[i].popup);
|
||||||
|
if (action < 0)
|
||||||
|
continue;
|
||||||
if (button_list[i].type == T_BUTTON)
|
if (button_list[i].type == T_BUTTON)
|
||||||
db_value = button_actions[action].db_value;
|
db_value = button_actions[action].db_value;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -196,9 +196,13 @@ static void storeData(_Panel * panel)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = WMGetPopUpButtonSelectedItem(panel->sizeP);
|
i = WMGetPopUpButtonSelectedItem(panel->sizeP);
|
||||||
|
if (i < 0)
|
||||||
|
return;
|
||||||
SetStringForKey(resize_display[i].db_value, "ResizeDisplay");
|
SetStringForKey(resize_display[i].db_value, "ResizeDisplay");
|
||||||
|
|
||||||
i = WMGetPopUpButtonSelectedItem(panel->posiP);
|
i = WMGetPopUpButtonSelectedItem(panel->posiP);
|
||||||
|
if (i < 0)
|
||||||
|
return;
|
||||||
SetStringForKey(move_display[i].db_value, "MoveDisplay");
|
SetStringForKey(move_display[i].db_value, "MoveDisplay");
|
||||||
|
|
||||||
lr = WMGetButtonSelected(panel->lrB);
|
lr = WMGetButtonSelected(panel->lrB);
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ static void changeTypeCallback(WMWidget *w, void *data)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
newType = WMGetPopUpButtonSelectedItem(w);
|
newType = WMGetPopUpButtonSelectedItem(w);
|
||||||
if (newType == panel->currentType)
|
if (newType < 0 || newType == panel->currentType)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (panel->currentType >= 0) {
|
if (panel->currentType >= 0) {
|
||||||
|
|||||||
+1
-1
@@ -33,6 +33,7 @@
|
|||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
|
#include <WINGs/WINGsP.h>
|
||||||
|
|
||||||
/* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */
|
/* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */
|
||||||
#include "../src/wconfig.h"
|
#include "../src/wconfig.h"
|
||||||
@@ -54,7 +55,6 @@
|
|||||||
/****/
|
/****/
|
||||||
|
|
||||||
extern char *NOptionValueChanged;
|
extern char *NOptionValueChanged;
|
||||||
extern Bool xext_xkb_supported;
|
|
||||||
|
|
||||||
typedef struct _Panel Panel;
|
typedef struct _Panel Panel;
|
||||||
|
|
||||||
|
|||||||
@@ -207,12 +207,15 @@ static void createPanel(Panel * p)
|
|||||||
|
|
||||||
static void storeData(_Panel * panel)
|
static void storeData(_Panel * panel)
|
||||||
{
|
{
|
||||||
|
int tmp = WMGetPopUpButtonSelectedItem(panel->posP);
|
||||||
|
|
||||||
|
if (tmp < 0)
|
||||||
|
return;
|
||||||
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
|
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
|
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
|
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
|
||||||
|
|
||||||
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
|
SetStringForKey(WSNamePositions[tmp], "WorkspaceNameDisplayPosition");
|
||||||
"WorkspaceNameDisplayPosition");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel *InitWorkspace(WMWidget *parent)
|
Panel *InitWorkspace(WMWidget *parent)
|
||||||
|
|||||||
@@ -1150,7 +1150,7 @@ static void dragItem(WEditMenu * menu, WEditMenuItem * item, Bool copy)
|
|||||||
static XColor back = { 0, 0xffff, 0xffff, 0xffff, DoRed | DoGreen | DoBlue, 0 };
|
static XColor back = { 0, 0xffff, 0xffff, 0xffff, DoRed | DoGreen | DoBlue, 0 };
|
||||||
Display *dpy = W_VIEW_DISPLAY(menu->view);
|
Display *dpy = W_VIEW_DISPLAY(menu->view);
|
||||||
WMScreen *scr = W_VIEW_SCREEN(menu->view);
|
WMScreen *scr = W_VIEW_SCREEN(menu->view);
|
||||||
int x, y;
|
int x = 0, y = 0;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
Bool done = False;
|
Bool done = False;
|
||||||
Window blaw;
|
Window blaw;
|
||||||
|
|||||||
@@ -35,8 +35,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *NOptionValueChanged = "NOptionValueChanged";
|
char *NOptionValueChanged = "NOptionValueChanged";
|
||||||
Bool xext_xkb_supported = False;
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_DEATHS 64
|
#define MAX_DEATHS 64
|
||||||
|
|
||||||
@@ -157,8 +155,6 @@ int main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
xext_xkb_supported = XkbQueryExtension(dpy, NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
WMPLSetCaseSensitive(False);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
Initialize(scr);
|
Initialize(scr);
|
||||||
|
|||||||
@@ -171,10 +171,7 @@ static void x_reset_modifier_mapping(Display * display)
|
|||||||
KeySym sym;
|
KeySym sym;
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
if (xext_xkb_supported)
|
sym = W_KeycodeToKeysym(display, code, column);
|
||||||
sym = XkbKeycodeToKeysym(display, code, 0, column);
|
|
||||||
else
|
|
||||||
sym = XKeycodeToKeysym(display, code, column);
|
|
||||||
} else {
|
} else {
|
||||||
sym = NoSymbol;
|
sym = NoSymbol;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
static char *magick[] = {
|
static char *magick[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"50 40 95 2",
|
"50 40 95 2",
|
||||||
" c Gray0",
|
" c #000000",
|
||||||
". c #010101",
|
". c #010101",
|
||||||
"X c Gray2",
|
"X c #050505",
|
||||||
"o c #040406",
|
"o c #040406",
|
||||||
"O c #070707",
|
"O c #070707",
|
||||||
"+ c #0a0a0d",
|
"+ c #0a0a0d",
|
||||||
@@ -20,14 +20,14 @@ static char *magick[] = {
|
|||||||
": c #4e4e4e",
|
": c #4e4e4e",
|
||||||
"> c #505055",
|
"> c #505055",
|
||||||
", c #585858",
|
", c #585858",
|
||||||
"< c Gray37",
|
"< c #5e5e5e",
|
||||||
"1 c #494d62",
|
"1 c #494d62",
|
||||||
"2 c #545066",
|
"2 c #545066",
|
||||||
"3 c #57556f",
|
"3 c #57556f",
|
||||||
"4 c #5d627c",
|
"4 c #5d627c",
|
||||||
"5 c #604e42",
|
"5 c #604e42",
|
||||||
"6 c Gray39",
|
"6 c #636363",
|
||||||
"7 c Gray41",
|
"7 c #696969",
|
||||||
"8 c #646475",
|
"8 c #646475",
|
||||||
"9 c #7e6a63",
|
"9 c #7e6a63",
|
||||||
"0 c #75746d",
|
"0 c #75746d",
|
||||||
@@ -67,36 +67,36 @@ static char *magick[] = {
|
|||||||
"D c #989799",
|
"D c #989799",
|
||||||
"F c #9b9b9b",
|
"F c #9b9b9b",
|
||||||
"G c #999e98",
|
"G c #999e98",
|
||||||
"H c Gray62",
|
"H c #9e9e9e",
|
||||||
"J c #9e9f9f",
|
"J c #9e9f9f",
|
||||||
"K c #8d8cba",
|
"K c #8d8cba",
|
||||||
"L c #9995a0",
|
"L c #9995a0",
|
||||||
"P c #a2a2a3",
|
"P c #a2a2a3",
|
||||||
"I c #a7a7a8",
|
"I c #a7a7a8",
|
||||||
"U c Gray66",
|
"U c #a8a8a8",
|
||||||
"Y c #acacac",
|
"Y c #acacac",
|
||||||
"T c Gray68",
|
"T c #adadad",
|
||||||
"R c Gray69",
|
"R c #b0b0b0",
|
||||||
"E c #b2b2b2",
|
"E c #b2b2b2",
|
||||||
"W c #b4b4b4",
|
"W c #b4b4b4",
|
||||||
"Q c Gray71",
|
"Q c #b5b5b5",
|
||||||
"! c #b9b9b9",
|
"! c #b9b9b9",
|
||||||
"~ c Gray73",
|
"~ c #bababa",
|
||||||
"^ c #bbbbbb",
|
"^ c #bbbbbb",
|
||||||
"/ c #a7a7c5",
|
"/ c #a7a7c5",
|
||||||
"( c #acadcf",
|
"( c #acadcf",
|
||||||
") c #c0c0c0",
|
") c #c0c0c0",
|
||||||
"_ c #c3c3c3",
|
"_ c #c3c3c3",
|
||||||
"` c #c8c8c8",
|
"` c #c8c8c8",
|
||||||
"' c Gray79",
|
"' c #c9c9c9",
|
||||||
"] c Gray80",
|
"] c #cccccc",
|
||||||
"[ c #dfdfdf",
|
"[ c #dfdfdf",
|
||||||
"{ c #e2e2e2",
|
"{ c #e2e2e2",
|
||||||
"} c Gray91",
|
"} c #e8e8e8",
|
||||||
"| c #e9e9e9",
|
"| c #e9e9e9",
|
||||||
" . c Gray95",
|
" . c #f2f2f2",
|
||||||
".. c #fbfbfb",
|
".. c #fbfbfb",
|
||||||
"X. c Gray100",
|
"X. c #ffffff",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ } ",
|
"$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ } ",
|
||||||
"$ 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 } } } } } } } } ",
|
"$ 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 } } } } } } } } ",
|
||||||
|
|||||||
@@ -232,6 +232,10 @@
|
|||||||
WindowRelaunchKey = None;
|
WindowRelaunchKey = None;
|
||||||
ScreenSwitchKey = None;
|
ScreenSwitchKey = None;
|
||||||
RunKey = None;
|
RunKey = None;
|
||||||
|
ExitKey = None;
|
||||||
|
ScreenCaptureKey = Print;
|
||||||
|
WindowCaptureKey = None;
|
||||||
|
PartialCaptureKey = None;
|
||||||
NormalCursor = (builtin, left_ptr);
|
NormalCursor = (builtin, left_ptr);
|
||||||
ArrowCursor = (builtin, top_left_arrow);
|
ArrowCursor = (builtin, top_left_arrow);
|
||||||
MoveCursor = (builtin, fleur);
|
MoveCursor = (builtin, fleur);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ static char *magick[] = {
|
|||||||
". c #ededee",
|
". c #ededee",
|
||||||
"X c #e7e7e7",
|
"X c #e7e7e7",
|
||||||
"o c #e2e2e2",
|
"o c #e2e2e2",
|
||||||
"O c gray87",
|
"O c #dedede",
|
||||||
"+ c gray85",
|
"+ c #d9d9d9",
|
||||||
"@ c gray76",
|
"@ c #c2c2c2",
|
||||||
"# c #010101",
|
"# c #010101",
|
||||||
"$ c #4d505a",
|
"$ c #4d505a",
|
||||||
"% c #e0e0e6",
|
"% c #e0e0e6",
|
||||||
|
|||||||
+19
-7
@@ -71,16 +71,16 @@ dnl 6. If any interfaces have been removed or changed since the last
|
|||||||
dnl public release, then set age to 0.
|
dnl public release, then set age to 0.
|
||||||
dnl
|
dnl
|
||||||
dnl libwraster
|
dnl libwraster
|
||||||
WRASTER_CURRENT=6
|
WRASTER_CURRENT=7
|
||||||
WRASTER_REVISION=0
|
WRASTER_REVISION=0
|
||||||
WRASTER_AGE=0
|
WRASTER_AGE=1
|
||||||
WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
|
WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
|
||||||
AC_SUBST(WRASTER_VERSION)
|
AC_SUBST(WRASTER_VERSION)
|
||||||
dnl
|
dnl
|
||||||
dnl libWINGs
|
dnl libWINGs
|
||||||
WINGS_CURRENT=4
|
WINGS_CURRENT=5
|
||||||
WINGS_REVISION=0
|
WINGS_REVISION=0
|
||||||
WINGS_AGE=1
|
WINGS_AGE=2
|
||||||
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
|
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
|
||||||
AC_SUBST(WINGS_VERSION)
|
AC_SUBST(WINGS_VERSION)
|
||||||
dnl
|
dnl
|
||||||
@@ -270,8 +270,8 @@ supported_gfx=""
|
|||||||
dnl Platform-specific Makefile setup
|
dnl Platform-specific Makefile setup
|
||||||
dnl ================================
|
dnl ================================
|
||||||
AS_CASE(["$host"],
|
AS_CASE(["$host"],
|
||||||
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
|
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700"],
|
||||||
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
|
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -DFREEBSD"],
|
||||||
[*-*-netbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
|
[*-*-netbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
|
||||||
[*-*-openbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
|
[*-*-openbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
|
||||||
[*-*-dragonfly*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
|
[*-*-dragonfly*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
|
||||||
@@ -387,7 +387,7 @@ AC_FUNC_MEMCMP
|
|||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
WM_FUNC_SECURE_GETENV
|
WM_FUNC_SECURE_GETENV
|
||||||
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
|
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
|
||||||
setsid mallinfo mkstemp sysconf)
|
setsid mallinfo2 mkstemp sysconf)
|
||||||
AC_SEARCH_LIBS([strerror], [cposix])
|
AC_SEARCH_LIBS([strerror], [cposix])
|
||||||
|
|
||||||
dnl nanosleep is generally available in standard libc, although not always the
|
dnl nanosleep is generally available in standard libc, although not always the
|
||||||
@@ -580,6 +580,18 @@ AS_IF([test "x$enable_wmreplace" = "xyes"],
|
|||||||
[define to support ICCCM protocol for window manager replacement])
|
[define to support ICCCM protocol for window manager replacement])
|
||||||
supported_xext="$supported_xext WMReplace"])
|
supported_xext="$supported_xext WMReplace"])
|
||||||
|
|
||||||
|
dnl XRes support
|
||||||
|
dnl ==============
|
||||||
|
m4_divert_push([INIT_PREPARE])dnl
|
||||||
|
AC_ARG_ENABLE([res],
|
||||||
|
[AS_HELP_STRING([--disable-res], [disable resource window extension support])],
|
||||||
|
[AS_CASE(["$enableval"],
|
||||||
|
[yes|no], [],
|
||||||
|
[AC_MSG_ERROR([bad value $enableval for --enable-res]) ]) ],
|
||||||
|
[enable_res=auto])
|
||||||
|
m4_divert_pop([INIT_PREPARE])dnl
|
||||||
|
|
||||||
|
WM_XEXT_CHECK_XRES
|
||||||
|
|
||||||
dnl XShape support
|
dnl XShape support
|
||||||
dnl ==============
|
dnl ==============
|
||||||
|
|||||||
Vendored
+4
@@ -551,6 +551,10 @@ Disable use of the @emph{MIT shared memory} extension.
|
|||||||
This will slow down texture generation a little bit, but in some cases it seems to be necessary due
|
This will slow down texture generation a little bit, but in some cases it seems to be necessary due
|
||||||
to a bug that manifests as messed icons and textures.
|
to a bug that manifests as messed icons and textures.
|
||||||
|
|
||||||
|
@item --disable-res
|
||||||
|
Disables support for @emph{XRes} resource window extension support.
|
||||||
|
Which is used to find the underlying processes (and PIDs) displaying the windows.
|
||||||
|
|
||||||
@item --disable-shape
|
@item --disable-shape
|
||||||
Disables support for @emph{shaped} windows (for @command{oclock}, @command{xeyes}, etc.).
|
Disables support for @emph{shaped} windows (for @command{oclock}, @command{xeyes}, etc.).
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,33 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
# WM_XEXT_CHECK_XRES
|
||||||
|
# --------------------
|
||||||
|
#
|
||||||
|
# Check for the X Resource Window extension
|
||||||
|
# The check depends on variable 'enable_xshape' being either:
|
||||||
|
# yes - detect, fail if not found
|
||||||
|
# no - do not detect, disable support
|
||||||
|
# auto - detect, disable if not found
|
||||||
|
#
|
||||||
|
# When found, append appropriate stuff in XLIBS, and append info to
|
||||||
|
# the variable 'supported_xext'
|
||||||
|
# When not found, append info to variable 'unsupported'
|
||||||
|
AC_DEFUN_ONCE([WM_XEXT_CHECK_XRES],
|
||||||
|
[WM_LIB_CHECK([XRes], [-lXRes], [XResQueryClientIds], [$XLIBS],
|
||||||
|
[wm_save_CFLAGS="$CFLAGS"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
|
||||||
|
@%:@include <X11/extensions/XRes.h>
|
||||||
|
], [dnl
|
||||||
|
|
||||||
|
XResQueryClientIds(NULL, 0, NULL, NULL, NULL);])]
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([found $CACHEVAR but cannot compile using XRes header])])
|
||||||
|
CFLAGS="$wm_save_CFLAGS"],
|
||||||
|
[supported_xext], [XLIBS], [enable_res], [-])dnl
|
||||||
|
]) dnl AC_DEFUN
|
||||||
|
|
||||||
|
|
||||||
# WM_XEXT_CHECK_XSHAPE
|
# WM_XEXT_CHECK_XSHAPE
|
||||||
# --------------------
|
# --------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ typedef enum {
|
|||||||
WCUR_QUESTION,
|
WCUR_QUESTION,
|
||||||
WCUR_TEXT,
|
WCUR_TEXT,
|
||||||
WCUR_SELECT,
|
WCUR_SELECT,
|
||||||
|
WCUR_CAPTURE,
|
||||||
WCUR_ROOT,
|
WCUR_ROOT,
|
||||||
WCUR_EMPTY,
|
WCUR_EMPTY,
|
||||||
|
|
||||||
|
|||||||
@@ -912,6 +912,54 @@ void wUnmaximizeWindow(WWindow *wwin)
|
|||||||
WMPostNotificationName(WMNChangedState, wwin, "maximize");
|
WMPostNotificationName(WMNChangedState, wwin, "maximize");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
void wFullscreenMonitorsWindow(WWindow *wwin, unsigned long top, unsigned long bottom,
|
||||||
|
unsigned long left, unsigned long right)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
long monitor;
|
||||||
|
WMRect rect1, rect2;
|
||||||
|
|
||||||
|
if ((int)top < wwin->screen_ptr->xine_info.count &&
|
||||||
|
(int)bottom < wwin->screen_ptr->xine_info.count &&
|
||||||
|
(int)left < wwin->screen_ptr->xine_info.count &&
|
||||||
|
(int)right < wwin->screen_ptr->xine_info.count) {
|
||||||
|
wwin->flags.fullscreen_monitors[0] = top;
|
||||||
|
wwin->flags.fullscreen_monitors[1] = bottom;
|
||||||
|
wwin->flags.fullscreen_monitors[2] = left;
|
||||||
|
wwin->flags.fullscreen_monitors[3] = right;
|
||||||
|
} else {
|
||||||
|
wwin->flags.fullscreen_monitors[0] = -1;
|
||||||
|
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;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
monitor = wwin->flags.fullscreen_monitors[i];
|
||||||
|
rect1 = wwin->screen_ptr->xine_info.screens[monitor];
|
||||||
|
|
||||||
|
for (i = 1; i <= 3; i++) {
|
||||||
|
monitor = wwin->flags.fullscreen_monitors[i];
|
||||||
|
rect2 = wwin->screen_ptr->xine_info.screens[monitor];
|
||||||
|
wGetRectUnion(&rect1, &rect2, &rect1);
|
||||||
|
}
|
||||||
|
wWindowConfigure(wwin, rect1.pos.x, rect1.pos.y, rect1.size.width, rect1.size.height);
|
||||||
|
|
||||||
|
wwin->screen_ptr->bfs_focused_window = wwin->screen_ptr->focused_window;
|
||||||
|
wSetFocusTo(wwin->screen_ptr, wwin);
|
||||||
|
|
||||||
|
WMPostNotificationName(WMNChangedState, wwin, "fullscreen");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void wFullscreenWindow(WWindow *wwin)
|
void wFullscreenWindow(WWindow *wwin)
|
||||||
{
|
{
|
||||||
int head;
|
int head;
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll);
|
|||||||
|
|
||||||
void wMakeWindowVisible(WWindow *wwin);
|
void wMakeWindowVisible(WWindow *wwin);
|
||||||
|
|
||||||
|
void wFullscreenMonitorsWindow(WWindow *wwin, unsigned long top, unsigned long bottom,
|
||||||
|
unsigned long left, unsigned long right);
|
||||||
|
|
||||||
void wFullscreenWindow(WWindow *wwin);
|
void wFullscreenWindow(WWindow *wwin);
|
||||||
void wUnfullscreenWindow(WWindow *wwin);
|
void wUnfullscreenWindow(WWindow *wwin);
|
||||||
|
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
|
|||||||
if (nheight != wwin->old_geometry.height)
|
if (nheight != wwin->old_geometry.height)
|
||||||
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
|
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
|
||||||
|
|
||||||
|
wWindowConstrainSize(wwin, (unsigned int *)&nwidth, (unsigned int *)&nheight);
|
||||||
wWindowConfigure(wwin, nx, ny, nwidth, nheight);
|
wWindowConfigure(wwin, nx, ny, nwidth, nheight);
|
||||||
wwin->old_geometry.x = nx;
|
wwin->old_geometry.x = nx;
|
||||||
wwin->old_geometry.y = ny;
|
wwin->old_geometry.y = ny;
|
||||||
|
|||||||
+11
-1
@@ -154,7 +154,7 @@ static WDECallbackUpdate setModifierKeyLabels;
|
|||||||
|
|
||||||
static WDECallbackConvert getCursor;
|
static WDECallbackConvert getCursor;
|
||||||
static WDECallbackUpdate setCursor;
|
static WDECallbackUpdate setCursor;
|
||||||
static WDECallbackUpdate updateDock ;
|
static WDECallbackUpdate updateDock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tables to convert strings to enumeration values.
|
* Tables to convert strings to enumeration values.
|
||||||
@@ -788,6 +788,14 @@ WDefaultEntry optionList[] = {
|
|||||||
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
{"RunKey", "None", (void *)WKBD_RUN,
|
{"RunKey", "None", (void *)WKBD_RUN,
|
||||||
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
|
{"ExitKey", "None", (void *)WKBD_EXIT,
|
||||||
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
|
{"ScreenCaptureKey", "None", (void *)WKBD_PRINTS,
|
||||||
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
|
{"WindowCaptureKey", "None", (void *)WKBD_PRINTW,
|
||||||
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
|
{"PartialCaptureKey", "None", (void *)WKBD_PRINTP,
|
||||||
|
NULL, getKeybind, setKeyGrab, NULL, NULL},
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
{"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE,
|
{"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE,
|
||||||
@@ -824,6 +832,8 @@ WDefaultEntry optionList[] = {
|
|||||||
NULL, getCursor, setCursor, NULL, NULL},
|
NULL, getCursor, setCursor, NULL, NULL},
|
||||||
{"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT,
|
{"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT,
|
||||||
NULL, getCursor, setCursor, NULL, NULL},
|
NULL, getCursor, setCursor, NULL, NULL},
|
||||||
|
{"CaptureCursor", "(builtin, crosshair)", (void *)WCUR_CAPTURE,
|
||||||
|
NULL, getCursor, setCursor, NULL, NULL},
|
||||||
{"DialogHistoryLines", "500", NULL,
|
{"DialogHistoryLines", "500", NULL,
|
||||||
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
|
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
|
||||||
{"CycleActiveHeadOnly", "NO", NULL,
|
{"CycleActiveHeadOnly", "NO", NULL,
|
||||||
|
|||||||
+108
-19
@@ -36,6 +36,8 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
#ifdef HAVE_MALLOC_H
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -1101,14 +1103,16 @@ Bool wIconChooserDialog(WScreen *scr, char **file, const char *instance, const c
|
|||||||
} else {
|
} else {
|
||||||
defaultPath = FindImage(wPreferences.icon_path, *file);
|
defaultPath = FindImage(wPreferences.icon_path, *file);
|
||||||
wantedPath = WMGetTextFieldText(panel->fileField);
|
wantedPath = WMGetTextFieldText(panel->fileField);
|
||||||
/* if the file is not the default, use full path */
|
if (defaultPath) {
|
||||||
if (strcmp(wantedPath, defaultPath) != 0) {
|
/* if the file is not the default, use full path */
|
||||||
*file = wantedPath;
|
if (strcmp(wantedPath, defaultPath) != 0) {
|
||||||
} else {
|
*file = wstrdup(wantedPath);
|
||||||
*file = wstrdup(*file);
|
} else {
|
||||||
wfree(wantedPath);
|
*file = wstrdup(*file);
|
||||||
|
}
|
||||||
|
wfree(defaultPath);
|
||||||
}
|
}
|
||||||
wfree(defaultPath);
|
wfree(wantedPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
@@ -1153,7 +1157,7 @@ typedef struct {
|
|||||||
#define COPYRIGHT_TEXT \
|
#define COPYRIGHT_TEXT \
|
||||||
"Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
|
"Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
|
||||||
"Copyright \xc2\xa9 1998-2006 Dan Pascu\n"\
|
"Copyright \xc2\xa9 1998-2006 Dan Pascu\n"\
|
||||||
"Copyright \xc2\xa9 2013-2020 Window Maker Developers Team"
|
"Copyright \xc2\xa9 2013-%hu Window Maker Developers Team"
|
||||||
|
|
||||||
static InfoPanel *infoPanel = NULL;
|
static InfoPanel *infoPanel = NULL;
|
||||||
|
|
||||||
@@ -1171,6 +1175,57 @@ static void destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
|
|||||||
infoPanel = NULL;
|
infoPanel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *getPrettyOSName(void)
|
||||||
|
{
|
||||||
|
char line[200];
|
||||||
|
char *token;
|
||||||
|
char *posn = NULL;
|
||||||
|
const char s[2] = "=";
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fp = fopen("/etc/os-release", "r");
|
||||||
|
if (!fp) {
|
||||||
|
fp = fopen("/usr/lib/os-release", "r");
|
||||||
|
if (!fp) {
|
||||||
|
wwarning(_("no os-release file on the system"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
if (strncmp(line, "PRETTY_NAME", strlen("PRETTY_NAME")) == 0) {
|
||||||
|
line[strcspn(line, "\r\n")] = 0;
|
||||||
|
token = strtok(line, s);
|
||||||
|
if (token) {
|
||||||
|
//get straight to the second part of the line
|
||||||
|
token = strtok(NULL, s);
|
||||||
|
if (token) {
|
||||||
|
//removing potential quotes
|
||||||
|
char *dst = token;
|
||||||
|
char *src = token;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
while ((c = *src++) != '\0') {
|
||||||
|
if (c == '\\') {
|
||||||
|
*dst++ = c;
|
||||||
|
if ((c = *src++) == '\0')
|
||||||
|
break;
|
||||||
|
*dst++ = c;
|
||||||
|
} else if (c != '"' && c != '\'')
|
||||||
|
*dst++ = c;
|
||||||
|
}
|
||||||
|
*dst = '\0';
|
||||||
|
posn = wmalloc(strlen(token) + 1);
|
||||||
|
strcpy(posn, token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
return posn;
|
||||||
|
}
|
||||||
|
|
||||||
void wShowInfoPanel(WScreen *scr)
|
void wShowInfoPanel(WScreen *scr)
|
||||||
{
|
{
|
||||||
InfoPanel *panel;
|
InfoPanel *panel;
|
||||||
@@ -1194,6 +1249,17 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
};
|
};
|
||||||
int wmScaleWidth, wmScaleHeight;
|
int wmScaleWidth, wmScaleHeight;
|
||||||
int pwidth, pheight;
|
int pwidth, pheight;
|
||||||
|
int current_year = 2020;
|
||||||
|
time_t s;
|
||||||
|
struct tm *current_time;
|
||||||
|
struct utsname uts;
|
||||||
|
|
||||||
|
s = time(NULL);
|
||||||
|
if (s) {
|
||||||
|
current_time = localtime(&s);
|
||||||
|
if (current_time->tm_year > (current_year - 1900))
|
||||||
|
current_year = current_time->tm_year + 1900;
|
||||||
|
}
|
||||||
|
|
||||||
if (infoPanel) {
|
if (infoPanel) {
|
||||||
if (infoPanel->scr == scr) {
|
if (infoPanel->scr == scr) {
|
||||||
@@ -1209,8 +1275,12 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
|
|
||||||
panel->win = WMCreateWindow(scr->wmscreen, "info");
|
panel->win = WMCreateWindow(scr->wmscreen, "info");
|
||||||
WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight);
|
WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight);
|
||||||
|
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
|
||||||
|
pwidth = WMScaleX(412);
|
||||||
|
#else
|
||||||
pwidth = WMScaleX(382);
|
pwidth = WMScaleX(382);
|
||||||
pheight = WMScaleY(250);
|
#endif
|
||||||
|
pheight = WMScaleY(270);
|
||||||
WMResizeWidget(panel->win, pwidth, pheight);
|
WMResizeWidget(panel->win, pwidth, pheight);
|
||||||
|
|
||||||
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL);
|
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL);
|
||||||
@@ -1274,9 +1344,11 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
|
|
||||||
panel->copyrL = WMCreateLabel(panel->win);
|
panel->copyrL = WMCreateLabel(panel->win);
|
||||||
WMResizeWidget(panel->copyrL, WMScaleX(360), WMScaleY(60));
|
WMResizeWidget(panel->copyrL, WMScaleX(360), WMScaleY(60));
|
||||||
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(190));
|
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(210));
|
||||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
|
||||||
|
snprintf(buffer, sizeof(buffer), COPYRIGHT_TEXT, current_year);
|
||||||
|
WMSetLabelText(panel->copyrL, buffer);
|
||||||
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
||||||
if (font) {
|
if (font) {
|
||||||
WMSetLabelFont(panel->copyrL, font);
|
WMSetLabelFont(panel->copyrL, font);
|
||||||
@@ -1285,9 +1357,19 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strbuf = NULL;
|
strbuf = NULL;
|
||||||
|
if (uname(&uts) != -1) {
|
||||||
|
char *posn = getPrettyOSName();
|
||||||
|
if (posn) {
|
||||||
|
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), posn, uts.machine);
|
||||||
|
free(posn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), uts.sysname, uts.machine);
|
||||||
|
strbuf = wstrappend(strbuf, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), _("Using visual 0x%x: %s %ibpp "),
|
snprintf(buffer, sizeof(buffer), _("Using visual 0x%x: %s %ibpp "),
|
||||||
(unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth);
|
(unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth);
|
||||||
|
|
||||||
strbuf = wstrappend(strbuf, buffer);
|
strbuf = wstrappend(strbuf, buffer);
|
||||||
|
|
||||||
switch (scr->w_depth) {
|
switch (scr->w_depth) {
|
||||||
@@ -1307,14 +1389,14 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2)
|
||||||
{
|
{
|
||||||
struct mallinfo ma = mallinfo();
|
struct mallinfo2 ma = mallinfo2();
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
_("Total memory allocated: %i kB (in use: %i kB, %d free chunks).\n"),
|
_("Total memory allocated: %lu kB (in use: %lu kB, %lu free chunks)\n"),
|
||||||
#else
|
#else
|
||||||
_("Total memory allocated: %i kB (in use: %i kB).\n"),
|
_("Total memory allocated: %lu kB (in use: %lu kB)\n"),
|
||||||
#endif
|
#endif
|
||||||
(ma.arena + ma.hblkhd) / 1024,
|
(ma.arena + ma.hblkhd) / 1024,
|
||||||
(ma.uordblks + ma.hblkhd) / 1024
|
(ma.uordblks + ma.hblkhd) / 1024
|
||||||
@@ -1353,6 +1435,10 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
strbuf = wstrappend(strbuf, ", XDnD");
|
strbuf = wstrappend(strbuf, ", XDnD");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_XRES
|
||||||
|
strbuf = wstrappend(strbuf, ", XRes");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MAGICK
|
#ifdef USE_MAGICK
|
||||||
strbuf = wstrappend(strbuf, ", ImageMagick");
|
strbuf = wstrappend(strbuf, ", ImageMagick");
|
||||||
#endif
|
#endif
|
||||||
@@ -1365,7 +1451,7 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
strbuf = wstrappend(strbuf, _("Xinerama: "));
|
strbuf = wstrappend(strbuf, _("Xinerama: "));
|
||||||
{
|
{
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found."), scr->xine_info.count);
|
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found"), scr->xine_info.count);
|
||||||
strbuf = wstrappend(strbuf, tmp);
|
strbuf = wstrappend(strbuf, tmp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1377,11 +1463,14 @@ void wShowInfoPanel(WScreen *scr)
|
|||||||
strbuf = wstrappend(strbuf, _("supported"));
|
strbuf = wstrappend(strbuf, _("supported"));
|
||||||
else
|
else
|
||||||
strbuf = wstrappend(strbuf, _("unsupported"));
|
strbuf = wstrappend(strbuf, _("unsupported"));
|
||||||
strbuf = wstrappend(strbuf, ".");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
panel->infoL = WMCreateLabel(panel->win);
|
panel->infoL = WMCreateLabel(panel->win);
|
||||||
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(80));
|
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
|
||||||
|
WMResizeWidget(panel->infoL, WMScaleX(380), WMScaleY(100));
|
||||||
|
#else
|
||||||
|
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(100));
|
||||||
|
#endif
|
||||||
WMMoveWidget(panel->infoL, WMScaleX(15), WMScaleY(115));
|
WMMoveWidget(panel->infoL, WMScaleX(15), WMScaleY(115));
|
||||||
WMSetLabelText(panel->infoL, strbuf);
|
WMSetLabelText(panel->infoL, strbuf);
|
||||||
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
||||||
|
|||||||
+22
-11
@@ -1852,21 +1852,32 @@ static void handleKeyPress(XEvent * event)
|
|||||||
|
|
||||||
case WKBD_RUN:
|
case WKBD_RUN:
|
||||||
{
|
{
|
||||||
char *cmdline;
|
ExecuteInputCommand(scr, _("exec %A(Run, Type command:)"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
cmdline = ExpandOptions(scr, _("exec %A(Run,Type command to run:)"));
|
case WKBD_EXIT:
|
||||||
|
{
|
||||||
|
/* quick mode is not allowed to prevent inadvertently call */
|
||||||
|
ExecuteExitCommand(scr, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmdline) {
|
case WKBD_PRINTS:
|
||||||
XGrabPointer(dpy, scr->root_win, True, 0,
|
{
|
||||||
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
|
ScreenCapture(scr, PRINT_SCREEN);
|
||||||
XSync(dpy, False);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ExecuteShellCommand(scr, cmdline);
|
case WKBD_PRINTW:
|
||||||
wfree(cmdline);
|
{
|
||||||
|
ScreenCapture(scr, PRINT_WINDOW);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
case WKBD_PRINTP:
|
||||||
XSync(dpy, False);
|
{
|
||||||
}
|
ScreenCapture(scr, PRINT_PARTIAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -422,7 +422,7 @@ static char *get_icon_cache_path(void)
|
|||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
char *path;
|
char *path;
|
||||||
int len, ret;
|
int ret;
|
||||||
|
|
||||||
prefix = wuserdatapath();
|
prefix = wuserdatapath();
|
||||||
path = wstrconcat(prefix, CACHE_ICON_PATH "/");
|
path = wstrconcat(prefix, CACHE_ICON_PATH "/");
|
||||||
|
|||||||
@@ -145,6 +145,18 @@ enum {
|
|||||||
/* open "run" dialog */
|
/* open "run" dialog */
|
||||||
WKBD_RUN,
|
WKBD_RUN,
|
||||||
|
|
||||||
|
/* open "exit" dialog */
|
||||||
|
WKBD_EXIT,
|
||||||
|
|
||||||
|
/* screen print */
|
||||||
|
WKBD_PRINTS,
|
||||||
|
|
||||||
|
/* window print */
|
||||||
|
WKBD_PRINTW,
|
||||||
|
|
||||||
|
/* partial print */
|
||||||
|
WKBD_PRINTP,
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
WKBD_TOGGLE,
|
WKBD_TOGGLE,
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+15
-5
@@ -56,6 +56,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
@@ -354,11 +355,19 @@ Bool RelaunchWindow(WWindow *wwin)
|
|||||||
|
|
||||||
char **argv;
|
char **argv;
|
||||||
int argc;
|
int argc;
|
||||||
|
char *command = NULL;
|
||||||
|
|
||||||
if (! XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc == 0 || argv == NULL) {
|
command = GetCommandForWindow(wwin->client_win);
|
||||||
|
if (!command) {
|
||||||
|
#ifdef USE_XRES
|
||||||
|
werror("cannot relaunch the application because no associated process found");
|
||||||
|
#else
|
||||||
werror("cannot relaunch the application because no WM_COMMAND property is set");
|
werror("cannot relaunch the application because no WM_COMMAND property is set");
|
||||||
|
#endif
|
||||||
return False;
|
return False;
|
||||||
}
|
} else
|
||||||
|
wtokensplit(command, &argv, &argc);
|
||||||
|
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
|
|
||||||
@@ -384,18 +393,19 @@ Bool RelaunchWindow(WWindow *wwin)
|
|||||||
} else if (pid < 0) {
|
} else if (pid < 0) {
|
||||||
werror("cannot fork a new process");
|
werror("cannot fork a new process");
|
||||||
|
|
||||||
XFreeStringList(argv);
|
wtokenfree(argv, argc);
|
||||||
|
wfree(command);
|
||||||
return False;
|
return False;
|
||||||
} else {
|
} else {
|
||||||
_tuple *data = wmalloc(sizeof(_tuple));
|
_tuple *data = wmalloc(sizeof(_tuple));
|
||||||
|
|
||||||
data->scr = wwin->screen_ptr;
|
data->scr = wwin->screen_ptr;
|
||||||
data->command = wtokenjoin(argv, argc);
|
data->command = command;
|
||||||
|
|
||||||
/* not actually a shell command */
|
/* not actually a shell command */
|
||||||
wAddDeathHandler(pid, shellCommandHandler, data);
|
wAddDeathHandler(pid, shellCommandHandler, data);
|
||||||
|
|
||||||
XFreeStringList(argv);
|
wtokenfree(argv, argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
|
|||||||
+1
-1
@@ -2440,7 +2440,7 @@ static int restoreMenu(WScreen *scr, WMPropList *menu)
|
|||||||
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, const char *path)
|
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, const char *path)
|
||||||
{
|
{
|
||||||
WMPropList *key, *entry;
|
WMPropList *key, *entry;
|
||||||
char buffer[512];
|
char buffer[1024];
|
||||||
int i, x, y, res;
|
int i, x, y, res;
|
||||||
Bool lowered;
|
Bool lowered;
|
||||||
|
|
||||||
|
|||||||
+62
-1
@@ -38,6 +38,7 @@
|
|||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
#include <WINGs/WINGsP.h>
|
||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
#include "xmodifier.h"
|
#include "xmodifier.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "shutdown.h"
|
||||||
|
|
||||||
|
|
||||||
#define ICON_SIZE wPreferences.icon_size
|
#define ICON_SIZE wPreferences.icon_size
|
||||||
@@ -679,6 +681,64 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExecuteExitCommand(WScreen *scr, long quickmode)
|
||||||
|
{
|
||||||
|
static int inside = 0;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
/* prevent reentrant calls */
|
||||||
|
if (inside)
|
||||||
|
return;
|
||||||
|
inside = 1;
|
||||||
|
|
||||||
|
#define R_CANCEL 0
|
||||||
|
#define R_EXIT 1
|
||||||
|
|
||||||
|
result = R_CANCEL;
|
||||||
|
|
||||||
|
if (quickmode == M_QUICK) {
|
||||||
|
result = R_EXIT;
|
||||||
|
} else {
|
||||||
|
int r, oldSaveSessionFlag;
|
||||||
|
|
||||||
|
oldSaveSessionFlag = wPreferences.save_session_on_exit;
|
||||||
|
r = wExitDialog(scr, _("Exit"),
|
||||||
|
_("Are you sure you want to quit Window Maker?"), _("Exit"), _("Cancel"), NULL);
|
||||||
|
|
||||||
|
if (r == WAPRDefault) {
|
||||||
|
result = R_EXIT;
|
||||||
|
} else if (r == WAPRAlternate) {
|
||||||
|
/* Don't modify the "save session on exit" flag if the
|
||||||
|
* user canceled the operation. */
|
||||||
|
wPreferences.save_session_on_exit = oldSaveSessionFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result == R_EXIT)
|
||||||
|
Shutdown(WSExitMode);
|
||||||
|
|
||||||
|
#undef R_EXIT
|
||||||
|
#undef R_CANCEL
|
||||||
|
inside = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecuteInputCommand(WScreen *scr, const char *cmdline)
|
||||||
|
{
|
||||||
|
char *cmd;
|
||||||
|
|
||||||
|
cmd = ExpandOptions(scr, cmdline);
|
||||||
|
if (cmd) {
|
||||||
|
XGrabPointer(dpy, scr->root_win, True, 0,
|
||||||
|
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
|
||||||
|
XSync(dpy, False);
|
||||||
|
|
||||||
|
ExecuteShellCommand(scr, cmd);
|
||||||
|
wfree(cmd);
|
||||||
|
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
XSync(dpy, False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where)
|
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
@@ -739,6 +799,7 @@ char *GetShortcutString(const char *shortcut)
|
|||||||
*k = 0;
|
*k = 0;
|
||||||
mod = wXModifierFromKey(text);
|
mod = wXModifierFromKey(text);
|
||||||
if (mod < 0) {
|
if (mod < 0) {
|
||||||
|
wfree(buffer);
|
||||||
return wstrdup("bug");
|
return wstrdup("bug");
|
||||||
}
|
}
|
||||||
lbl = wXModifierToShortcutLabel(mod);
|
lbl = wXModifierToShortcutLabel(mod);
|
||||||
@@ -781,7 +842,7 @@ char *GetShortcutKey(WShortKey key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
key_name = XKeysymToString(XkbKeycodeToKeysym(dpy, key.keycode, 0, 0));
|
key_name = XKeysymToString(W_KeycodeToKeysym(dpy, key.keycode, 0));
|
||||||
if (!key_name)
|
if (!key_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "keybind.h"
|
#include "keybind.h"
|
||||||
#include "appicon.h"
|
#include "appicon.h"
|
||||||
|
|
||||||
|
#define M_QUICK 1
|
||||||
|
|
||||||
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);
|
||||||
Bool UpdateDomainFile(WDDomain * domain);
|
Bool UpdateDomainFile(WDDomain * domain);
|
||||||
@@ -45,6 +47,8 @@ void SendHelperMessage(WScreen *scr, char type, int workspace, const char *msg);
|
|||||||
char *ShrinkString(WMFont *font, const char *string, int width);
|
char *ShrinkString(WMFont *font, const char *string, int width);
|
||||||
char *FindImage(const char *paths, const char *file);
|
char *FindImage(const char *paths, const char *file);
|
||||||
char *ExpandOptions(WScreen * scr, const char *cmdline);
|
char *ExpandOptions(WScreen * scr, const char *cmdline);
|
||||||
|
void ExecuteInputCommand(WScreen *scr, const char *cmdline);
|
||||||
|
void ExecuteExitCommand(WScreen *scr, long quickmode);
|
||||||
char *GetShortcutString(const char *text);
|
char *GetShortcutString(const char *text);
|
||||||
char *GetShortcutKey(WShortKey key);
|
char *GetShortcutKey(WShortKey key);
|
||||||
char *EscapeWM_CLASS(const char *name, const char *class);
|
char *EscapeWM_CLASS(const char *name, const char *class);
|
||||||
|
|||||||
+2
-53
@@ -142,66 +142,17 @@ static Shortcut *shortcutList = NULL;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define M_QUICK 1
|
|
||||||
|
|
||||||
/* menu commands */
|
/* menu commands */
|
||||||
|
|
||||||
static void execCommand(WMenu * menu, WMenuEntry * entry)
|
static void execCommand(WMenu * menu, WMenuEntry * entry)
|
||||||
{
|
{
|
||||||
char *cmdline;
|
ExecuteInputCommand(menu->frame->screen_ptr, (char *)entry->clientdata);
|
||||||
|
|
||||||
cmdline = ExpandOptions(menu->frame->screen_ptr, (char *)entry->clientdata);
|
|
||||||
|
|
||||||
XGrabPointer(dpy, menu->frame->screen_ptr->root_win, True, 0,
|
|
||||||
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
|
|
||||||
XSync(dpy, 0);
|
|
||||||
|
|
||||||
if (cmdline) {
|
|
||||||
ExecuteShellCommand(menu->frame->screen_ptr, cmdline);
|
|
||||||
wfree(cmdline);
|
|
||||||
}
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
|
||||||
XSync(dpy, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exitCommand(WMenu * menu, WMenuEntry * entry)
|
static void exitCommand(WMenu * menu, WMenuEntry * entry)
|
||||||
{
|
{
|
||||||
static int inside = 0;
|
ExecuteExitCommand(menu->frame->screen_ptr, (long)entry->clientdata);
|
||||||
int result;
|
|
||||||
|
|
||||||
/* prevent reentrant calls */
|
|
||||||
if (inside)
|
|
||||||
return;
|
|
||||||
inside = 1;
|
|
||||||
|
|
||||||
#define R_CANCEL 0
|
|
||||||
#define R_EXIT 1
|
|
||||||
|
|
||||||
result = R_CANCEL;
|
|
||||||
|
|
||||||
if ((long)entry->clientdata == M_QUICK) {
|
|
||||||
result = R_EXIT;
|
|
||||||
} else {
|
|
||||||
int r, oldSaveSessionFlag;
|
|
||||||
|
|
||||||
oldSaveSessionFlag = wPreferences.save_session_on_exit;
|
|
||||||
r = wExitDialog(menu->frame->screen_ptr, _("Exit"),
|
|
||||||
_("Exit window manager?"), _("Exit"), _("Cancel"), NULL);
|
|
||||||
|
|
||||||
if (r == WAPRDefault) {
|
|
||||||
result = R_EXIT;
|
|
||||||
} else if (r == WAPRAlternate) {
|
|
||||||
/* Don't modify the "save session on exit" flag if the
|
|
||||||
* user canceled the operation. */
|
|
||||||
wPreferences.save_session_on_exit = oldSaveSessionFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result == R_EXIT)
|
|
||||||
Shutdown(WSExitMode);
|
|
||||||
|
|
||||||
#undef R_EXIT
|
|
||||||
#undef R_CANCEL
|
|
||||||
inside = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shutdownCommand(WMenu * menu, WMenuEntry * entry)
|
static void shutdownCommand(WMenu * menu, WMenuEntry * entry)
|
||||||
@@ -1087,8 +1038,6 @@ static WMenu *readMenu(WScreen *scr, const char *flat_file, FILE *file)
|
|||||||
freeline(title, command, params, shortcut);
|
freeline(title, command, params, shortcut);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeline(title, command, params, shortcut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WMenuParserDelete(parser);
|
WMenuParserDelete(parser);
|
||||||
|
|||||||
+251
-1
@@ -24,6 +24,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
@@ -54,10 +58,12 @@
|
|||||||
#include "geomview.h"
|
#include "geomview.h"
|
||||||
#include "wmspec.h"
|
#include "wmspec.h"
|
||||||
#include "rootmenu.h"
|
#include "rootmenu.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#include "xinerama.h"
|
#include "xinerama.h"
|
||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
#include <WINGs/WINGsP.h>
|
||||||
|
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
|
|
||||||
@@ -593,6 +599,7 @@ static void createInternalWindows(WScreen * scr)
|
|||||||
scr->workspace_name =
|
scr->workspace_name =
|
||||||
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, scr->w_depth,
|
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, scr->w_depth,
|
||||||
CopyFromParent, scr->w_visual, vmask, &attribs);
|
CopyFromParent, scr->w_visual, vmask, &attribs);
|
||||||
|
scr->mini_screenshot_timeout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -617,7 +624,7 @@ WScreen *wScreenInit(int screen_number)
|
|||||||
{
|
{
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
XIconSize icon_size[1];
|
XIconSize icon_size[1];
|
||||||
RContextAttributes rattr;
|
RContextAttributes rattr = {};
|
||||||
long event_mask;
|
long event_mask;
|
||||||
XErrorHandler oldHandler;
|
XErrorHandler oldHandler;
|
||||||
int i;
|
int i;
|
||||||
@@ -1126,3 +1133,246 @@ int wScreenKeepInside(WScreen * scr, int *x, int *y, int width, int height)
|
|||||||
|
|
||||||
return moved;
|
return moved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static XImage *imageCaptureArea(WScreen *scr)
|
||||||
|
{
|
||||||
|
XEvent event;
|
||||||
|
int quit = 0;
|
||||||
|
int xp = -1;
|
||||||
|
int yp = -1;
|
||||||
|
int w = 0, h = 0;
|
||||||
|
int x = xp, y = yp;
|
||||||
|
|
||||||
|
if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask
|
||||||
|
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
|
||||||
|
GrabModeAsync, None, wPreferences.cursor[WCUR_CAPTURE], CurrentTime) != Success) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
XGrabServer(dpy);
|
||||||
|
|
||||||
|
while (!quit) {
|
||||||
|
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask | ButtonPressMask | KeyPressMask, &event);
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
case ButtonPress:
|
||||||
|
if (event.xbutton.button == Button1) {
|
||||||
|
xp = event.xbutton.x_root;
|
||||||
|
yp = event.xbutton.y_root;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ButtonRelease:
|
||||||
|
if (event.xbutton.button == Button1) {
|
||||||
|
quit = 1;
|
||||||
|
if (w > 0 && h > 0) {
|
||||||
|
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
|
||||||
|
XUngrabServer(dpy);
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
return XGetImage(dpy, scr->root_win, x, y, w, h, AllPlanes, ZPixmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MotionNotify:
|
||||||
|
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
|
||||||
|
x = event.xmotion.x_root;
|
||||||
|
if (x < xp) {
|
||||||
|
w = xp - x;
|
||||||
|
} else {
|
||||||
|
w = x - xp;
|
||||||
|
x = xp;
|
||||||
|
}
|
||||||
|
y = event.xmotion.y_root;
|
||||||
|
if (y < yp) {
|
||||||
|
h = yp - y;
|
||||||
|
} else {
|
||||||
|
h = y - yp;
|
||||||
|
y = yp;
|
||||||
|
}
|
||||||
|
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
|
||||||
|
break;
|
||||||
|
case KeyPress:
|
||||||
|
if (W_KeycodeToKeysym(dpy, event.xkey.keycode, 0) == XK_Escape)
|
||||||
|
quit = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WMHandleEvent(&event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XUngrabServer(dpy);
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hideMiniScreenshot(void *data)
|
||||||
|
{
|
||||||
|
WScreen *scr = (WScreen *) data;
|
||||||
|
|
||||||
|
if (time(NULL) < scr->mini_screenshot_timeout) {
|
||||||
|
scr->mini_screenshot_timer = WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideMiniScreenshot, scr);
|
||||||
|
} else {
|
||||||
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
WMDeleteTimerHandler(scr->mini_screenshot_timer);
|
||||||
|
if (XGetWindowAttributes(dpy, scr->mini_screenshot, &attr))
|
||||||
|
slide_window(scr->mini_screenshot, attr.x, attr.y, attr.x + attr.width, attr.y);
|
||||||
|
XUnmapWindow(dpy, scr->mini_screenshot);
|
||||||
|
XDestroyWindow(dpy, scr->mini_screenshot);
|
||||||
|
scr->mini_screenshot_timeout = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showMiniScreenshot(WScreen *scr, RImage *img)
|
||||||
|
{
|
||||||
|
Pixmap pix;
|
||||||
|
int x = scr->scr_width - img->width - 20;
|
||||||
|
int y = scr->scr_height - img->height - 20;
|
||||||
|
|
||||||
|
if (!scr->mini_screenshot_timeout) {
|
||||||
|
Window win;
|
||||||
|
|
||||||
|
win = XCreateSimpleWindow(dpy, scr->root_win, x, y,
|
||||||
|
img->width, img->height, scr->frame_border_width, 0, 0);
|
||||||
|
scr->mini_screenshot = win;
|
||||||
|
}
|
||||||
|
RConvertImage(scr->rcontext, img, &pix);
|
||||||
|
XMapWindow(dpy, scr->mini_screenshot);
|
||||||
|
XCopyArea(dpy, pix, scr->mini_screenshot, scr->rcontext->copy_gc, 0, 0, img->width, img->height, 0, 0);
|
||||||
|
XFlush(dpy);
|
||||||
|
|
||||||
|
scr->mini_screenshot_timeout = time(NULL) + 2;
|
||||||
|
scr->mini_screenshot_timer = WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideMiniScreenshot, scr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCapture(WScreen *scr, int mode)
|
||||||
|
{
|
||||||
|
time_t s;
|
||||||
|
short i = 0;
|
||||||
|
struct tm *tm_info;
|
||||||
|
char index_str[12] = "";
|
||||||
|
char filename_date_part[60];
|
||||||
|
char filename[60];
|
||||||
|
char *filepath;
|
||||||
|
char *screenshot_dir;
|
||||||
|
RImage *img = NULL;
|
||||||
|
RImage *scale_img = NULL;
|
||||||
|
|
||||||
|
#ifdef USE_PNG
|
||||||
|
char *filetype = ".png";
|
||||||
|
#else
|
||||||
|
#ifdef USE_JPEG
|
||||||
|
char *filetype = ".jpg";
|
||||||
|
#else
|
||||||
|
char *filetype = NULL;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!filetype) {
|
||||||
|
werror(_("Unable to find a proper screenshot image format"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
screenshot_dir = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/Screenshots/");
|
||||||
|
if (-1 == mkdir(screenshot_dir, 0700) && errno != EEXIST) {
|
||||||
|
wfree(screenshot_dir);
|
||||||
|
werror(_("Unable to create screenshot directory: %s"), strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = time(NULL);
|
||||||
|
tm_info = localtime(&s);
|
||||||
|
strftime(filename_date_part, sizeof(filename_date_part), "screenshot_%Y-%m-%d_at_%H:%M:%S", tm_info);
|
||||||
|
strcpy(filename, filename_date_part);
|
||||||
|
|
||||||
|
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));
|
||||||
|
while (access(filepath, F_OK) == 0 && i < 600) {
|
||||||
|
i++;
|
||||||
|
strcpy(filename, filename_date_part);
|
||||||
|
sprintf(index_str, "_%d", i);
|
||||||
|
strncat(filename, index_str, sizeof(filename) - strlen(filename) - 1);
|
||||||
|
wfree(filepath);
|
||||||
|
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cannot generate an available filename ?! */
|
||||||
|
if (i == 600) {
|
||||||
|
wfree(filepath);
|
||||||
|
wfree(screenshot_dir);
|
||||||
|
werror(_("Could not generate a free screenshot filename"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case PRINT_WINDOW:
|
||||||
|
WWindow *wwin = scr->focused_window;
|
||||||
|
if (wwin && !wwin->flags.shaded) {
|
||||||
|
/*
|
||||||
|
* check if hint WM_TAKE_FOCUS is set, if it's the case
|
||||||
|
* we can take screenshot of the out of screen window
|
||||||
|
*/
|
||||||
|
if (wwin->focus_mode >= WFM_LOCALLY_ACTIVE) {
|
||||||
|
img = RCreateImageFromDrawable(scr->rcontext, wwin->client_win, None);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* we will only capture the visible window part */
|
||||||
|
XImage *pimg;
|
||||||
|
int x_crop = 0;
|
||||||
|
int y_crop = 0;
|
||||||
|
int w_crop = wwin->client.width;
|
||||||
|
int h_crop = wwin->client.height;
|
||||||
|
|
||||||
|
if (wwin->client.x > 0)
|
||||||
|
x_crop = wwin->client.x;
|
||||||
|
if (wwin->client.y > 0)
|
||||||
|
y_crop = wwin->client.y;
|
||||||
|
|
||||||
|
if (wwin->client.x + wwin->client.width > scr->scr_width)
|
||||||
|
w_crop = scr->scr_width - wwin->client.x;
|
||||||
|
if (wwin->client.y + wwin->client.height > scr->scr_height)
|
||||||
|
h_crop = scr->scr_height - wwin->client.y;
|
||||||
|
|
||||||
|
pimg = XGetImage(dpy, scr->root_win, x_crop, y_crop,
|
||||||
|
(wwin->client.x > 0)?w_crop:w_crop + wwin->client.x,
|
||||||
|
(wwin->client.y > 0)?h_crop:h_crop + wwin->client.y,
|
||||||
|
AllPlanes, ZPixmap);
|
||||||
|
|
||||||
|
if (pimg) {
|
||||||
|
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
|
||||||
|
XDestroyImage(pimg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PRINT_PARTIAL:
|
||||||
|
XImage *pimg;
|
||||||
|
|
||||||
|
pimg = imageCaptureArea(scr);
|
||||||
|
if (pimg) {
|
||||||
|
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
|
||||||
|
XDestroyImage(pimg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* PRINT_SCREEN*/
|
||||||
|
img = RCreateImageFromDrawable(scr->rcontext, scr->root_win, None);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (img) {
|
||||||
|
#ifdef USE_PNG
|
||||||
|
if (RSaveTitledImage(img, filepath, (char *)(filetype + 1), "Screenshot from Window Maker")) {
|
||||||
|
#else
|
||||||
|
if (RSaveTitledImage(img, filepath, (char *)(filetype + 1), "Screenshot from Window Maker")) {
|
||||||
|
#endif
|
||||||
|
scale_img = RSmoothScaleImage(img, scr->scr_width / 10, scr->scr_height / 10);
|
||||||
|
showMiniScreenshot(scr, scale_img);
|
||||||
|
RReleaseImage(scale_img);
|
||||||
|
#ifdef DEBUG
|
||||||
|
wmessage("screenshot filepath: %s", filepath);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
RReleaseImage(img);
|
||||||
|
}
|
||||||
|
wfree(filepath);
|
||||||
|
wfree(screenshot_dir);
|
||||||
|
}
|
||||||
|
|||||||
+9
-1
@@ -27,6 +27,9 @@
|
|||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
#define PRINT_SCREEN 1
|
||||||
|
#define PRINT_WINDOW 2
|
||||||
|
#define PRINT_PARTIAL 3
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WMRect *screens;
|
WMRect *screens;
|
||||||
@@ -271,6 +274,11 @@ typedef struct _WScreen {
|
|||||||
WMHandlerID *workspace_name_timer;
|
WMHandlerID *workspace_name_timer;
|
||||||
struct WorkspaceNameData *workspace_name_data;
|
struct WorkspaceNameData *workspace_name_data;
|
||||||
|
|
||||||
|
/* mini screenshot data */
|
||||||
|
Window mini_screenshot;
|
||||||
|
time_t mini_screenshot_timeout;
|
||||||
|
WMHandlerID *mini_screenshot_timer;
|
||||||
|
|
||||||
/* for raise-delay */
|
/* for raise-delay */
|
||||||
WMHandlerID *autoRaiseTimer;
|
WMHandlerID *autoRaiseTimer;
|
||||||
Window autoRaiseWindow; /* window that is scheduled to be
|
Window autoRaiseWindow; /* window that is scheduled to be
|
||||||
@@ -314,7 +322,7 @@ void wScreenRestoreState(WScreen *scr);
|
|||||||
|
|
||||||
int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
|
int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
|
||||||
int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
|
int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
|
||||||
|
void ScreenCapture(WScreen *scr, int mode);
|
||||||
|
|
||||||
/* in startup.c */
|
/* in startup.c */
|
||||||
WScreen *wScreenWithNumber(int i);
|
WScreen *wScreenWithNumber(int i);
|
||||||
|
|||||||
+37
-6
@@ -93,6 +93,7 @@ static WMPropList *sHost;
|
|||||||
static WMPropList *sWorkspace;
|
static WMPropList *sWorkspace;
|
||||||
static WMPropList *sShaded;
|
static WMPropList *sShaded;
|
||||||
static WMPropList *sMiniaturized;
|
static WMPropList *sMiniaturized;
|
||||||
|
static WMPropList *sMaximized;
|
||||||
static WMPropList *sHidden;
|
static WMPropList *sHidden;
|
||||||
static WMPropList *sGeometry;
|
static WMPropList *sGeometry;
|
||||||
static WMPropList *sShortcutMask;
|
static WMPropList *sShortcutMask;
|
||||||
@@ -112,6 +113,7 @@ static void make_keys(void)
|
|||||||
sWorkspace = WMCreatePLString("Workspace");
|
sWorkspace = WMCreatePLString("Workspace");
|
||||||
sShaded = WMCreatePLString("Shaded");
|
sShaded = WMCreatePLString("Shaded");
|
||||||
sMiniaturized = WMCreatePLString("Miniaturized");
|
sMiniaturized = WMCreatePLString("Miniaturized");
|
||||||
|
sMaximized = WMCreatePLString("Maximized");
|
||||||
sHidden = WMCreatePLString("Hidden");
|
sHidden = WMCreatePLString("Hidden");
|
||||||
sGeometry = WMCreatePLString("Geometry");
|
sGeometry = WMCreatePLString("Geometry");
|
||||||
sDock = WMCreatePLString("Dock");
|
sDock = WMCreatePLString("Dock");
|
||||||
@@ -166,6 +168,22 @@ static unsigned getInt(WMPropList * value)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned getHex(WMPropList * value)
|
||||||
|
{
|
||||||
|
char *val;
|
||||||
|
unsigned n;
|
||||||
|
|
||||||
|
if (!WMIsPLString(value))
|
||||||
|
return 0;
|
||||||
|
val = WMGetFromPLString(value);
|
||||||
|
if (!val)
|
||||||
|
return 0;
|
||||||
|
if (sscanf(val, "0x%04X", &n) != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
@@ -174,7 +192,7 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
unsigned mask;
|
unsigned mask;
|
||||||
char *class, *instance, *command = NULL, buffer[512];
|
char *class, *instance, *command = NULL, buffer[512];
|
||||||
WMPropList *win_state, *cmd, *name, *workspace;
|
WMPropList *win_state, *cmd, *name, *workspace;
|
||||||
WMPropList *shaded, *miniaturized, *hidden, *geometry;
|
WMPropList *shaded, *miniaturized, *maximized, *hidden, *geometry;
|
||||||
WMPropList *dock, *shortcut;
|
WMPropList *dock, *shortcut;
|
||||||
|
|
||||||
if (wwin->orig_main_window != None && wwin->orig_main_window != wwin->client_win)
|
if (wwin->orig_main_window != None && wwin->orig_main_window != wwin->client_win)
|
||||||
@@ -183,8 +201,13 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
win = wwin->client_win;
|
win = wwin->client_win;
|
||||||
|
|
||||||
command = GetCommandForWindow(win);
|
command = GetCommandForWindow(win);
|
||||||
if (!command)
|
if (!command) {
|
||||||
return NULL;
|
if (wapp->app_icon && wapp->app_icon->command) {
|
||||||
|
command = wmalloc(strlen(wapp->app_icon->command) + 1);
|
||||||
|
strcpy(command, wapp->app_icon->command);
|
||||||
|
} else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (PropGetWMClass(win, &class, &instance)) {
|
if (PropGetWMClass(win, &class, &instance)) {
|
||||||
if (class && instance)
|
if (class && instance)
|
||||||
@@ -202,6 +225,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
|
|
||||||
shaded = wwin->flags.shaded ? sYes : sNo;
|
shaded = wwin->flags.shaded ? sYes : sNo;
|
||||||
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
|
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
|
||||||
|
snprintf(buffer, sizeof(buffer), "0x%04X", wwin->flags.maximized);
|
||||||
|
maximized = WMCreatePLString(buffer);
|
||||||
hidden = wwin->flags.hidden ? sYes : sNo;
|
hidden = wwin->flags.hidden ? sYes : sNo;
|
||||||
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
|
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
|
||||||
wwin->client.width, wwin->client.height, wwin->frame_x, wwin->frame_y);
|
wwin->client.width, wwin->client.height, wwin->frame_x, wwin->frame_y);
|
||||||
@@ -221,12 +246,14 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
sWorkspace, workspace,
|
sWorkspace, workspace,
|
||||||
sShaded, shaded,
|
sShaded, shaded,
|
||||||
sMiniaturized, miniaturized,
|
sMiniaturized, miniaturized,
|
||||||
|
sMaximized, maximized,
|
||||||
sHidden, hidden,
|
sHidden, hidden,
|
||||||
sShortcutMask, shortcut, sGeometry, geometry, NULL);
|
sShortcutMask, shortcut, sGeometry, geometry, NULL);
|
||||||
|
|
||||||
WMReleasePropList(name);
|
WMReleasePropList(name);
|
||||||
WMReleasePropList(cmd);
|
WMReleasePropList(cmd);
|
||||||
WMReleasePropList(workspace);
|
WMReleasePropList(workspace);
|
||||||
|
WMReleasePropList(maximized);
|
||||||
WMReleasePropList(geometry);
|
WMReleasePropList(geometry);
|
||||||
WMReleasePropList(shortcut);
|
WMReleasePropList(shortcut);
|
||||||
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
|
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
|
||||||
@@ -344,6 +371,7 @@ static pid_t execCommand(WScreen *scr, char *command)
|
|||||||
wtokensplit(command, &argv, &argc);
|
wtokensplit(command, &argv, &argc);
|
||||||
|
|
||||||
if (!argc) {
|
if (!argc) {
|
||||||
|
wfree(argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,9 +392,7 @@ static pid_t execCommand(WScreen *scr, char *command)
|
|||||||
execvp(argv[0], args);
|
execvp(argv[0], args);
|
||||||
exit(111);
|
exit(111);
|
||||||
}
|
}
|
||||||
while (argc > 0)
|
wtokenfree(argv, argc);
|
||||||
wfree(argv[--argc]);
|
|
||||||
wfree(argv);
|
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +429,11 @@ static WSavedState *getWindowState(WScreen * scr, WMPropList * win_state)
|
|||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
state->miniaturized = getBool(value);
|
state->miniaturized = getBool(value);
|
||||||
|
|
||||||
|
value = WMGetFromPLDictionary(win_state, sMaximized);
|
||||||
|
if (value != NULL) {
|
||||||
|
state->maximized = getHex(value);
|
||||||
|
}
|
||||||
|
|
||||||
value = WMGetFromPLDictionary(win_state, sHidden);
|
value = WMGetFromPLDictionary(win_state, sHidden);
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
state->hidden = getBool(value);
|
state->hidden = getBool(value);
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
wPreferences.cursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
wPreferences.cursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
||||||
wPreferences.cursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name??? */
|
wPreferences.cursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name??? */
|
||||||
wPreferences.cursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
|
wPreferences.cursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
|
||||||
|
wPreferences.cursor[WCUR_CAPTURE] = XCreateFontCursor(dpy, XC_crosshair);
|
||||||
|
|
||||||
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
|
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
|
||||||
GC gc = XCreateGC(dpy, cur, 0, NULL);
|
GC gc = XCreateGC(dpy, cur, 0, NULL);
|
||||||
|
|||||||
+9
-5
@@ -61,6 +61,7 @@ struct SwitchPanel {
|
|||||||
|
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
WMColor *white;
|
WMColor *white;
|
||||||
|
WMColor *gray;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* these values will be updated whenever the switch panel
|
/* these values will be updated whenever the switch panel
|
||||||
@@ -154,11 +155,10 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim,
|
|||||||
border_space + pos.y, back->width, back->height, 0, 0);
|
border_space + pos.y, back->width, back->height, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
RColor color;
|
RColor color;
|
||||||
WMScreen *wscr = WMWidgetScreen(icon);
|
color.red = WMRedComponentOfColor(panel->gray) >> 8;
|
||||||
color.red = 255;
|
color.green = WMGreenComponentOfColor(panel->gray) >> 8;
|
||||||
color.red = WMRedComponentOfColor(WMGrayColor(wscr)) >> 8;
|
color.blue = WMBlueComponentOfColor(panel->gray) >> 8;
|
||||||
color.green = WMGreenComponentOfColor(WMGrayColor(wscr)) >> 8;
|
color.alpha = 255;
|
||||||
color.blue = WMBlueComponentOfColor(WMGrayColor(wscr)) >> 8;
|
|
||||||
RFillImage(back, &color);
|
RFillImage(back, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +454,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, Bool class_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
panel->white = WMWhiteColor(scr->wmscreen);
|
panel->white = WMWhiteColor(scr->wmscreen);
|
||||||
|
panel->gray = WMGrayColor(scr->wmscreen);
|
||||||
panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12));
|
panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12));
|
||||||
panel->icons = WMCreateArray(count);
|
panel->icons = WMCreateArray(count);
|
||||||
panel->images = WMCreateArray(count);
|
panel->images = WMCreateArray(count);
|
||||||
@@ -589,6 +590,9 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
|
|||||||
if (panel->white)
|
if (panel->white)
|
||||||
WMReleaseColor(panel->white);
|
WMReleaseColor(panel->white);
|
||||||
|
|
||||||
|
if (panel->gray)
|
||||||
|
WMReleaseColor(panel->gray);
|
||||||
|
|
||||||
wfree(panel);
|
wfree(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
|
|||||||
WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
|
WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
|
||||||
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
|
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
|
||||||
WTexTGradient *wTextureMakeTGradient(WScreen*, int, const RColor*, const RColor*, const char *, int);
|
WTexTGradient *wTextureMakeTGradient(WScreen*, int, const RColor*, const RColor*, const char *, int);
|
||||||
WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
|
WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[2], int, const RColor[2]);
|
||||||
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file,
|
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file,
|
||||||
XColor *color);
|
XColor *color);
|
||||||
void wTextureDestroy(WScreen*, WTexture*);
|
void wTextureDestroy(WScreen*, WTexture*);
|
||||||
|
|||||||
+79
-27
@@ -29,6 +29,9 @@
|
|||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||||
|
#ifdef USE_XRES
|
||||||
|
#include <X11/extensions/XRes.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -475,6 +478,41 @@ Bool wWindowObscuresWindow(WWindow *wwin, WWindow *obscured)
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the corresponding Process Identification Number of the active window */
|
||||||
|
static pid_t getWindowPid(Window win)
|
||||||
|
{
|
||||||
|
pid_t pid = -1;
|
||||||
|
|
||||||
|
pid = wNETWMGetPidForWindow(win);
|
||||||
|
#ifdef USE_XRES
|
||||||
|
if (pid > 0)
|
||||||
|
return pid;
|
||||||
|
else {
|
||||||
|
XResClientIdSpec spec;
|
||||||
|
int status;
|
||||||
|
long i, num_ids = 0;
|
||||||
|
XResClientIdValue *client_ids = NULL;
|
||||||
|
|
||||||
|
spec.client = win;
|
||||||
|
spec.mask = XRES_CLIENT_ID_PID_MASK;
|
||||||
|
|
||||||
|
status = XResQueryClientIds(dpy, 1, &spec, &num_ids, &client_ids);
|
||||||
|
|
||||||
|
if (status != Success)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for (i = 0; i < num_ids; i++) {
|
||||||
|
if (client_ids[i].spec.mask == XRES_CLIENT_ID_PID_MASK) {
|
||||||
|
pid = XResGetClientPid(&client_ids[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XResClientIdsDestroy(num_ids, client_ids);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
static void fixLeaderProperties(WWindow *wwin)
|
static void fixLeaderProperties(WWindow *wwin)
|
||||||
{
|
{
|
||||||
XClassHint *classHint;
|
XClassHint *classHint;
|
||||||
@@ -487,7 +525,7 @@ static void fixLeaderProperties(WWindow *wwin)
|
|||||||
|
|
||||||
classHint = XAllocClassHint();
|
classHint = XAllocClassHint();
|
||||||
clientHints = XGetWMHints(dpy, wwin->client_win);
|
clientHints = XGetWMHints(dpy, wwin->client_win);
|
||||||
pid = wNETWMGetPidForWindow(wwin->client_win);
|
pid = getWindowPid(wwin->client_win);
|
||||||
if (pid > 0)
|
if (pid > 0)
|
||||||
haveCommand = GetCommandForPid(pid, &argv, &argc);
|
haveCommand = GetCommandForPid(pid, &argv, &argc);
|
||||||
else
|
else
|
||||||
@@ -688,6 +726,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
|||||||
XChangeWindowAttributes(dpy, window, CWEventMask | CWDontPropagate | CWSaveUnder, &attribs);
|
XChangeWindowAttributes(dpy, window, CWEventMask | CWDontPropagate | CWSaveUnder, &attribs);
|
||||||
XSetWindowBorderWidth(dpy, window, 0);
|
XSetWindowBorderWidth(dpy, window, 0);
|
||||||
|
|
||||||
|
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "DockApp") != 0)
|
||||||
|
wwin->flags.fullscreen_monitors[0] = -1;
|
||||||
|
|
||||||
/* get hints from GNUstep app */
|
/* get hints from GNUstep app */
|
||||||
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0)
|
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0)
|
||||||
wwin->flags.is_gnustep = 1;
|
wwin->flags.is_gnustep = 1;
|
||||||
@@ -878,6 +919,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
|||||||
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable))
|
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable))
|
||||||
wwin->flags.miniaturized = win_state->state->miniaturized;
|
wwin->flags.miniaturized = win_state->state->miniaturized;
|
||||||
|
|
||||||
|
if (win_state->state->maximized > 0)
|
||||||
|
wwin->flags.maximized = win_state->state->maximized;
|
||||||
|
|
||||||
if (!IS_OMNIPRESENT(wwin)) {
|
if (!IS_OMNIPRESENT(wwin)) {
|
||||||
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
|
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
|
||||||
wwin->wm_class);
|
wwin->wm_class);
|
||||||
@@ -1691,9 +1735,8 @@ void wWindowSingleFocus(WWindow *wwin)
|
|||||||
/* bring window back to visible area */
|
/* bring window back to visible area */
|
||||||
move = wScreenBringInside(scr, &x, &y, wwin->frame->core->width, wwin->frame->core->height);
|
move = wScreenBringInside(scr, &x, &y, wwin->frame->core->width, wwin->frame->core->height);
|
||||||
|
|
||||||
if (move) {
|
if (move)
|
||||||
wWindowConfigure(wwin, x, y, wwin->client.width, wwin->client.height);
|
wWindowConfigure(wwin, x, y, wwin->client.width, wwin->client.height);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wWindowFocusPrev(WWindow *wwin, Bool inSameWorkspace)
|
void wWindowFocusPrev(WWindow *wwin, Bool inSameWorkspace)
|
||||||
@@ -1857,9 +1900,21 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
|||||||
int baseW = 0;
|
int baseW = 0;
|
||||||
int baseH = 0;
|
int baseH = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* X11 proto defines width and height as a CARD16
|
||||||
|
* if window size is guaranteed to fail, failsafe to a reasonable size
|
||||||
|
*/
|
||||||
|
if (width > USHRT_MAX && height > USHRT_MAX) {
|
||||||
|
width = 640;
|
||||||
|
height = 480;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (wwin->normal_hints) {
|
if (wwin->normal_hints) {
|
||||||
winc = wwin->normal_hints->width_inc;
|
if (!wwin->flags.maximized) {
|
||||||
hinc = wwin->normal_hints->height_inc;
|
winc = wwin->normal_hints->width_inc;
|
||||||
|
hinc = wwin->normal_hints->height_inc;
|
||||||
|
}
|
||||||
minW = wwin->normal_hints->min_width;
|
minW = wwin->normal_hints->min_width;
|
||||||
minH = wwin->normal_hints->min_height;
|
minH = wwin->normal_hints->min_height;
|
||||||
maxW = wwin->normal_hints->max_width;
|
maxW = wwin->normal_hints->max_width;
|
||||||
@@ -1875,15 +1930,19 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
|||||||
baseH = wwin->normal_hints->base_height;
|
baseH = wwin->normal_hints->base_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* trust the mins provided by the client but not the maxs */
|
||||||
if (width < minW)
|
if (width < minW)
|
||||||
width = minW;
|
width = minW;
|
||||||
if (height < minH)
|
if (height < minH)
|
||||||
height = minH;
|
height = minH;
|
||||||
|
|
||||||
if (width > maxW)
|
/* if only one dimension is over the top, set a default 4/3 ratio */
|
||||||
width = maxW;
|
if (width > maxW && height < maxH) {
|
||||||
if (height > maxH)
|
width = height * 4 / 3;
|
||||||
height = maxH;
|
} else {
|
||||||
|
if(height > maxH && width < maxW)
|
||||||
|
height = width * 3 / 4;
|
||||||
|
}
|
||||||
|
|
||||||
/* aspect ratio code borrowed from olwm */
|
/* aspect ratio code borrowed from olwm */
|
||||||
if (minAX > 0) {
|
if (minAX > 0) {
|
||||||
@@ -1922,15 +1981,17 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseW != 0)
|
if (!wwin->flags.maximized) {
|
||||||
width = (((width - baseW) / winc) * winc) + baseW;
|
if (baseW != 0)
|
||||||
else
|
width = (((width - baseW) / winc) * winc) + baseW;
|
||||||
width = (((width - minW) / winc) * winc) + minW;
|
else
|
||||||
|
width = (((width - minW) / winc) * winc) + minW;
|
||||||
|
|
||||||
if (baseH != 0)
|
if (baseH != 0)
|
||||||
height = (((height - baseH) / hinc) * hinc) + baseH;
|
height = (((height - baseH) / hinc) * hinc) + baseH;
|
||||||
else
|
else
|
||||||
height = (((height - minH) / hinc) * hinc) + minH;
|
height = (((height - minH) / hinc) * hinc) + minH;
|
||||||
|
}
|
||||||
|
|
||||||
/* broken stupid apps may cause preposterous values for these.. */
|
/* broken stupid apps may cause preposterous values for these.. */
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
@@ -2087,14 +2148,6 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
|
|||||||
int synth_notify = False;
|
int synth_notify = False;
|
||||||
int resize;
|
int resize;
|
||||||
|
|
||||||
/* if window size is guaranteed to fail - fix it to some reasonable
|
|
||||||
* defaults */
|
|
||||||
if (req_height > SHRT_MAX)
|
|
||||||
req_height = 480;
|
|
||||||
|
|
||||||
if (req_width > SHRT_MAX)
|
|
||||||
req_height = 640;
|
|
||||||
|
|
||||||
resize = (req_width != wwin->client.width || req_height != wwin->client.height);
|
resize = (req_width != wwin->client.width || req_height != wwin->client.height);
|
||||||
/*
|
/*
|
||||||
* if the window is being moved but not resized then
|
* if the window is being moved but not resized then
|
||||||
@@ -2649,7 +2702,7 @@ void wWindowUpdateGNUstepAttr(WWindow * wwin, GNUstepWMAttributes * attr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMagicNumber wWindowAddSavedState(const char *instance, const char *class,
|
WMagicNumber wWindowAddSavedState(const char *instance, const char *class,
|
||||||
const char *command, pid_t pid, WSavedState * state)
|
const char *command, pid_t pid, WSavedState *state)
|
||||||
{
|
{
|
||||||
WWindowState *wstate;
|
WWindowState *wstate;
|
||||||
|
|
||||||
@@ -2884,7 +2937,6 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* maximize window */
|
/* maximize window */
|
||||||
|
|
||||||
if (dir != 0 && IS_RESIZABLE(wwin)) {
|
if (dir != 0 && IS_RESIZABLE(wwin)) {
|
||||||
int ndir = dir ^ wwin->flags.maximized;
|
int ndir = dir ^ wwin->flags.maximized;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -254,6 +254,7 @@ typedef struct WWindow {
|
|||||||
unsigned int maximized:7;
|
unsigned int maximized:7;
|
||||||
unsigned int old_maximized:7;
|
unsigned int old_maximized:7;
|
||||||
unsigned int fullscreen:1;
|
unsigned int fullscreen:1;
|
||||||
|
long fullscreen_monitors[4];
|
||||||
unsigned int omnipresent:1;
|
unsigned int omnipresent:1;
|
||||||
unsigned int semi_focused:1;
|
unsigned int semi_focused:1;
|
||||||
/* window type flags */
|
/* window type flags */
|
||||||
@@ -308,9 +309,9 @@ typedef struct WWindow {
|
|||||||
typedef struct WSavedState {
|
typedef struct WSavedState {
|
||||||
int workspace;
|
int workspace;
|
||||||
int miniaturized;
|
int miniaturized;
|
||||||
|
int maximized;
|
||||||
int shaded;
|
int shaded;
|
||||||
int hidden;
|
int hidden;
|
||||||
int maximized;
|
|
||||||
int x; /* original geometry of the */
|
int x; /* original geometry of the */
|
||||||
int y; /* window if it's maximized */
|
int y; /* window if it's maximized */
|
||||||
unsigned int w;
|
unsigned int w;
|
||||||
|
|||||||
+58
-6
@@ -77,6 +77,9 @@ static Atom net_wm_visible_name; /* TODO (unnecessary?) */
|
|||||||
static Atom net_wm_icon_name;
|
static Atom net_wm_icon_name;
|
||||||
static Atom net_wm_visible_icon_name; /* TODO (unnecessary?) */
|
static Atom net_wm_visible_icon_name; /* TODO (unnecessary?) */
|
||||||
static Atom net_wm_desktop;
|
static Atom net_wm_desktop;
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
static Atom net_wm_fullscreen_monitors;
|
||||||
|
#endif
|
||||||
static Atom net_wm_window_type;
|
static Atom net_wm_window_type;
|
||||||
static Atom net_wm_window_type_desktop;
|
static Atom net_wm_window_type_desktop;
|
||||||
static Atom net_wm_window_type_dock;
|
static Atom net_wm_window_type_dock;
|
||||||
@@ -161,6 +164,9 @@ static atomitem_t atomNames[] = {
|
|||||||
{"_NET_WM_ICON_NAME", &net_wm_icon_name},
|
{"_NET_WM_ICON_NAME", &net_wm_icon_name},
|
||||||
{"_NET_WM_VISIBLE_ICON_NAME", &net_wm_visible_icon_name},
|
{"_NET_WM_VISIBLE_ICON_NAME", &net_wm_visible_icon_name},
|
||||||
{"_NET_WM_DESKTOP", &net_wm_desktop},
|
{"_NET_WM_DESKTOP", &net_wm_desktop},
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
{"_NET_WM_FULLSCREEN_MONITORS", &net_wm_fullscreen_monitors},
|
||||||
|
#endif
|
||||||
{"_NET_WM_WINDOW_TYPE", &net_wm_window_type},
|
{"_NET_WM_WINDOW_TYPE", &net_wm_window_type},
|
||||||
{"_NET_WM_WINDOW_TYPE_DESKTOP", &net_wm_window_type_desktop},
|
{"_NET_WM_WINDOW_TYPE_DESKTOP", &net_wm_window_type_desktop},
|
||||||
{"_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock},
|
{"_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock},
|
||||||
@@ -287,6 +293,9 @@ static void setSupportedHints(WScreen *scr)
|
|||||||
atom[i++] = net_wm_moveresize;
|
atom[i++] = net_wm_moveresize;
|
||||||
#endif
|
#endif
|
||||||
atom[i++] = net_wm_desktop;
|
atom[i++] = net_wm_desktop;
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
atom[i++] = net_wm_fullscreen_monitors;
|
||||||
|
#endif
|
||||||
atom[i++] = net_wm_window_type;
|
atom[i++] = net_wm_window_type;
|
||||||
atom[i++] = net_wm_window_type_desktop;
|
atom[i++] = net_wm_window_type_desktop;
|
||||||
atom[i++] = net_wm_window_type_dock;
|
atom[i++] = net_wm_window_type_dock;
|
||||||
@@ -988,7 +997,7 @@ static void updateWorkspaceNames(WScreen *scr)
|
|||||||
len = 0;
|
len = 0;
|
||||||
for (i = 0; i < scr->workspace_count; i++) {
|
for (i = 0; i < scr->workspace_count; i++) {
|
||||||
curr_size = strlen(scr->workspaces[i]->name);
|
curr_size = strlen(scr->workspaces[i]->name);
|
||||||
strcpy(pos, scr->workspaces[i]->name);
|
strncpy(pos, scr->workspaces[i]->name, sizeof(pos) - 1);
|
||||||
pos += (curr_size + 1);
|
pos += (curr_size + 1);
|
||||||
len += (curr_size + 1);
|
len += (curr_size + 1);
|
||||||
}
|
}
|
||||||
@@ -1027,6 +1036,9 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
|
|||||||
{ /* changeable */
|
{ /* changeable */
|
||||||
if (del) {
|
if (del) {
|
||||||
XDeleteProperty(dpy, wwin->client_win, net_wm_state);
|
XDeleteProperty(dpy, wwin->client_win, net_wm_state);
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
XDeleteProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Atom state[15]; /* nr of defined state atoms */
|
Atom state[15]; /* nr of defined state atoms */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -1067,6 +1079,20 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
|
|||||||
|
|
||||||
XChangeProperty(dpy, wwin->client_win, net_wm_state, XA_ATOM, 32,
|
XChangeProperty(dpy, wwin->client_win, net_wm_state, XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char *)state, i);
|
PropModeReplace, (unsigned char *)state, i);
|
||||||
|
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
if (wwin->flags.fullscreen && (wwin->flags.fullscreen_monitors[0] != -1)) {
|
||||||
|
unsigned long data[4];
|
||||||
|
|
||||||
|
data[0] = wwin->flags.fullscreen_monitors[0];
|
||||||
|
data[1] = wwin->flags.fullscreen_monitors[1];
|
||||||
|
data[2] = wwin->flags.fullscreen_monitors[2];
|
||||||
|
data[3] = wwin->flags.fullscreen_monitors[3];
|
||||||
|
|
||||||
|
XChangeProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors, XA_CARDINAL, 32,
|
||||||
|
PropModeReplace, (unsigned char *)data, 4);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1260,8 +1286,10 @@ static void doStateAtom(WWindow *wwin, Atom state, int set, Bool init)
|
|||||||
} else {
|
} else {
|
||||||
if (set)
|
if (set)
|
||||||
wFullscreenWindow(wwin);
|
wFullscreenWindow(wwin);
|
||||||
else
|
else {
|
||||||
wUnfullscreenWindow(wwin);
|
wUnfullscreenWindow(wwin);
|
||||||
|
wwin->flags.fullscreen_monitors[0] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (state == net_wm_state_above) {
|
} else if (state == net_wm_state_above) {
|
||||||
if (set == _NET_WM_STATE_TOGGLE)
|
if (set == _NET_WM_STATE_TOGGLE)
|
||||||
@@ -1455,7 +1483,8 @@ void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int height)
|
|||||||
static void updateWindowType(WWindow *wwin)
|
static void updateWindowType(WWindow *wwin)
|
||||||
{
|
{
|
||||||
Atom type_ret;
|
Atom type_ret;
|
||||||
int fmt_ret, layer;
|
int fmt_ret;
|
||||||
|
int layer = INT_MIN; //illegal level
|
||||||
unsigned long nitems_ret, bytes_after_ret;
|
unsigned long nitems_ret, bytes_after_ret;
|
||||||
long *data = NULL;
|
long *data = NULL;
|
||||||
|
|
||||||
@@ -1473,7 +1502,8 @@ static void updateWindowType(WWindow *wwin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wwin->frame != NULL) {
|
if (wwin->frame != NULL) {
|
||||||
ChangeStackingLevel(wwin->frame->core, layer);
|
if (layer != INT_MIN)
|
||||||
|
ChangeStackingLevel(wwin->frame->core, layer);
|
||||||
wwin->frame->flags.need_texture_change = 1;
|
wwin->frame->flags.need_texture_change = 1;
|
||||||
wWindowConfigureBorders(wwin);
|
wWindowConfigureBorders(wwin);
|
||||||
wFrameWindowPaint(wwin->frame);
|
wFrameWindowPaint(wwin->frame);
|
||||||
@@ -1706,7 +1736,7 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
|
|||||||
if (wwin->frame->workspace == wwin->screen_ptr->current_workspace /* No workspace change */
|
if (wwin->frame->workspace == wwin->screen_ptr->current_workspace /* No workspace change */
|
||||||
|| event->data.l[0] == 2 /* Requested by pager */
|
|| event->data.l[0] == 2 /* Requested by pager */
|
||||||
|| WFLAGP(wwin, focus_across_wksp) /* Explicitly allowed */) {
|
|| WFLAGP(wwin, focus_across_wksp) /* Explicitly allowed */) {
|
||||||
wNETWMShowingDesktop(scr, False);
|
wNETWMShowingDesktop(wwin->screen_ptr, False);
|
||||||
wMakeWindowVisible(wwin);
|
wMakeWindowVisible(wwin);
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
@@ -1759,8 +1789,30 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
|
|||||||
wWindowChangeWorkspace(wwin, desktop);
|
wWindowChangeWorkspace(wwin, desktop);
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
}
|
|
||||||
|
|
||||||
|
#ifdef USE_XINERAMA
|
||||||
|
} else if (event->message_type == net_wm_fullscreen_monitors) {
|
||||||
|
unsigned long top, bottom, left, right, src_indication;
|
||||||
|
|
||||||
|
top = event->data.l[0];
|
||||||
|
bottom = event->data.l[1];
|
||||||
|
left = event->data.l[2];
|
||||||
|
right = event->data.l[3];
|
||||||
|
src_indication = event->data.l[4];
|
||||||
|
|
||||||
|
if (src_indication > 1)
|
||||||
|
wwarning("_NET_WM_FULLSCREEN_MONITORS source indication %ld not supported", src_indication);
|
||||||
|
|
||||||
|
wFullscreenMonitorsWindow(wwin, top, bottom, left, right);
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_WMSPEC
|
||||||
|
wmessage("processClientMessage unsupported type %s", XGetAtomName(dpy, event->message_type));
|
||||||
|
#endif
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -337,9 +337,9 @@ static WMPixmap *get_mini_workspace(WWorkspaceMap *wsmap, int index)
|
|||||||
|
|
||||||
static void create_mini_workspace(WScreen *scr, WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
|
static void create_mini_workspace(WScreen *scr, WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
|
||||||
{
|
{
|
||||||
int workspace_index;
|
unsigned short workspace_index;
|
||||||
int mini_workspace_cnt;
|
int mini_workspace_cnt;
|
||||||
char name[10];
|
char name[6];
|
||||||
WMButton *mini_workspace_btn;
|
WMButton *mini_workspace_btn;
|
||||||
WMPixmap *icon;
|
WMPixmap *icon;
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ static void create_mini_workspace(WScreen *scr, WWorkspaceMap *wsmap, W_Workspac
|
|||||||
WMReleasePixmap(icon);
|
WMReleasePixmap(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "%d", workspace_index);
|
snprintf(name, sizeof(name), "%hu", workspace_index);
|
||||||
WMSetButtonText(mini_workspace_btn, name);
|
WMSetButtonText(mini_workspace_btn, name);
|
||||||
WMSetButtonAction(mini_workspace_btn, selected_workspace_callback, wsmap);
|
WMSetButtonAction(mini_workspace_btn, selected_workspace_callback, wsmap);
|
||||||
}
|
}
|
||||||
@@ -423,9 +423,9 @@ static WWorkspaceMap *create_workspace_map(WScreen *scr, W_WorkspaceMap *wsmap_a
|
|||||||
|
|
||||||
static void update_mini_workspace(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array, int bulk_of_ten)
|
static void update_mini_workspace(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array, int bulk_of_ten)
|
||||||
{
|
{
|
||||||
int local_index, general_index;
|
unsigned short local_index, general_index;
|
||||||
int mini_workspace_cnt;
|
int mini_workspace_cnt;
|
||||||
char name[10];
|
char name[6];
|
||||||
WMPixmap *icon;
|
WMPixmap *icon;
|
||||||
|
|
||||||
if (bulk_of_ten == wsmap_bulk_index)
|
if (bulk_of_ten == wsmap_bulk_index)
|
||||||
@@ -448,7 +448,7 @@ static void update_mini_workspace(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_ar
|
|||||||
if (general_index < wsmap->scr->workspace_count) {
|
if (general_index < wsmap->scr->workspace_count) {
|
||||||
/* updating label */
|
/* updating label */
|
||||||
WMSetLabelText(wsmap_array[local_index].workspace_label, wsmap->scr->workspaces[general_index]->name);
|
WMSetLabelText(wsmap_array[local_index].workspace_label, wsmap->scr->workspaces[general_index]->name);
|
||||||
snprintf(name, sizeof(name), "%d", general_index);
|
snprintf(name, sizeof(name), "%hu", general_index);
|
||||||
WMSetButtonText(wsmap_array[local_index].workspace_img_button, name);
|
WMSetButtonText(wsmap_array[local_index].workspace_img_button, name);
|
||||||
|
|
||||||
/* updating label background*/
|
/* updating label background*/
|
||||||
|
|||||||
@@ -410,3 +410,33 @@ WMPoint wGetPointToCenterRectInHead(WScreen * scr, int head, int width, int heig
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find the bounding rect of the union of two rectangles */
|
||||||
|
void wGetRectUnion(const WMRect *rect1, const WMRect *rect2, WMRect *dest)
|
||||||
|
{
|
||||||
|
int dest_x, dest_y;
|
||||||
|
int dest_w, dest_h;
|
||||||
|
|
||||||
|
dest_x = rect1->pos.x;
|
||||||
|
dest_y = rect1->pos.y;
|
||||||
|
dest_w = rect1->size.width;
|
||||||
|
dest_h = rect1->size.height;
|
||||||
|
|
||||||
|
if (rect2->pos.x < dest_x) {
|
||||||
|
dest_w += dest_x - rect2->pos.x;
|
||||||
|
dest_x = rect2->pos.x;
|
||||||
|
}
|
||||||
|
if (rect2->pos.y < dest_y) {
|
||||||
|
dest_h += dest_y - rect2->pos.y;
|
||||||
|
dest_y = rect2->pos.y;
|
||||||
|
}
|
||||||
|
if (rect2->pos.x + rect2->size.width > dest_x + dest_w)
|
||||||
|
dest_w = rect2->pos.x + rect2->size.width - dest_x;
|
||||||
|
if (rect2->pos.y + rect2->size.height > dest_y + dest_h)
|
||||||
|
dest_h = rect2->pos.y + rect2->size.height - dest_y;
|
||||||
|
|
||||||
|
dest->pos.x = dest_x;
|
||||||
|
dest->pos.y = dest_y;
|
||||||
|
dest->size.width = dest_w;
|
||||||
|
dest->size.height = dest_h;
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr, Bool no
|
|||||||
|
|
||||||
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
|
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
|
||||||
|
|
||||||
|
void wGetRectUnion(const WMRect *rect1, const WMRect *rect2, WMRect *dest);
|
||||||
|
|
||||||
Bool wWindowTouchesHead(WWindow *wwin, int head);
|
Bool wWindowTouchesHead(WWindow *wwin, int head);
|
||||||
Bool wAppIconTouchesHead(WAppIcon *aicon, int head);
|
Bool wAppIconTouchesHead(WAppIcon *aicon, int head);
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -36,6 +36,7 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
|
|||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
#include <WINGs/WINGsP.h>
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "xmodifier.h"
|
#include "xmodifier.h"
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ static void x_reset_modifier_mapping(Display * display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
code = x_modifier_keymap->modifiermap[modifier_index * mkpm + modifier_key];
|
code = x_modifier_keymap->modifiermap[modifier_index * mkpm + modifier_key];
|
||||||
sym = (code ? XkbKeycodeToKeysym(display, code, 0, column) : NoSymbol);
|
sym = W_KeycodeToKeysym(display, code, column);
|
||||||
|
|
||||||
if (sym == last_sym)
|
if (sym == last_sym)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+5
-2
@@ -70,10 +70,13 @@ wmmenugen_SOURCES = wmmenugen.c wmmenugen.h wmmenugen_misc.c \
|
|||||||
wmmenugen_parse_wmconfig.c \
|
wmmenugen_parse_wmconfig.c \
|
||||||
wmmenugen_parse_xdg.c
|
wmmenugen_parse_xdg.c
|
||||||
|
|
||||||
|
wmiv_CFLAGS = @PANGO_CFLAGS@ @PTHREAD_CFLAGS@
|
||||||
|
|
||||||
wmiv_LDADD = \
|
wmiv_LDADD = \
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@XLFLAGS@ @XLIBS@ \
|
$(top_builddir)/WINGs/libWINGs.la \
|
||||||
@GFXLIBS@ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBEXIF)
|
@XLFLAGS@ @XLIBS@ @GFXLIBS@ \
|
||||||
|
@PANGO_LIBS@ @PTHREAD_LIBS@ @LIBEXIF@
|
||||||
|
|
||||||
wmiv_SOURCES = wmiv.c wmiv.h
|
wmiv_SOURCES = wmiv.c wmiv.h
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ static void hackStyle(WMPropList * style)
|
|||||||
|
|
||||||
t = WMCreatePLArray(WMCreatePLString("solid"), value, NULL);
|
t = WMCreatePLArray(WMCreatePLString("solid"), value, NULL);
|
||||||
WMPutInPLDictionary(style, WMCreatePLString("ResizebarBack"), t);
|
WMPutInPLDictionary(style, WMCreatePLString("ResizebarBack"), t);
|
||||||
|
WMReleasePropList(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -379,8 +379,14 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
WMAddToPLArray(RMenu, L1Menu);
|
WMAddToPLArray(RMenu, L1Menu);
|
||||||
|
|
||||||
printf("%s", WMGetPropListDescription(RMenu, True));
|
wfree(tmp);
|
||||||
puts("");
|
wfree(theme_paths);
|
||||||
|
wfree(style_paths);
|
||||||
|
wfree(icon_paths);
|
||||||
|
|
||||||
|
tmp = WMGetPropListDescription(RMenu, True);
|
||||||
|
printf("%s\n", tmp);
|
||||||
|
wfree(tmp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -451,6 +457,7 @@ static void find_and_write(const char *group, char *list[][2], int this_is_termi
|
|||||||
WMAddToPLArray(L2Menu, L3Menu);
|
WMAddToPLArray(L2Menu, L3Menu);
|
||||||
wfree(t);
|
wfree(t);
|
||||||
}
|
}
|
||||||
|
wtokenfree(argv, argc);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (L2Menu)
|
if (L2Menu)
|
||||||
@@ -503,7 +510,7 @@ noreturn void print_help(int print_usage, int exitval)
|
|||||||
{
|
{
|
||||||
printf("Usage: %s [-h] [-v]\n", prog_name);
|
printf("Usage: %s [-h] [-v]\n", prog_name);
|
||||||
if (print_usage) {
|
if (print_usage) {
|
||||||
puts("Writes a menu structure usable as ~/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/WMRootMenu to stdout");
|
puts("Writes a menu structure usable as ~/" GSUSER_SUBDIR "/" DEFAULTS_SUBDIR "/WMRootMenu to stdout");
|
||||||
puts("");
|
puts("");
|
||||||
puts(" -h, --help display this help and exit");
|
puts(" -h, --help display this help and exit");
|
||||||
puts(" -v, --version output version information and exit");
|
puts(" -v, --version output version information and exit");
|
||||||
|
|||||||
+7
-6
@@ -22,11 +22,10 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#include <X11/XKBlib.h>
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include "wraster.h"
|
#include <WINGs/WINGsP.h>
|
||||||
|
#include <wraster.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -436,6 +435,7 @@ int zoom_in_out(int z)
|
|||||||
tmp->height + (int)(tmp->height * zoom_factor));
|
tmp->height + (int)(tmp->height * zoom_factor));
|
||||||
if (!img) {
|
if (!img) {
|
||||||
img = old_img;
|
img = old_img;
|
||||||
|
RReleaseImage(tmp);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -450,6 +450,7 @@ int zoom_in_out(int z)
|
|||||||
img = RScaleImage(tmp, new_width, new_height);
|
img = RScaleImage(tmp, new_width, new_height);
|
||||||
if (!img) {
|
if (!img) {
|
||||||
img = old_img;
|
img = old_img;
|
||||||
|
RReleaseImage(tmp);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -679,7 +680,7 @@ link_t *connect_dir(char *dirpath, linked_list_t *li)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int option = -1;
|
int option = -1;
|
||||||
RContextAttributes attr;
|
RContextAttributes attr = {};
|
||||||
XEvent e;
|
XEvent e;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
char *reading_filename = "";
|
char *reading_filename = "";
|
||||||
@@ -750,7 +751,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
dpy = XOpenDisplay(NULL);
|
dpy = XOpenDisplay(NULL);
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
fprintf(stderr, "Error: can't open display");
|
fprintf(stderr, "Error: can't open display\n");
|
||||||
linked_list_free(&list);
|
linked_list_free(&list);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -932,7 +933,7 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (e.type == KeyPress) {
|
if (e.type == KeyPress) {
|
||||||
keysym = XkbKeycodeToKeysym(dpy, e.xkey.keycode, 0, e.xkey.state & ShiftMask?1:0);
|
keysym = W_KeycodeToKeysym(dpy, e.xkey.keycode, e.xkey.state & ShiftMask?1:0);
|
||||||
#ifdef HAVE_PTHREAD
|
#ifdef HAVE_PTHREAD
|
||||||
if (keysym != XK_Right)
|
if (keysym != XK_Right)
|
||||||
diaporama_flag = False;
|
diaporama_flag = False;
|
||||||
|
|||||||
+24
-23
@@ -275,45 +275,46 @@ static void assemblePLMenuFunc(WMTreeNode *aNode, void *data)
|
|||||||
if (!wm->CmdLine) { /* new submenu */
|
if (!wm->CmdLine) { /* new submenu */
|
||||||
WMAddToArray(plMenuNodes, WMCreatePLArray(WMCreatePLString(wm->Name), NULL));
|
WMAddToArray(plMenuNodes, WMCreatePLArray(WMCreatePLString(wm->Name), NULL));
|
||||||
} else { /* new menu item */
|
} else { /* new menu item */
|
||||||
|
WMPropList *tmp1, *tmp2;
|
||||||
pl = WMPopFromArray(plMenuNodes);
|
pl = WMPopFromArray(plMenuNodes);
|
||||||
if (wm->Flags & F_RESTART_OTHER) { /* RESTART, somewm */
|
if (wm->Flags & F_RESTART_OTHER) { /* RESTART, somewm */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
WMPropList *tmp3;
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
snprintf(buf, sizeof(buf), "%s %s", _("Restart"), wm->Name);
|
snprintf(buf, sizeof(buf), "%s %s", _("Restart"), wm->Name);
|
||||||
WMAddToPLArray(pl, WMCreatePLArray(
|
|
||||||
WMCreatePLString(buf),
|
tmp1 = WMCreatePLString(buf);
|
||||||
WMCreatePLString("RESTART"),
|
tmp2 = WMCreatePLString("RESTART");
|
||||||
WMCreatePLString(wm->CmdLine),
|
tmp3 = WMCreatePLString(wm->CmdLine);
|
||||||
NULL)
|
WMAddToPLArray(pl, WMCreatePLArray(tmp1, tmp2, tmp3, NULL));
|
||||||
);
|
WMReleasePropList(tmp3);
|
||||||
} else if (wm->Flags & F_RESTART_SELF) {/* RESTART */
|
} else if (wm->Flags & F_RESTART_SELF) {/* RESTART */
|
||||||
WMAddToPLArray(pl, WMCreatePLArray(
|
tmp1 = WMCreatePLString(_("Restart Window Maker"));
|
||||||
WMCreatePLString(_("Restart Window Maker")),
|
tmp2 = WMCreatePLString("RESTART");
|
||||||
WMCreatePLString("RESTART"),
|
WMAddToPLArray(pl, WMCreatePLArray(tmp1, tmp2, NULL));
|
||||||
NULL)
|
|
||||||
);
|
|
||||||
} else if (wm->Flags & F_QUIT) { /* EXIT */
|
} else if (wm->Flags & F_QUIT) { /* EXIT */
|
||||||
WMAddToPLArray(pl, WMCreatePLArray(
|
tmp1 = WMCreatePLString(_("Exit Window Maker"));
|
||||||
WMCreatePLString(_("Exit Window Maker")),
|
tmp2 = WMCreatePLString("EXIT");
|
||||||
WMCreatePLString("EXIT"),
|
WMAddToPLArray(pl, WMCreatePLArray(tmp1, tmp2, NULL));
|
||||||
NULL)
|
|
||||||
);
|
|
||||||
} else { /* plain simple command */
|
} else { /* plain simple command */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
WMPropList *tmp3;
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
if (wm->Flags & F_TERMINAL) /* XXX: quoting! */
|
if (wm->Flags & F_TERMINAL) /* XXX: quoting! */
|
||||||
snprintf(buf, sizeof(buf), "%s -e \"%s\"", terminal, wm->CmdLine);
|
snprintf(buf, sizeof(buf), "%s -e \"%s\"", terminal, wm->CmdLine);
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "%s", wm->CmdLine);
|
snprintf(buf, sizeof(buf), "%s", wm->CmdLine);
|
||||||
|
tmp1 = WMCreatePLString(wm->Name);
|
||||||
WMAddToPLArray(pl, WMCreatePLArray(
|
tmp2 = WMCreatePLString("SHEXEC");
|
||||||
WMCreatePLString(wm->Name),
|
tmp3 = WMCreatePLString(buf);
|
||||||
WMCreatePLString("SHEXEC"),
|
WMAddToPLArray(pl, WMCreatePLArray(tmp1, tmp2, tmp3, NULL));
|
||||||
WMCreatePLString(buf),
|
WMReleasePropList(tmp3);
|
||||||
NULL)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
WMReleasePropList(tmp1);
|
||||||
|
WMReleasePropList(tmp2);
|
||||||
|
|
||||||
WMAddToArray(plMenuNodes, pl);
|
WMAddToArray(plMenuNodes, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -505,7 +505,15 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
|
|||||||
iheight = image->height;
|
iheight = image->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
GETSTRORGOTO(val, tmp, 2, error);
|
/* cannot use GETSTRORGOTO() here
|
||||||
|
* as we have to free image in case of error */
|
||||||
|
val = WMGetFromPLArray(texarray, 2);
|
||||||
|
if (!WMIsPLString(val)) {
|
||||||
|
wwarning("could not parse texture %s", text);
|
||||||
|
RReleaseImage(image);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
tmp = WMGetFromPLString(val);
|
||||||
|
|
||||||
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
|
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
|
||||||
wwarning("could not parse color %s in texture %s", tmp, text);
|
wwarning("could not parse color %s in texture %s", tmp, text);
|
||||||
@@ -898,6 +906,7 @@ static noreturn void helperLoop(RContext * rc)
|
|||||||
int errcount = 4;
|
int errcount = 4;
|
||||||
|
|
||||||
memset(textures, 0, WORKSPACE_COUNT * sizeof(BackgroundTexture *));
|
memset(textures, 0, WORKSPACE_COUNT * sizeof(BackgroundTexture *));
|
||||||
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int workspace = -1;
|
int workspace = -1;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
- added RSaveTitledImage()
|
||||||
|
|
||||||
- removed obsoleted RDestroyImage()
|
- removed obsoleted RDestroyImage()
|
||||||
- removed Hermes code.
|
- removed Hermes code.
|
||||||
- Put back asm/mmx optimized code.
|
- Put back asm/mmx optimized code.
|
||||||
|
|||||||
@@ -55,10 +55,12 @@ endif
|
|||||||
|
|
||||||
if USE_JPEG
|
if USE_JPEG
|
||||||
libwraster_la_SOURCES += load_jpeg.c
|
libwraster_la_SOURCES += load_jpeg.c
|
||||||
|
libwraster_la_SOURCES += save_jpeg.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_PNG
|
if USE_PNG
|
||||||
libwraster_la_SOURCES += load_png.c
|
libwraster_la_SOURCES += load_png.c
|
||||||
|
libwraster_la_SOURCES += save_png.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_TIFF
|
if USE_TIFF
|
||||||
|
|||||||
+14
-2
@@ -1,8 +1,20 @@
|
|||||||
** API and ABI modifications since wmaker 0.92.0
|
** API and ABI modifications
|
||||||
|
----------------------------------------------------
|
||||||
|
Since wmaker 0.96.0
|
||||||
|
|
||||||
|
Sat 25 Feb 2023
|
||||||
|
|
||||||
|
RSaveImage: Improved
|
||||||
|
Able to save image on disk as PNG or JPEG file
|
||||||
|
|
||||||
|
RSaveTitledImage: Added
|
||||||
|
Image title can be set on the image to be saved
|
||||||
|
|
||||||
|
----------------------------------------------------
|
||||||
|
Since wmaker 0.92.0
|
||||||
|
|
||||||
RLightImage: ADDED
|
RLightImage: ADDED
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
|
||||||
Sat Apr 21 09:12:09 EEST 2001 -Dan
|
Sat Apr 21 09:12:09 EEST 2001 -Dan
|
||||||
|
|||||||
@@ -627,6 +627,10 @@ static RXImage *image2StandardPseudoColor(RContext * ctx, RImage * image)
|
|||||||
RDestroyXImage(ctx, ximg);
|
RDestroyXImage(ctx, ximg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(err, 0, 3 * (image->width + 2) * sizeof(short));
|
||||||
|
memset(nerr, 0, 3 * (image->width + 2) * sizeof(short));
|
||||||
|
|
||||||
for (x = 0, x1 = 0; x < image->width * 3; x1 += channels - 3) {
|
for (x = 0, x1 = 0; x < image->width * 3; x1 += channels - 3) {
|
||||||
err[x++] = ptr[x1++];
|
err[x++] = ptr[x1++];
|
||||||
err[x++] = ptr[x1++];
|
err[x++] = ptr[x1++];
|
||||||
@@ -778,6 +782,10 @@ static RXImage *image2GrayScale(RContext * ctx, RImage * image)
|
|||||||
RDestroyXImage(ctx, ximg);
|
RDestroyXImage(ctx, ximg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(gerr, 0, (image->width + 2) * sizeof(short));
|
||||||
|
memset(ngerr, 0, (image->width + 2) * sizeof(short));
|
||||||
|
|
||||||
for (x = 0, y = 0; x < image->width; x++, y += channels) {
|
for (x = 0, y = 0; x < image->width; x++, y += channels) {
|
||||||
gerr[x] = (ptr[y] * 30 + ptr[y + 1] * 59 + ptr[y + 2] * 11) / 100;
|
gerr[x] = (ptr[y] * 30 + ptr[y + 1] * 59 + ptr[y + 2] * 11) / 100;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-2
@@ -29,7 +29,6 @@
|
|||||||
#ifndef IMGFORMAT_INTERNAL_H
|
#ifndef IMGFORMAT_INTERNAL_H
|
||||||
#define IMGFORMAT_INTERNAL_H
|
#define IMGFORMAT_INTERNAL_H
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IM_ERROR = -1,
|
IM_ERROR = -1,
|
||||||
IM_UNKNOWN = 0,
|
IM_UNKNOWN = 0,
|
||||||
@@ -82,8 +81,15 @@ void RReleaseMagick(void);
|
|||||||
/*
|
/*
|
||||||
* Function for Saving in a specific format
|
* Function for Saving in a specific format
|
||||||
*/
|
*/
|
||||||
Bool RSaveXPM(RImage *image, const char *file);
|
Bool RSaveXPM(RImage *image, const char *filename);
|
||||||
|
|
||||||
|
#ifdef USE_PNG
|
||||||
|
Bool RSavePNG(RImage *image, const char *filename, char *title);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_JPEG
|
||||||
|
Bool RSaveJPEG(RImage *image, const char *filename, char *title);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to terminate properly
|
* Function to terminate properly
|
||||||
|
|||||||
+74
-69
@@ -95,19 +95,13 @@ static noreturn void my_error_exit(j_common_ptr cinfo)
|
|||||||
longjmp(myerr->setjmp_buffer, 1);
|
longjmp(myerr->setjmp_buffer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RImage *RLoadJPEG(const char *file_name)
|
static RImage *do_read_jpeg_file(struct jpeg_decompress_struct *cinfo, const char *file_name)
|
||||||
{
|
{
|
||||||
RImage *image = NULL;
|
RImage *image = NULL;
|
||||||
struct jpeg_decompress_struct cinfo;
|
|
||||||
int i;
|
int i;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
JSAMPROW buffer[1], bptr;
|
JSAMPROW buffer[1], bptr;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
/* We use our private extension JPEG error handler.
|
|
||||||
* Note that this struct must live as long as the main JPEG parameter
|
|
||||||
* struct, to avoid dangling-pointer problems.
|
|
||||||
*/
|
|
||||||
struct my_error_mgr jerr;
|
|
||||||
|
|
||||||
file = fopen(file_name, "rb");
|
file = fopen(file_name, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
@@ -115,6 +109,78 @@ RImage *RLoadJPEG(const char *file_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jpeg_create_decompress(cinfo);
|
||||||
|
jpeg_stdio_src(cinfo, file);
|
||||||
|
jpeg_read_header(cinfo, TRUE);
|
||||||
|
|
||||||
|
if (cinfo->image_width < 1 || cinfo->image_height < 1) {
|
||||||
|
buffer[0] = NULL; /* Initialize pointer to avoid spurious free in cleanup code */
|
||||||
|
RErrorCode = RERR_BADIMAGEFILE;
|
||||||
|
goto abort_and_release_resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[0] = (JSAMPROW) malloc(cinfo->image_width * cinfo->num_components);
|
||||||
|
if (!buffer[0]) {
|
||||||
|
RErrorCode = RERR_NOMEMORY;
|
||||||
|
goto abort_and_release_resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cinfo->jpeg_color_space == JCS_GRAYSCALE)
|
||||||
|
cinfo->out_color_space = JCS_GRAYSCALE;
|
||||||
|
else
|
||||||
|
cinfo->out_color_space = JCS_RGB;
|
||||||
|
|
||||||
|
cinfo->quantize_colors = FALSE;
|
||||||
|
cinfo->do_fancy_upsampling = FALSE;
|
||||||
|
cinfo->do_block_smoothing = FALSE;
|
||||||
|
jpeg_calc_output_dimensions(cinfo);
|
||||||
|
image = RCreateImage(cinfo->image_width, cinfo->image_height, False);
|
||||||
|
if (!image) {
|
||||||
|
RErrorCode = RERR_NOMEMORY;
|
||||||
|
goto abort_and_release_resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
jpeg_start_decompress(cinfo);
|
||||||
|
ptr = image->data;
|
||||||
|
if (cinfo->out_color_space == JCS_RGB) {
|
||||||
|
while (cinfo->output_scanline < cinfo->output_height) {
|
||||||
|
jpeg_read_scanlines(cinfo, buffer, (JDIMENSION) 1);
|
||||||
|
bptr = buffer[0];
|
||||||
|
memcpy(ptr, bptr, cinfo->image_width * 3);
|
||||||
|
ptr += cinfo->image_width * 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (cinfo->output_scanline < cinfo->output_height) {
|
||||||
|
jpeg_read_scanlines(cinfo, buffer, (JDIMENSION) 1);
|
||||||
|
bptr = buffer[0];
|
||||||
|
for (i = 0; i < cinfo->image_width; i++) {
|
||||||
|
*ptr++ = *bptr;
|
||||||
|
*ptr++ = *bptr;
|
||||||
|
*ptr++ = *bptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jpeg_finish_decompress(cinfo);
|
||||||
|
|
||||||
|
abort_and_release_resources:
|
||||||
|
jpeg_destroy_decompress(cinfo);
|
||||||
|
fclose(file);
|
||||||
|
if (buffer[0])
|
||||||
|
free(buffer[0]);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
RImage *RLoadJPEG(const char *file_name)
|
||||||
|
{
|
||||||
|
struct jpeg_decompress_struct cinfo;
|
||||||
|
/* We use our private extension JPEG error handler.
|
||||||
|
* Note that this struct must live as long as the main
|
||||||
|
* JPEG parameter struct, to avoid dangling-pointer problems.
|
||||||
|
*/
|
||||||
|
struct my_error_mgr jerr;
|
||||||
|
|
||||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||||
jerr.pub.error_exit = my_error_exit;
|
jerr.pub.error_exit = my_error_exit;
|
||||||
/* Establish the setjmp return context for my_error_exit to use. */
|
/* Establish the setjmp return context for my_error_exit to use. */
|
||||||
@@ -124,68 +190,7 @@ RImage *RLoadJPEG(const char *file_name)
|
|||||||
* We need to clean up the JPEG object, close the input file, and return.
|
* We need to clean up the JPEG object, close the input file, and return.
|
||||||
*/
|
*/
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(&cinfo);
|
||||||
fclose(file);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return do_read_jpeg_file(&cinfo, file_name);
|
||||||
jpeg_create_decompress(&cinfo);
|
|
||||||
jpeg_stdio_src(&cinfo, file);
|
|
||||||
jpeg_read_header(&cinfo, TRUE);
|
|
||||||
if (cinfo.image_width < 1 || cinfo.image_height < 1) {
|
|
||||||
buffer[0] = NULL; /* Initialize pointer to avoid spurious free in cleanup code */
|
|
||||||
RErrorCode = RERR_BADIMAGEFILE;
|
|
||||||
goto abort_and_release_resources;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[0] = (JSAMPROW) malloc(cinfo.image_width * cinfo.num_components);
|
|
||||||
if (!buffer[0]) {
|
|
||||||
RErrorCode = RERR_NOMEMORY;
|
|
||||||
goto abort_and_release_resources;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cinfo.jpeg_color_space == JCS_GRAYSCALE)
|
|
||||||
cinfo.out_color_space = JCS_GRAYSCALE;
|
|
||||||
else
|
|
||||||
cinfo.out_color_space = JCS_RGB;
|
|
||||||
|
|
||||||
cinfo.quantize_colors = FALSE;
|
|
||||||
cinfo.do_fancy_upsampling = FALSE;
|
|
||||||
cinfo.do_block_smoothing = FALSE;
|
|
||||||
jpeg_calc_output_dimensions(&cinfo);
|
|
||||||
image = RCreateImage(cinfo.image_width, cinfo.image_height, False);
|
|
||||||
if (!image) {
|
|
||||||
RErrorCode = RERR_NOMEMORY;
|
|
||||||
goto abort_and_release_resources;
|
|
||||||
}
|
|
||||||
|
|
||||||
jpeg_start_decompress(&cinfo);
|
|
||||||
ptr = image->data;
|
|
||||||
if (cinfo.out_color_space == JCS_RGB) {
|
|
||||||
while (cinfo.output_scanline < cinfo.output_height) {
|
|
||||||
jpeg_read_scanlines(&cinfo, buffer, (JDIMENSION) 1);
|
|
||||||
bptr = buffer[0];
|
|
||||||
memcpy(ptr, bptr, cinfo.image_width * 3);
|
|
||||||
ptr += cinfo.image_width * 3;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (cinfo.output_scanline < cinfo.output_height) {
|
|
||||||
jpeg_read_scanlines(&cinfo, buffer, (JDIMENSION) 1);
|
|
||||||
bptr = buffer[0];
|
|
||||||
for (i = 0; i < cinfo.image_width; i++) {
|
|
||||||
*ptr++ = *bptr;
|
|
||||||
*ptr++ = *bptr;
|
|
||||||
*ptr++ = *bptr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jpeg_finish_decompress(&cinfo);
|
|
||||||
|
|
||||||
abort_and_release_resources:
|
|
||||||
jpeg_destroy_decompress(&cinfo);
|
|
||||||
fclose(file);
|
|
||||||
if (buffer[0])
|
|
||||||
free(buffer[0]);
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-5
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <tiff.h>
|
#include <tiff.h>
|
||||||
#include <tiffio.h>
|
#include <tiffio.h>
|
||||||
|
#include <tiffvers.h>
|
||||||
|
|
||||||
#include "wraster.h"
|
#include "wraster.h"
|
||||||
#include "imgformat.h"
|
#include "imgformat.h"
|
||||||
@@ -38,14 +39,19 @@ RImage *RLoadTIFF(const char *file, int index)
|
|||||||
{
|
{
|
||||||
RImage *image = NULL;
|
RImage *image = NULL;
|
||||||
TIFF *tif;
|
TIFF *tif;
|
||||||
int i;
|
int i, ch;
|
||||||
unsigned char *r, *g, *b, *a;
|
unsigned char *r, *g, *b, *a;
|
||||||
uint16 alpha, amode;
|
#if TIFFLIB_VERSION < 20210416
|
||||||
|
uint16 alpha, amode, extrasamples;
|
||||||
|
uint16 *sampleinfo;
|
||||||
uint32 width, height;
|
uint32 width, height;
|
||||||
uint32 *data, *ptr;
|
uint32 *data, *ptr;
|
||||||
uint16 extrasamples;
|
#else
|
||||||
uint16 *sampleinfo;
|
uint16_t alpha, amode, extrasamples;;
|
||||||
int ch;
|
uint16_t *sampleinfo;
|
||||||
|
uint32_t width, height;
|
||||||
|
uint32_t *data, *ptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
tif = TIFFOpen(file, "r");
|
tif = TIFFOpen(file, "r");
|
||||||
if (!tif)
|
if (!tif)
|
||||||
@@ -79,7 +85,11 @@ RImage *RLoadTIFF(const char *file, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read data */
|
/* read data */
|
||||||
|
#if TIFFLIB_VERSION < 20210416
|
||||||
ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32));
|
ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32));
|
||||||
|
#else
|
||||||
|
ptr = data = (uint32_t *) _TIFFmalloc(width * height * sizeof(uint32_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
RErrorCode = RERR_NOMEMORY;
|
RErrorCode = RERR_NOMEMORY;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ POTFILES = \
|
|||||||
$(top_srcdir)/wrlib/rotate.c \
|
$(top_srcdir)/wrlib/rotate.c \
|
||||||
$(top_srcdir)/wrlib/flip.c \
|
$(top_srcdir)/wrlib/flip.c \
|
||||||
$(top_srcdir)/wrlib/convolve.c \
|
$(top_srcdir)/wrlib/convolve.c \
|
||||||
|
$(top_srcdir)/wrlib/save_jpeg.c \
|
||||||
|
$(top_srcdir)/wrlib/save_png.c \
|
||||||
$(top_srcdir)/wrlib/save_xpm.c \
|
$(top_srcdir)/wrlib/save_xpm.c \
|
||||||
$(top_srcdir)/wrlib/xutil.c \
|
$(top_srcdir)/wrlib/xutil.c \
|
||||||
$(top_srcdir)/wrlib/load_ppm.c \
|
$(top_srcdir)/wrlib/load_ppm.c \
|
||||||
|
|||||||
+23
-8
@@ -3,6 +3,7 @@
|
|||||||
* Raster graphics library
|
* Raster graphics library
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2003 Alfredo K. Kojima
|
* Copyright (c) 1998-2003 Alfredo K. Kojima
|
||||||
|
* Copyright (c) 2013-2023 Window Maker Team
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
@@ -29,18 +30,32 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "wraster.h"
|
#include "wraster.h"
|
||||||
#include "imgformat.h"
|
#include "imgformat.h"
|
||||||
#include "wr_i18n.h"
|
#include "wr_i18n.h"
|
||||||
|
|
||||||
|
Bool RSaveImage(RImage *image, const char *filename, const char *format)
|
||||||
Bool RSaveImage(RImage * image, const char *filename, const char *format)
|
|
||||||
{
|
{
|
||||||
if (strcmp(format, "XPM") != 0) {
|
return RSaveTitledImage(image, filename, format, NULL);
|
||||||
RErrorCode = RERR_BADFORMAT;
|
}
|
||||||
return False;
|
|
||||||
}
|
Bool RSaveTitledImage(RImage *image, const char *filename, const char *format, char *title)
|
||||||
return RSaveXPM(image, filename);
|
{
|
||||||
|
#ifdef USE_PNG
|
||||||
|
if (strcasecmp(format, "PNG") == 0)
|
||||||
|
return RSavePNG(image, filename, title);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_JPEG
|
||||||
|
if (strcasecmp(format, "JPG") == 0)
|
||||||
|
return RSaveJPEG(image, filename, title);
|
||||||
|
|
||||||
|
if (strcasecmp(format, "JPEG") == 0)
|
||||||
|
return RSaveJPEG(image, filename, title);
|
||||||
|
#endif
|
||||||
|
if (strcasecmp(format, "XPM") == 0)
|
||||||
|
return RSaveXPM(image, filename);
|
||||||
|
|
||||||
|
RErrorCode = RERR_BADFORMAT;
|
||||||
|
return False;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/* save_jpeg.c - save JPEG image
|
||||||
|
*
|
||||||
|
* Raster graphics library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Window Maker Team
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <jpeglib.h>
|
||||||
|
|
||||||
|
#include "wraster.h"
|
||||||
|
#include "imgformat.h"
|
||||||
|
#include "wr_i18n.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save RImage to JPEG image
|
||||||
|
*/
|
||||||
|
|
||||||
|
Bool RSaveJPEG(RImage *img, const char *filename, char *title)
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
int x, y, img_depth;
|
||||||
|
char *buffer;
|
||||||
|
RColor pixel;
|
||||||
|
struct jpeg_compress_struct cinfo;
|
||||||
|
struct jpeg_error_mgr jerr;
|
||||||
|
JSAMPROW row_pointer;
|
||||||
|
|
||||||
|
file = fopen(filename, "wb");
|
||||||
|
if (!file) {
|
||||||
|
RErrorCode = RERR_OPEN;
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (img->format == RRGBAFormat)
|
||||||
|
img_depth = 4;
|
||||||
|
else
|
||||||
|
img_depth = 3;
|
||||||
|
|
||||||
|
/* collect separate RGB values to a buffer */
|
||||||
|
buffer = malloc(sizeof(char) * 3 * img->width * img->height);
|
||||||
|
for (y = 0; y < img->height; y++) {
|
||||||
|
for (x = 0; x < img->width; x++) {
|
||||||
|
RGetPixel(img, x, y, &pixel);
|
||||||
|
buffer[y*img->width*3+x*3+0] = (char)(pixel.red);
|
||||||
|
buffer[y*img->width*3+x*3+1] = (char)(pixel.green);
|
||||||
|
buffer[y*img->width*3+x*3+2] = (char)(pixel.blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Exception handling */
|
||||||
|
cinfo.err = jpeg_std_error(&jerr);
|
||||||
|
|
||||||
|
/* Initialize cinfo structure */
|
||||||
|
jpeg_create_compress(&cinfo);
|
||||||
|
jpeg_stdio_dest(&cinfo, file);
|
||||||
|
|
||||||
|
cinfo.image_width = img->width;
|
||||||
|
cinfo.image_height = img->height;
|
||||||
|
cinfo.input_components = 3;
|
||||||
|
cinfo.in_color_space = JCS_RGB;
|
||||||
|
|
||||||
|
jpeg_set_defaults(&cinfo);
|
||||||
|
jpeg_set_quality(&cinfo, 85, TRUE);
|
||||||
|
jpeg_start_compress(&cinfo, TRUE);
|
||||||
|
|
||||||
|
/* Set title if any */
|
||||||
|
if (title)
|
||||||
|
jpeg_write_marker(&cinfo, JPEG_COM, (const JOCTET*)title, strlen(title));
|
||||||
|
|
||||||
|
while (cinfo.next_scanline < cinfo.image_height) {
|
||||||
|
row_pointer = (JSAMPROW) &buffer[cinfo.next_scanline * img_depth * img->width];
|
||||||
|
jpeg_write_scanlines(&cinfo, &row_pointer, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
jpeg_finish_compress(&cinfo);
|
||||||
|
|
||||||
|
/* Clean */
|
||||||
|
free(buffer);
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/* save_png.c - save PNG image
|
||||||
|
*
|
||||||
|
* Raster graphics library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Window Maker Team
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <png.h>
|
||||||
|
|
||||||
|
#include "wraster.h"
|
||||||
|
#include "imgformat.h"
|
||||||
|
#include "wr_i18n.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save RImage to PNG image
|
||||||
|
*/
|
||||||
|
Bool RSavePNG(RImage *img, const char *filename, char *title)
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
png_structp png_ptr;
|
||||||
|
png_infop png_info_ptr;
|
||||||
|
png_bytep png_row;
|
||||||
|
RColor pixel;
|
||||||
|
int x, y;
|
||||||
|
int width = img->width;
|
||||||
|
int height = img->height;
|
||||||
|
|
||||||
|
file = fopen(filename, "wb");
|
||||||
|
if (file == NULL) {
|
||||||
|
RErrorCode = RERR_OPEN;
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize write structure */
|
||||||
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
if (png_ptr == NULL) {
|
||||||
|
fclose(file);
|
||||||
|
RErrorCode = RERR_NOMEMORY;
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize info structure */
|
||||||
|
png_info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
if (png_info_ptr == NULL) {
|
||||||
|
fclose(file);
|
||||||
|
RErrorCode = RERR_NOMEMORY;
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Exception handling */
|
||||||
|
if (setjmp(png_jmpbuf (png_ptr))) {
|
||||||
|
fclose(file);
|
||||||
|
RErrorCode = RERR_INTERNAL;
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
png_init_io(png_ptr, file);
|
||||||
|
|
||||||
|
/* Write header (8 bit colour depth) */
|
||||||
|
png_set_IHDR(png_ptr, png_info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB,
|
||||||
|
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
||||||
|
PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
|
/* Set title if any */
|
||||||
|
if (title) {
|
||||||
|
png_text title_text;
|
||||||
|
title_text.compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
|
title_text.key = "Title";
|
||||||
|
title_text.text = title;
|
||||||
|
png_set_text(png_ptr, png_info_ptr, &title_text, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
png_write_info(png_ptr, png_info_ptr);
|
||||||
|
|
||||||
|
/* Allocate memory for one row (3 bytes per pixel - RGB) */
|
||||||
|
png_row = (png_bytep) malloc(3 * width * sizeof(png_byte));
|
||||||
|
|
||||||
|
/* Write image data */
|
||||||
|
for (y = 0; y < height; y++) {
|
||||||
|
for (x = 0; x < width; x++) {
|
||||||
|
png_byte *ptr;
|
||||||
|
|
||||||
|
RGetPixel(img, x, y, &pixel);
|
||||||
|
ptr = &(png_row[x * 3]);
|
||||||
|
ptr[0] = pixel.red;
|
||||||
|
ptr[1] = pixel.green;
|
||||||
|
ptr[2] = pixel.blue;
|
||||||
|
}
|
||||||
|
png_write_row(png_ptr, png_row);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End write */
|
||||||
|
png_write_end(png_ptr, NULL);
|
||||||
|
|
||||||
|
/* Clean */
|
||||||
|
fclose(file);
|
||||||
|
if (png_info_ptr != NULL)
|
||||||
|
png_free_data(png_ptr, png_info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
if (png_row != NULL)
|
||||||
|
free(png_row);
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* nxpm.c - load "normalized" XPM image
|
/* save_xpm.c - save "normalized" XPM image
|
||||||
*
|
*
|
||||||
* Raster graphics library
|
* Raster graphics library
|
||||||
*
|
*
|
||||||
|
|||||||
+4
-1
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* version of the header for the library */
|
/* version of the header for the library */
|
||||||
#define WRASTER_HEADER_VERSION 24
|
#define WRASTER_HEADER_VERSION 25
|
||||||
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@@ -391,6 +391,9 @@ RImage *RGetImageFromXPMData(RContext *context, char **xpmData)
|
|||||||
Bool RSaveImage(RImage *image, const char *filename, const char *format)
|
Bool RSaveImage(RImage *image, const char *filename, const char *format)
|
||||||
__wrlib_nonnull(1, 2, 3);
|
__wrlib_nonnull(1, 2, 3);
|
||||||
|
|
||||||
|
Bool RSaveTitledImage(RImage *image, const char *filename, const char *format, char *title)
|
||||||
|
__wrlib_nonnull(1, 2, 3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Area manipulation
|
* Area manipulation
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user