32 |
extern BOOL hide_decorations; |
extern BOOL hide_decorations; |
33 |
extern char title[]; |
extern char title[]; |
34 |
extern int server_bpp; |
extern int server_bpp; |
35 |
|
extern int win_button_size; |
36 |
BOOL enable_compose = False; |
BOOL enable_compose = False; |
37 |
BOOL focused; |
BOOL focused; |
38 |
BOOL mouse_in_wnd; |
BOOL mouse_in_wnd; |
123 |
#define SET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, rop2_map[rop2]); } |
#define SET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, rop2_map[rop2]); } |
124 |
#define RESET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, GXcopy); } |
#define RESET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(display, gc, GXcopy); } |
125 |
|
|
126 |
void |
static void |
127 |
mwm_hide_decorations(void) |
mwm_hide_decorations(void) |
128 |
{ |
{ |
129 |
PropMotifWmHints motif_hints; |
PropMotifWmHints motif_hints; |
145 |
(unsigned char *) &motif_hints, PROP_MOTIF_WM_HINTS_ELEMENTS); |
(unsigned char *) &motif_hints, PROP_MOTIF_WM_HINTS_ELEMENTS); |
146 |
} |
} |
147 |
|
|
148 |
PixelColour |
static PixelColour |
149 |
split_colour15(uint32 colour) |
split_colour15(uint32 colour) |
150 |
{ |
{ |
151 |
PixelColour rv; |
PixelColour rv; |
158 |
return rv; |
return rv; |
159 |
} |
} |
160 |
|
|
161 |
PixelColour |
static PixelColour |
162 |
split_colour16(uint32 colour) |
split_colour16(uint32 colour) |
163 |
{ |
{ |
164 |
PixelColour rv; |
PixelColour rv; |
171 |
return rv; |
return rv; |
172 |
} |
} |
173 |
|
|
174 |
PixelColour |
static PixelColour |
175 |
split_colour24(uint32 colour) |
split_colour24(uint32 colour) |
176 |
{ |
{ |
177 |
PixelColour rv; |
PixelColour rv; |
181 |
return rv; |
return rv; |
182 |
} |
} |
183 |
|
|
184 |
uint32 make_colour16(PixelColour pc) |
static uint32 |
185 |
|
make_colour16(PixelColour pc) |
186 |
{ |
{ |
187 |
pc.red = (pc.red * 0x1f) / 0xff; |
pc.red = (pc.red * 0x1f) / 0xff; |
188 |
pc.green = (pc.green * 0x3f) / 0xff; |
pc.green = (pc.green * 0x3f) / 0xff; |
190 |
return (pc.red << 11) | (pc.green << 5) | pc.blue; |
return (pc.red << 11) | (pc.green << 5) | pc.blue; |
191 |
} |
} |
192 |
|
|
193 |
uint32 make_colour24(PixelColour pc) |
static uint32 |
194 |
|
make_colour24(PixelColour pc) |
195 |
{ |
{ |
196 |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
197 |
} |
} |
198 |
|
|
199 |
uint32 make_colour32(PixelColour pc) |
static uint32 |
200 |
|
make_colour32(PixelColour pc) |
201 |
{ |
{ |
202 |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
203 |
} |
} |
430 |
switch (bpp) |
switch (bpp) |
431 |
{ |
{ |
432 |
case 32: |
case 32: |
433 |
translate16to32((uint16 *) data, (uint32 *) out, (uint32 *) end); |
translate16to32((uint16 *) data, (uint32 *) out, |
434 |
|
(uint32 *) end); |
435 |
break; |
break; |
436 |
case 24: |
case 24: |
437 |
translate16to24((uint16 *) data, out, end); |
translate16to24((uint16 *) data, out, end); |
438 |
break; |
break; |
439 |
case 16: |
case 16: |
440 |
translate16to16((uint16 *) data, (uint16 *) out, (uint16 *) end); |
translate16to16((uint16 *) data, (uint16 *) out, |
441 |
|
(uint16 *) end); |
442 |
break; |
break; |
443 |
} |
} |
444 |
break; |
break; |
446 |
switch (bpp) |
switch (bpp) |
447 |
{ |
{ |
448 |
case 32: |
case 32: |
449 |
translate15to32((uint16 *) data, (uint32 *) out, (uint32 *) end); |
translate15to32((uint16 *) data, (uint32 *) out, |
450 |
|
(uint32 *) end); |
451 |
break; |
break; |
452 |
case 24: |
case 24: |
453 |
translate15to24((uint16 *) data, out, end); |
translate15to24((uint16 *) data, out, end); |
454 |
break; |
break; |
455 |
case 16: |
case 16: |
456 |
translate15to16((uint16 *) data, (uint16 *) out, (uint16 *) end); |
translate15to16((uint16 *) data, (uint16 *) out, |
457 |
|
(uint16 *) end); |
458 |
break; |
break; |
459 |
} |
} |
460 |
break; |
break; |
855 |
if (button == 0) |
if (button == 0) |
856 |
break; |
break; |
857 |
|
|
858 |
|
/* If win_button_size is nonzero, enable single app mode */ |
859 |
|
if (xevent.xbutton.y < win_button_size) |
860 |
|
{ |
861 |
|
if (xevent.xbutton.x >= width - win_button_size) |
862 |
|
{ |
863 |
|
/* The close button, do nothing */ |
864 |
|
; |
865 |
|
} |
866 |
|
else if (xevent.xbutton.x >= width - win_button_size * 2) |
867 |
|
{ |
868 |
|
/* The maximize/restore button. Do not send to |
869 |
|
server. It might be a good idea to change the |
870 |
|
cursor or give some other visible indication |
871 |
|
that rdesktop inhibited this click */ |
872 |
|
break; |
873 |
|
} |
874 |
|
else if (xevent.xbutton.x >= width - win_button_size * 3) |
875 |
|
{ |
876 |
|
/* The minimize button. Iconify window. */ |
877 |
|
XIconifyWindow(display, wnd, |
878 |
|
DefaultScreen(display)); |
879 |
|
break; |
880 |
|
} |
881 |
|
} |
882 |
|
|
883 |
rdp_send_input(time(NULL), RDP_INPUT_MOUSE, |
rdp_send_input(time(NULL), RDP_INPUT_MOUSE, |
884 |
flags | button, xevent.xbutton.x, xevent.xbutton.y); |
flags | button, xevent.xbutton.x, xevent.xbutton.y); |
885 |
break; |
break; |