1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-26 06:43:32 +01:00

14 Commits

Author SHA1 Message Date
David
7b317a5fba wmiv: use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XkbKeycodeToKeysym in wmiv by our
own function W_KeycodeToKeysym.
2023-02-28 03:33:21 +00:00
David Maciejak
9f8dc6f5dc Use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XkbKeycodeToKeysym by our
own function W_KeycodeToKeysym.
2023-02-27 23:05:27 +00:00
David Maciejak
bc56db0776 WPrefs: use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XKeycodeToKeysym and XkbKeycodeToKeysym
in WPrefs by our own function W_KeycodeToKeysym.
2023-02-27 23:05:27 +00:00
David Maciejak
15d06ff064 WINGs: Add W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls
XKeycodeToKeysym was deprecated some time ago and we replaced
those function calls to XkbKeycodeToKeysym.
Usage of XkbKeycodeToKeysym is not the best as it appears
the XKEYBOARD can be disabled via xorg.conf (at least on Linux).
So just replacing XKeycodeToKeysym() with XkbKeycodeToKeysym()
could cause run-time errors on top of the compilation warning
we may have.
Better fix is to address the problem without introducing a
dependency on XKEYBOARD. W_KeycodeToKeysym is the equivalent
code for XKeycodeToKeysym/XkbKeycodeToKeysym using
XGetKeyboardMapping instead.

As a new function is added to the library WINGs library version
is bumped.
2023-02-27 22:37:44 +00:00
David Maciejak
2dd98666f1 Store window maximize state as hex value
As the maximize state is defined as a bit-field internally.
Better to store the flag in the WMSTATE file as hex value.
2023-02-27 22:37:44 +00:00
David Maciejak
d1a7db8aea Compile by default with POSIX 7 revision
Compile by default with POSIX-2008 standard for Linux and FreeBSD.
2023-02-27 22:37:44 +00:00
David Maciejak
64a8ecb390 Code cleaning: removing trailing space
The patch is removing trailing space(s) before
the semicolon ending line. .c and .h files were checked.
2023-02-27 22:37:44 +00:00
David Maciejak
a9e336256b Doc: add disable-res description 2023-02-26 11:02:46 +00:00
David Maciejak
e9b20b51e9 WPrefs: check if captured keyboard shortcut is not in use
Make sure the captured keyboard shortcut is not already in use
by another action, if it's the case an error popup is shown and
the key is not kept.
2023-02-25 13:31:42 +00:00
David Maciejak
1d8b38b6e0 Fix compiler warnings from texture.c v2
The patch fixes those 2 warnings below from texture.c.
It reverts the previous v1 patch and fixes the compiler warning
by updating the texture.h wTextureMakeIGradient header instead.

texture.c:205:81: warning: argument 3 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  205 | WTexIGradient *wTextureMakeIGradient(WScreen *scr, int thickness1, const RColor colors1[2],
      |                                                                    ~~~~~~~~~~~~~^~~~~~~~~~
In file included from texture.c:33:
texture.h:165:53: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |                                                     ^~~~~~~~~~~~~~
texture.c:206:67: warning: argument 5 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  206 |                                      int thickness2, const RColor colors2[2])
      |                                                      ~~~~~~~~~~~~~^~~~~~~~~~
texture.h:165:74: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |
2023-02-25 13:31:42 +00:00
David Maciejak
82ad19d420 Fix compiler warnings from texture.c
The patch fixes those 2 warnings below from texture.c

texture.c:205:81: warning: argument 3 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  205 | WTexIGradient *wTextureMakeIGradient(WScreen *scr, int thickness1, const RColor colors1[2],
      |                                                                    ~~~~~~~~~~~~~^~~~~~~~~~
In file included from texture.c:33:
texture.h:165:53: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |                                                     ^~~~~~~~~~~~~~
texture.c:206:67: warning: argument 5 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  206 |                                      int thickness2, const RColor colors2[2])
      |                                                      ~~~~~~~~~~~~~^~~~~~~~~~
texture.h:165:74: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |
2023-02-24 12:19:38 +00:00
David Maciejak
492b22d975 Fix compiler warning from menu.c
The patch fixes the compiler warning below

menu.c: In function 'restoreMenuRecurs':
menu.c:2450:47: warning: '%s' directive output may be truncated writing up to 510 bytes into a region of size between 509 and 1019 [-Wformat-truncation=]
 2450 |         snprintf(buffer, sizeof(buffer), "%s\\%s", path, menu->frame->title);
      |                                               ^~

