Support for hiding WM decorations

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@261 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2002-11-18 15:37:20 +00:00
parent 578665e472
commit 1ad250fcba
2 changed files with 47 additions and 1 deletions

View File

@ -55,6 +55,7 @@ BOOL encryption = True;
BOOL desktop_save = True;
BOOL fullscreen = False;
BOOL grab_keyboard = True;
BOOL hide_decorations = False;
/* Display usage information */
static void
@ -79,6 +80,7 @@ usage(char *program)
fprintf(stderr, " -m: do not send motion events\n");
fprintf(stderr, " -K: keep window manager key bindings\n");
fprintf(stderr, " -T: window title\n");
fprintf(stderr, " -D: hide window manager decorations\n");
}
static BOOL
@ -138,7 +140,7 @@ main(int argc, char *argv[])
domain[0] = password[0] = shell[0] = directory[0] = 0;
strcpy(keymapname, "en-us");
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:h?")) != -1)
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:Dh?")) != -1)
{
switch (c)
{
@ -218,6 +220,10 @@ main(int argc, char *argv[])
STRNCPY(title, optarg, sizeof(title));
break;
case 'D':
hide_decorations = True;
break;
case 'h':
case '?':
default:

40
xwin.c
View File

@ -29,6 +29,7 @@ extern int height;
extern BOOL sendmotion;
extern BOOL fullscreen;
extern BOOL grab_keyboard;
extern BOOL hide_decorations;
extern char title[];
BOOL enable_compose = False;
BOOL focused;
@ -55,6 +56,20 @@ static BOOL xserver_be;
static BOOL ownbackstore;
static Pixmap backstore;
/* MWM decorations */
#define MWM_HINTS_DECORATIONS (1L << 1)
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
typedef struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
}
PropMotifWmHints;
#define FILL_RECTANGLE(x,y,cx,cy)\
{ \
XFillRectangle(display, wnd, gc, x, y, cx, cy); \
@ -91,6 +106,28 @@ static int rop2_map[] = {
#define SET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, rop2_map[rop2]); }
#define RESET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, GXcopy); }
void
mwm_hide_decorations(void)
{
PropMotifWmHints motif_hints;
Atom hintsatom;
/* setup the property */
motif_hints.flags = MWM_HINTS_DECORATIONS;
motif_hints.decorations = 0;
/* get the atom for the property */
hintsatom = XInternAtom(display, "_MOTIF_WM_HINTS", False);
if (!hintsatom)
{
error("Failed to get atom _MOTIF_WM_HINTS\n");
return;
}
XChangeProperty(display, wnd, hintsatom, hintsatom, 32, PropModeReplace,
(unsigned char *) &motif_hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
}
static void
translate8(uint8 * data, uint8 * out, uint8 * end)
{
@ -328,6 +365,9 @@ ui_create_window(void)
XStoreName(display, wnd, title);
if (hide_decorations)
mwm_hide_decorations();
classhints = XAllocClassHint();
if (classhints != NULL)
{