mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] x11: implement center, borderless and maximized parameters
This commit is contained in:
parent
1bf9fb7d73
commit
5aa7a391ac
@ -25,9 +25,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
DEF_ATOM(_NET_FRAME_EXTENTS) \
|
DEF_ATOM(_NET_FRAME_EXTENTS) \
|
||||||
DEF_ATOM(_NET_WM_STATE) \
|
DEF_ATOM(_NET_WM_STATE) \
|
||||||
DEF_ATOM(_NET_WM_STATE_FULLSCREEN) \
|
DEF_ATOM(_NET_WM_STATE_FULLSCREEN) \
|
||||||
|
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ) \
|
||||||
|
DEF_ATOM(_NET_WM_STATE_MAXIMIZED_VERT) \
|
||||||
DEF_ATOM(_NET_WM_WINDOW_TYPE) \
|
DEF_ATOM(_NET_WM_WINDOW_TYPE) \
|
||||||
DEF_ATOM(_NET_WM_WINDOW_TYPE_NORMAL) \
|
DEF_ATOM(_NET_WM_WINDOW_TYPE_NORMAL) \
|
||||||
|
DEF_ATOM(_NET_WM_WINDOW_TYPE_UTILITY) \
|
||||||
DEF_ATOM(WM_DELETE_WINDOW) \
|
DEF_ATOM(WM_DELETE_WINDOW) \
|
||||||
|
DEF_ATOM(_MOTIF_WM_HINTS) \
|
||||||
\
|
\
|
||||||
DEF_ATOM(CLIPBOARD) \
|
DEF_ATOM(CLIPBOARD) \
|
||||||
DEF_ATOM(TARGETS) \
|
DEF_ATOM(TARGETS) \
|
||||||
|
@ -48,6 +48,27 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
struct X11DSState x11;
|
struct X11DSState x11;
|
||||||
|
|
||||||
|
struct MwmHints
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
unsigned long functions;
|
||||||
|
unsigned long decorations;
|
||||||
|
long input_mode;
|
||||||
|
unsigned long status;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MWM_HINTS_FUNCTIONS = (1L << 0),
|
||||||
|
MWM_HINTS_DECORATIONS = (1L << 1),
|
||||||
|
|
||||||
|
MWM_FUNC_ALL = (1L << 0),
|
||||||
|
MWM_FUNC_RESIZE = (1L << 1),
|
||||||
|
MWM_FUNC_MOVE = (1L << 2),
|
||||||
|
MWM_FUNC_MINIMIZE = (1L << 3),
|
||||||
|
MWM_FUNC_MAXIMIZE = (1L << 4),
|
||||||
|
MWM_FUNC_CLOSE = (1L << 5)
|
||||||
|
};
|
||||||
|
|
||||||
// forwards
|
// forwards
|
||||||
static void x11SetFullscreen(bool fs);
|
static void x11SetFullscreen(bool fs);
|
||||||
static int x11EventThread(void * unused);
|
static int x11EventThread(void * unused);
|
||||||
@ -117,6 +138,18 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
swaMask |= CWBitGravity | CWWinGravity;
|
||||||
|
if (params.center)
|
||||||
|
{
|
||||||
|
swa.bit_gravity = CenterGravity;
|
||||||
|
swa.win_gravity = CenterGravity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swa.bit_gravity = NorthWestGravity;
|
||||||
|
swa.win_gravity = NorthWestGravity;
|
||||||
|
}
|
||||||
|
|
||||||
x11.window = XCreateWindow(
|
x11.window = XCreateWindow(
|
||||||
x11.display,
|
x11.display,
|
||||||
XDefaultRootWindow(x11.display),
|
XDefaultRootWindow(x11.display),
|
||||||
@ -149,18 +182,69 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
X11AtomsInit();
|
X11AtomsInit();
|
||||||
XSetWMProtocols(x11.display, x11.window, &x11atoms.WM_DELETE_WINDOW, 1);
|
XSetWMProtocols(x11.display, x11.window, &x11atoms.WM_DELETE_WINDOW, 1);
|
||||||
|
|
||||||
XChangeProperty(
|
if (params.borderless)
|
||||||
x11.display,
|
{
|
||||||
x11.window,
|
if (x11atoms._MOTIF_WM_HINTS)
|
||||||
x11atoms._NET_WM_WINDOW_TYPE,
|
{
|
||||||
XA_ATOM,
|
const struct MwmHints hints =
|
||||||
32,
|
{
|
||||||
PropModeReplace,
|
.flags = MWM_HINTS_DECORATIONS,
|
||||||
(unsigned char *)&x11atoms._NET_WM_WINDOW_TYPE_NORMAL,
|
.decorations = 0
|
||||||
1
|
};
|
||||||
);
|
|
||||||
|
XChangeProperty(
|
||||||
|
x11.display,
|
||||||
|
x11.window,
|
||||||
|
x11atoms._MOTIF_WM_HINTS,
|
||||||
|
x11atoms._MOTIF_WM_HINTS,
|
||||||
|
32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)&hints,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(
|
||||||
|
x11.display,
|
||||||
|
x11.window,
|
||||||
|
x11atoms._NET_WM_WINDOW_TYPE,
|
||||||
|
XA_ATOM,
|
||||||
|
32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)&x11atoms._NET_WM_WINDOW_TYPE_UTILITY,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XChangeProperty(
|
||||||
|
x11.display,
|
||||||
|
x11.window,
|
||||||
|
x11atoms._NET_WM_WINDOW_TYPE,
|
||||||
|
XA_ATOM,
|
||||||
|
32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)&x11atoms._NET_WM_WINDOW_TYPE_NORMAL,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Atom wmState[3] = {0};
|
||||||
|
int wmStateCount = 0;
|
||||||
|
|
||||||
if (params.fullscreen)
|
if (params.fullscreen)
|
||||||
|
{
|
||||||
|
x11.fullscreen = true;
|
||||||
|
wmState[wmStateCount++] = x11atoms._NET_WM_STATE_FULLSCREEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.maximize)
|
||||||
|
{
|
||||||
|
wmState[wmStateCount++] = x11atoms._NET_WM_STATE_MAXIMIZED_HORZ;
|
||||||
|
wmState[wmStateCount++] = x11atoms._NET_WM_STATE_MAXIMIZED_VERT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wmStateCount)
|
||||||
{
|
{
|
||||||
XChangeProperty(
|
XChangeProperty(
|
||||||
x11.display,
|
x11.display,
|
||||||
@ -169,8 +253,8 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
XA_ATOM,
|
XA_ATOM,
|
||||||
32,
|
32,
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(unsigned char *)&x11atoms._NET_WM_STATE_FULLSCREEN,
|
(unsigned char *)&wmState,
|
||||||
1
|
wmStateCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user