The code is taking care of checking properly the string passed to the buffer,
so there is no issue, the change is just to make the compiler happy.
2023-02-24 12:19:38 +00:00
David Maciejak
62405fbb75 Detect and override illegal window size hints v2
The patch is trying to mitigate and properly address the issue described at
https://github.com/window-maker/wmaker/issues/26
A buggy application (in that example virtualbox) is requesting a window size creation
that is way too big and basically at the limit of X11 protocol
(width and height are defined as CARD16).
See details at https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html
During the tests, virtualbox has been seen requesting for window creation of size 843x65508.
Even xprop is reporting incorrect values.

There had been an attempt before with the commit
https://repo.or.cz/wmaker-crm.git?a=commit;h=6668715402a5d8e2ecda6702076a06bf8988721e

But the patch is broken and not implemented at the right place.
As described in the wWindowConfigure function header, the size passed by the client app
should not be trusted and should be vetted with a prior call to wWindowConstrainSize.
wWindowConstrainSize call was missing only once in the wClientConfigure function from client.c
What wWindowConstrainSize doing now is basically setting a failsafe window size fo 640x480
if both width and height are above the size of CARD16.
If only one dimension is oversized, it's setting a default 4/3 window ratio.
Oversized here has not been changed and it's defined in windowmaker as double the screen size.
2023-02-22 20:10:31 +00:00
David Maciejak
f1fef40f0d Make window maximize state persistent
Window maximize state is not persistent between windowmaker sessions.
This patch is updating the save and restore workspace state functions
to update the state in the WMSTATE file.
2023-02-21 18:16:35 +00:00
27 changed files with 181 additions and 64 deletions

View File

@@ -1,3 +1,9 @@
Changes since wmaker 0.95.10:
............................
- added W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls
Changes since wmaker 0.92.0:
............................

View File

@@ -1,7 +1,9 @@
** API and ABI modifications since wmaker 0.92.0
** API and ABI modifications since wmaker 0.95.10
----------------------------------------------------
** libWINGs **
<WINGsP.h>
W_KeycodeToKeysym ADDED
struct W_DragDestinationInfo: new members added SIZE CHANGE
<WINGs.h>

View File

@@ -26,7 +26,7 @@
#include <WINGs/WUtil.h>
#include <X11/Xlib.h>
#define WINGS_H_VERSION 20210726
#define WINGS_H_VERSION 20230226
#ifdef __cplusplus

View File

@@ -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 buflen, KeySym *keysym, Status *status);
KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index);
/* ---[ wmisc.c ]--------------------------------------------------------- */

View File

@@ -612,7 +612,7 @@ static void menu_parser_condition_ifmacro(WMenuParser parser, Bool check_exists)
macro = menu_parser_find_macro(parser, macro_name);
parser->cond.stack[0].skip =
((check_exists) && (macro == NULL)) ||
((!check_exists) && (macro != NULL)) ;
((!check_exists) && (macro != NULL));
}
strcpy(parser->cond.stack[0].name, cmd_name);

View File

@@ -279,7 +279,8 @@ WParserMacro *menu_parser_find_macro(WMenuParser parser, const char *name)
continue;
return macro;
check_next_macro: ;
check_next_macro:
;
}
return NULL;
}

View File

@@ -213,3 +213,35 @@ int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer, int bufl
#endif
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;
if (min_kc == -1) {
(void) 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;
}

View File

@@ -622,7 +622,7 @@ static void paintText(Text * tPtr)
TextBlock *tb;
WMFont *font;
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;
Display *dpy = tPtr->view->screen->display;
Window win = tPtr->view->window;

View File

@@ -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->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth /*+ 2 */ ;
tPtr->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth;
}
static char *makeHiddenString(int length)

View File

@@ -317,11 +317,8 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
if (ev.type == KeyPress && ev.xkey.keycode != 0) {
numlock_mask = NumLockMask(dpy);
if (xext_xkb_supported)
/* conditional mask check to get numeric keypad keys */
ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0);
else
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0);
/* conditional mask check to get numeric keypad keys */
ksym = W_KeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0);
if (!IsModifierKey(ksym)) {
if (convert_case) {
@@ -369,6 +366,36 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
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)
{
_Panel *panel = (_Panel *) data;
@@ -383,17 +410,31 @@ static void captureClick(WMWidget * w, void *data)
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime);
shortcut = capture_shortcut(dpy, &panel->capturing, 1);
if (shortcut) {
int key_idx = -1;
int row = WMGetListSelectedItemRow(panel->actLs);
WMSetTextFieldText(panel->shoT, shortcut);
if (row >= 0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
key_idx = isKeySet(panel, shortcut);
if (key_idx >= 0 && (key_idx != row)) {
char *msg;
WMRedisplayWidget(panel->actLs);
} else {
msg = wstrconcat(_("Key shortcut already in use by the "), _(keyOptions[key_idx].title));
WMRunAlertPanel(WMWidgetScreen(w), GetWindow(),
_("Error"),
msg,
_("OK"), NULL, NULL);
wfree(msg);
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);
}
}
}
}

