mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)
This commit is contained in:
273
src/motif.c
273
src/motif.c
@@ -20,7 +20,6 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#ifdef MWM_HINTS
|
||||
@@ -32,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "WindowMaker.h"
|
||||
|
||||
#include "wcore.h"
|
||||
@@ -45,7 +43,6 @@
|
||||
|
||||
#include "motif.h"
|
||||
|
||||
|
||||
/* Motif window hints */
|
||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
@@ -71,194 +68,182 @@
|
||||
|
||||
/* Motif window hints */
|
||||
typedef struct {
|
||||
long flags;
|
||||
long functions;
|
||||
long decorations;
|
||||
long inputMode;
|
||||
long unknown;
|
||||
long flags;
|
||||
long functions;
|
||||
long decorations;
|
||||
long inputMode;
|
||||
long unknown;
|
||||
} MWMHints;
|
||||
|
||||
static Atom _XA_MOTIF_WM_HINTS;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
||||
static void setupMWMHints(WWindow * wwin, MWMHints * mwm_hints)
|
||||
{
|
||||
/*
|
||||
* We will ignore all decoration hints that have an equivalent as
|
||||
* functions, because wmaker does not distinguish decoration hints
|
||||
*/
|
||||
/*
|
||||
* We will ignore all decoration hints that have an equivalent as
|
||||
* functions, because wmaker does not distinguish decoration hints
|
||||
*/
|
||||
|
||||
if (mwm_hints->flags & MWM_HINTS_DECORATIONS) {
|
||||
if (mwm_hints->flags & MWM_HINTS_DECORATIONS) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"has decor hints [ ");
|
||||
fprintf(stderr, "has decor hints [ ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_titlebar, 1);
|
||||
WSETUFLAG(wwin, no_close_button, 1);
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 1);
|
||||
WSETUFLAG(wwin, no_resizebar, 1);
|
||||
WSETUFLAG(wwin, no_titlebar, 1);
|
||||
WSETUFLAG(wwin, no_close_button, 1);
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 1);
|
||||
WSETUFLAG(wwin, no_resizebar, 1);
|
||||
|
||||
if (mwm_hints->decorations & MWM_DECOR_ALL) {
|
||||
if (mwm_hints->decorations & MWM_DECOR_ALL) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"ALL ");
|
||||
fprintf(stderr, "ALL ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_titlebar, 0);
|
||||
WSETUFLAG(wwin, no_close_button, 0);
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
WSETUFLAG(wwin, no_resizebar, 0);
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_BORDER) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(BORDER) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
WSETUFLAG(wwin, no_titlebar, 0);
|
||||
WSETUFLAG(wwin, no_close_button, 0);
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
WSETUFLAG(wwin, no_resizebar, 0);
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_BORDER) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(BORDER) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
|
||||
if (mwm_hints->decorations & MWM_DECOR_RESIZEH) {
|
||||
if (mwm_hints->decorations & MWM_DECOR_RESIZEH) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"RESIZEH ");
|
||||
fprintf(stderr, "RESIZEH ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_resizebar, 0);
|
||||
}
|
||||
WSETUFLAG(wwin, no_resizebar, 0);
|
||||
}
|
||||
|
||||
if (mwm_hints->decorations & MWM_DECOR_TITLE) {
|
||||
if (mwm_hints->decorations & MWM_DECOR_TITLE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"TITLE+close ");
|
||||
fprintf(stderr, "TITLE+close ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_titlebar, 0);
|
||||
WSETUFLAG(wwin, no_close_button, 0);
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_MENU) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MENU) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
WSETUFLAG(wwin, no_titlebar, 0);
|
||||
WSETUFLAG(wwin, no_close_button, 0);
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_MENU) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MENU) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
|
||||
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
|
||||
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"MINIMIZE ");
|
||||
fprintf(stderr, "MINIMIZE ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MAXIMIZE) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MAXIMIZE) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"]\n");
|
||||
fprintf(stderr, "]\n");
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr, "has function hints [ ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_closable, 1);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
||||
WSETUFLAG(wwin, no_resizable, 1);
|
||||
|
||||
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
|
||||
if (mwm_hints->functions & MWM_FUNC_ALL) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"has function hints [ ");
|
||||
fprintf(stderr, "ALL ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_closable, 1);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
||||
WSETUFLAG(wwin, no_resizable, 1);
|
||||
|
||||
if (mwm_hints->functions & MWM_FUNC_ALL) {
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_RESIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"ALL ");
|
||||
fprintf(stderr, "RESIZE ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_RESIZE) {
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->functions & MWM_FUNC_MOVE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MOVE) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
if (mwm_hints->functions & MWM_FUNC_MINIMIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"RESIZE ");
|
||||
fprintf(stderr, "MINIMIZE ");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
}
|
||||
/*
|
||||
if (mwm_hints->functions & MWM_FUNC_MOVE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"(MOVE) ");
|
||||
# endif
|
||||
}
|
||||
*/
|
||||
if (mwm_hints->functions & MWM_FUNC_MINIMIZE) {
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"MINIMIZE ");
|
||||
fprintf(stderr, "MAXIMIZE ");
|
||||
/* a window must be resizable to be maximizable */
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) {
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_CLOSE) {
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"MAXIMIZE ");
|
||||
/* a window must be resizable to be maximizable */
|
||||
WSETUFLAG(wwin, no_resizable, 0);
|
||||
fprintf(stderr, "CLOSE ");
|
||||
# endif
|
||||
}
|
||||
if (mwm_hints->functions & MWM_FUNC_CLOSE) {
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
}
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"CLOSE ");
|
||||
fprintf(stderr, "]\n");
|
||||
# endif
|
||||
WSETUFLAG(wwin, no_closable, 0);
|
||||
}
|
||||
# ifdef DEBUG
|
||||
fprintf(stderr,"]\n");
|
||||
# endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getMWMHints(Window window, MWMHints *mwmhints)
|
||||
static int getMWMHints(Window window, MWMHints * mwmhints)
|
||||
{
|
||||
unsigned long *data;
|
||||
int count;
|
||||
unsigned long *data;
|
||||
int count;
|
||||
|
||||
if (!_XA_MOTIF_WM_HINTS) {
|
||||
_XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
|
||||
}
|
||||
if (!_XA_MOTIF_WM_HINTS) {
|
||||
_XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
|
||||
}
|
||||
|
||||
data = (unsigned long*)PropGetCheckProperty(window, _XA_MOTIF_WM_HINTS,
|
||||
_XA_MOTIF_WM_HINTS, 32,
|
||||
0, &count);
|
||||
data = (unsigned long *)PropGetCheckProperty(window, _XA_MOTIF_WM_HINTS,
|
||||
_XA_MOTIF_WM_HINTS, 32, 0, &count);
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
if (count >= 4) {
|
||||
mwmhints->flags = data[0];
|
||||
mwmhints->functions = data[1];
|
||||
mwmhints->decorations = data[2];
|
||||
mwmhints->inputMode = data[3];
|
||||
if (count > 5)
|
||||
mwmhints->unknown = data[4];
|
||||
}
|
||||
XFree(data);
|
||||
if (count >= 4) {
|
||||
mwmhints->flags = data[0];
|
||||
mwmhints->functions = data[1];
|
||||
mwmhints->decorations = data[2];
|
||||
mwmhints->inputMode = data[3];
|
||||
if (count > 5)
|
||||
mwmhints->unknown = data[4];
|
||||
}
|
||||
XFree(data);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wMWMCheckClientHints(WWindow *wwin)
|
||||
void wMWMCheckClientHints(WWindow * wwin)
|
||||
{
|
||||
MWMHints hints;
|
||||
MWMHints hints;
|
||||
|
||||
if (getMWMHints(wwin->client_win, &hints)) {
|
||||
setupMWMHints(wwin, &hints);
|
||||
}
|
||||
if (getMWMHints(wwin->client_win, &hints)) {
|
||||
setupMWMHints(wwin, &hints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* MWM_HINTS */
|
||||
|
||||
#endif /* MWM_HINTS */
|
||||
|
||||
Reference in New Issue
Block a user