View File

@@ -381,10 +381,7 @@ static void fillModifierPopUp(WMPopUpButton * pop)
if (mapping->modifiermap[idx] != 0) {
int l;
for (l = 0; l < 4; l++) {
if (xext_xkb_supported)
ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l);
else
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
ksym = W_KeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
if (ksym != NoSymbol)
break;
}

View File

@@ -33,6 +33,7 @@
#include <wraster.h>
#include <WINGs/WINGs.h>
#include <WINGs/WINGsP.h>
/* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */
#include "../src/wconfig.h"
@@ -54,7 +55,6 @@
/****/
extern char *NOptionValueChanged;
extern Bool xext_xkb_supported;
typedef struct _Panel Panel;

View File

@@ -35,8 +35,6 @@
#endif
char *NOptionValueChanged = "NOptionValueChanged";
Bool xext_xkb_supported = False;
#define MAX_DEATHS 64
@@ -157,8 +155,6 @@ int main(int argc, char **argv)
exit(0);
}
xext_xkb_supported = XkbQueryExtension(dpy, NULL, NULL, NULL, NULL, NULL);
WMPLSetCaseSensitive(False);
Initialize(scr);

View File

@@ -171,10 +171,7 @@ static void x_reset_modifier_mapping(Display * display)
KeySym sym;
if (code) {
if (xext_xkb_supported)
sym = XkbKeycodeToKeysym(display, code, 0, column);
else
sym = XKeycodeToKeysym(display, code, column);
sym = W_KeycodeToKeysym(display, code, column);
} else {
sym = NoSymbol;
}

View File

@@ -78,9 +78,9 @@ WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
AC_SUBST(WRASTER_VERSION)
dnl
dnl libWINGs
WINGS_CURRENT=4
WINGS_CURRENT=5
WINGS_REVISION=0
WINGS_AGE=1
WINGS_AGE=2
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
AC_SUBST(WINGS_VERSION)
dnl
@@ -270,8 +270,8 @@ supported_gfx=""
dnl Platform-specific Makefile setup
dnl ================================
AS_CASE(["$host"],
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700"],
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -DFREEBSD"],
[*-*-netbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
[*-*-openbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
[*-*-dragonfly*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],

View File

@@ -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
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
Disables support for @emph{shaped} windows (for @command{oclock}, @command{xeyes}, etc.).

View File

@@ -244,6 +244,7 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
if (nheight != wwin->old_geometry.height)
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);
wwin->old_geometry.x = nx;
wwin->old_geometry.y = ny;

View File

@@ -154,7 +154,7 @@ static WDECallbackUpdate setModifierKeyLabels;
static WDECallbackConvert getCursor;
static WDECallbackUpdate setCursor;
static WDECallbackUpdate updateDock ;
static WDECallbackUpdate updateDock;
/*
* Tables to convert strings to enumeration values.

View File

@@ -2440,7 +2440,7 @@ static int restoreMenu(WScreen *scr, WMPropList *menu)
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, const char *path)
{
WMPropList *key, *entry;
char buffer[512];
char buffer[1024];
int i, x, y, res;
Bool lowered;

View File

@@ -38,6 +38,7 @@
#include <X11/XKBlib.h>
#include <WINGs/WUtil.h>
#include <WINGs/WINGsP.h>
#include <wraster.h>
#include "window.h"
@@ -840,7 +841,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)
return NULL;

View File

@@ -93,6 +93,7 @@ static WMPropList *sHost;
static WMPropList *sWorkspace;
static WMPropList *sShaded;
static WMPropList *sMiniaturized;
static WMPropList *sMaximized;
static WMPropList *sHidden;
static WMPropList *sGeometry;
static WMPropList *sShortcutMask;
@@ -112,6 +113,7 @@ static void make_keys(void)
sWorkspace = WMCreatePLString("Workspace");
sShaded = WMCreatePLString("Shaded");
sMiniaturized = WMCreatePLString("Miniaturized");
sMaximized = WMCreatePLString("Maximized");
sHidden = WMCreatePLString("Hidden");
sGeometry = WMCreatePLString("Geometry");
sDock = WMCreatePLString("Dock");
@@ -166,6 +168,22 @@ static unsigned getInt(WMPropList * value)
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)
{
WScreen *scr = wwin->screen_ptr;
@@ -174,7 +192,7 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
unsigned mask;
char *class, *instance, *command = NULL, buffer[512];
WMPropList *win_state, *cmd, *name, *workspace;
WMPropList *shaded, *miniaturized, *hidden, *geometry;
WMPropList *shaded, *miniaturized, *maximized, *hidden, *geometry;
WMPropList *dock, *shortcut;
if (wwin->orig_main_window != None && wwin->orig_main_window != wwin->client_win)
@@ -207,6 +225,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
shaded = wwin->flags.shaded ? 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;
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
wwin->client.width, wwin->client.height, wwin->frame_x, wwin->frame_y);
@@ -226,12 +246,14 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
sWorkspace, workspace,
sShaded, shaded,
sMiniaturized, miniaturized,
sMaximized, maximized,
sHidden, hidden,
sShortcutMask, shortcut, sGeometry, geometry, NULL);
WMReleasePropList(name);
WMReleasePropList(cmd);
WMReleasePropList(workspace);
WMReleasePropList(maximized);
WMReleasePropList(geometry);
WMReleasePropList(shortcut);
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
@@ -408,6 +430,11 @@ static WSavedState *getWindowState(WScreen * scr, WMPropList * win_state)
if (value != NULL)
state->miniaturized = getBool(value);
value = WMGetFromPLDictionary(win_state, sMaximized);
if (value != NULL) {
state->maximized = getHex(value);
}
value = WMGetFromPLDictionary(win_state, sHidden);
if (value != NULL)
state->hidden = getBool(value);

View File

@@ -162,7 +162,7 @@ WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
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,
XColor *color);
void wTextureDestroy(WScreen*, WTexture*);

View File

@@ -919,6 +919,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable))
wwin->flags.miniaturized = win_state->state->miniaturized;
if (win_state->state->maximized > 0)
wwin->flags.maximized = win_state->state->maximized;
if (!IS_OMNIPRESENT(wwin)) {
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
wwin->wm_class);
@@ -1732,9 +1735,8 @@ void wWindowSingleFocus(WWindow *wwin)
/* bring window back to visible area */
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);
}
}
void wWindowFocusPrev(WWindow *wwin, Bool inSameWorkspace)
@@ -1898,6 +1900,16 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
int baseW = 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->flags.maximized) {
winc = wwin->normal_hints->width_inc;
@@ -1918,15 +1930,19 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
baseH = wwin->normal_hints->base_height;
}
/* trust the mins provided by the client but not the maxs */
if (width < minW)
width = minW;
if (height < minH)
height = minH;
if (width > maxW)
width = maxW;
if (height > maxH)
height = maxH;
/* if only one dimension is over the top, set a default 4/3 ratio */
if (width > maxW && height < maxH) {
width = height * 4 / 3;
} else {
if(height > maxH && width < maxW)
height = width * 3 / 4;
}
/* aspect ratio code borrowed from olwm */
if (minAX > 0) {
@@ -2132,14 +2148,6 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
int synth_notify = False;
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);
/*
* if the window is being moved but not resized then
@@ -2694,7 +2702,7 @@ void wWindowUpdateGNUstepAttr(WWindow * wwin, GNUstepWMAttributes * attr)
}
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;
@@ -2929,7 +2937,6 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
}
/* maximize window */
if (dir != 0 && IS_RESIZABLE(wwin)) {
int ndir = dir ^ wwin->flags.maximized;

View File

@@ -309,9 +309,9 @@ typedef struct WWindow {
typedef struct WSavedState {
int workspace;
int miniaturized;
int maximized;
int shaded;
int hidden;
int maximized;
int x; /* original geometry of the */
int y; /* window if it's maximized */
unsigned int w;

View File

@@ -36,6 +36,7 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
#include <X11/XKBlib.h>
#include <WINGs/WUtil.h>
#include <WINGs/WINGsP.h>
#include "WindowMaker.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];
sym = (code ? XkbKeycodeToKeysym(display, code, 0, column) : NoSymbol);
sym = (code ? W_KeycodeToKeysym(display, code, column) : NoSymbol);
if (sym == last_sym)
continue;

View File

@@ -70,10 +70,13 @@ wmmenugen_SOURCES = wmmenugen.c wmmenugen.h wmmenugen_misc.c \
wmmenugen_parse_wmconfig.c \
wmmenugen_parse_xdg.c
wmiv_CFLAGS = @PANGO_CFLAGS@ @PTHREAD_CFLAGS@
wmiv_LDADD = \
$(top_builddir)/wrlib/libwraster.la \
@XLFLAGS@ @XLIBS@ \
@GFXLIBS@ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBEXIF)
$(top_builddir)/WINGs/libWINGs.la \
@XLFLAGS@ @XLIBS@ @GFXLIBS@ \
@PANGO_LIBS@ @PTHREAD_LIBS@ @LIBEXIF@
wmiv_SOURCES = wmiv.c wmiv.h

View File

@@ -22,11 +22,10 @@
#define _GNU_SOURCE
#endif
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include "wraster.h"
#include <WINGs/WINGsP.h>
#include <wraster.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -932,7 +931,7 @@ int main(int argc, char **argv)
continue;
}
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
if (keysym != XK_Right)
diaporama_flag = False;