View | Details | Raw Unified | Return to bug 1052
Collapse All | Expand All

(-)tigervnc/unix/vncviewer/ewmhints.c (+622 lines)
Line 0 Link Here
1
/* -*- c-basic-offset: 8 -*-
2
   rdesktop: A Remote Desktop Protocol client.
3
4
   Support functions for Extended Window Manager Hints,
5
   http://www.freedesktop.org/wiki/Standards_2fwm_2dspec
6
7
   Copyright 2005 Peter Astrand <astrand@cendio.se> for Cendio AB
8
   Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
9
10
   This program is free software: you can redistribute it and/or modify
11
   it under the terms of the GNU General Public License as published by
12
   the Free Software Foundation, either version 3 of the License, or
13
   (at your option) any later version.
14
15
   This program is distributed in the hope that it will be useful,
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
   GNU General Public License for more details.
19
20
   You should have received a copy of the GNU General Public License
21
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
#include <stdlib.h>
25
#include <stdio.h>
26
#include <string.h>
27
#include <X11/Xlib.h>
28
#include <X11/Xatom.h>
29
#include <X11/Xutil.h>
30
31
#define _NET_WM_STATE_REMOVE        0	/* remove/unset property */
32
#define _NET_WM_STATE_ADD           1	/* add/set property */
33
#define _NET_WM_STATE_TOGGLE        2	/* toggle property  */
34
35
typedef unsigned int uint32;
36
37
// FIXME: Remove, this file shouldn't depend on seamlessrdp!
38
#define SEAMLESSRDP_NORMAL 0
39
#define SEAMLESSRDP_MINIMIZED 1
40
#define SEAMLESSRDP_MAXIMIZED 2
41
42
#ifndef EX_UNAVAILABLE
43
#define EX_UNAVAILABLE  69
44
#endif
45
46
// FIXME: Need to think about this one...
47
/* malloc; exit if out of memory */
48
static void *
49
xmalloc(int size)
50
{
51
	void *mem = malloc(size);
52
	if (mem == NULL)
53
	{
54
		fprintf(stderr, "ERROR: xmalloc %d\n", size);
55
		exit(EX_UNAVAILABLE);
56
	}
57
	return mem;
58
}
59
60
61
static Display *g_display;
62
63
static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom,
64
	g_net_wm_state_hidden_atom, g_net_wm_name_atom, g_utf8_string_atom,
65
	g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom,
66
	g_net_wm_state_modal_atom, g_net_wm_icon_atom, g_net_wm_state_above_atom,
67
	g_net_wm_state_fullscreen_atom;
68
69
Atom g_net_wm_state_atom, g_net_wm_desktop_atom;
70
71
/* 
72
   Get window property value (32 bit format) 
73
   Returns zero on success, -1 on error
74
*/
75
static int
76
get_property_value(Window wnd, char *propname, long max_length,
77
		   unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
78
{
79
	int result;
80
	Atom property;
81
	Atom actual_type_return;
82
	int actual_format_return;
83
	unsigned long bytes_after_return;
84
85
	property = XInternAtom(g_display, propname, True);
86
	if (property == None)
87
	{
88
		fprintf(stderr, "Atom %s does not exist\n", propname);
89
		return (-1);
90
	}
91
92
	result = XGetWindowProperty(g_display, wnd, property, 0,	/* long_offset */
93
				    max_length,	/* long_length */
94
				    False,	/* delete */
95
				    AnyPropertyType,	/* req_type */
96
				    &actual_type_return,
97
				    &actual_format_return,
98
				    nitems_return, &bytes_after_return, prop_return);
99
100
	if (result != Success)
101
	{
102
		fprintf(stderr, "XGetWindowProperty failed\n");
103
		return (-1);
104
	}
105
106
	if (actual_type_return == None || actual_format_return == 0)
107
	{
108
		if (!nowarn)
109
			fprintf(stderr, "Window is missing property %s\n", propname);
110
		return (-1);
111
	}
112
113
	if (bytes_after_return)
114
	{
115
		fprintf(stderr, "%s is too big for me\n", propname);
116
		return (-1);
117
	}
118
119
	if (actual_format_return != 32)
120
	{
121
		fprintf(stderr, "%s has bad format\n", propname);
122
		return (-1);
123
	}
124
125
	return (0);
126
}
127
128
/* 
129
   Get current desktop number
130
   Returns -1 on error
131
*/
132
static int
133
get_current_desktop(void)
134
{
135
	unsigned long nitems_return;
136
	unsigned char *prop_return;
137
	int current_desktop;
138
139
	if (get_property_value
140
	    (DefaultRootWindow(g_display), "_NET_CURRENT_DESKTOP", 1, &nitems_return,
141
	     &prop_return, 0) < 0)
142
		return (-1);
143
144
	if (nitems_return != 1)
145
	{
146
		fprintf(stderr, "_NET_CURRENT_DESKTOP has bad length\n");
147
		return (-1);
148
	}
149
150
	current_desktop = *prop_return;
151
	XFree(prop_return);
152
	return current_desktop;
153
}
154
155
/*
156
  Get workarea geometry
157
  Returns zero on success, -1 on error
158
 */
159
160
int
161
get_current_workarea(uint32 * x, uint32 * y, uint32 * width, uint32 * height)
162
{
163
	int current_desktop;
164
	unsigned long nitems_return;
165
	unsigned char *prop_return;
166
	long *return_words;
167
	const uint32 net_workarea_x_offset = 0;
168
	const uint32 net_workarea_y_offset = 1;
169
	const uint32 net_workarea_width_offset = 2;
170
	const uint32 net_workarea_height_offset = 3;
171
	const uint32 max_prop_length = 32 * 4;	/* Max 32 desktops */
172
173
	if (get_property_value
174
	    (DefaultRootWindow(g_display), "_NET_WORKAREA", max_prop_length, &nitems_return,
175
	     &prop_return, 0) < 0)
176
		return (-1);
177
178
	if (nitems_return % 4)
179
	{
180
		fprintf(stderr, "_NET_WORKAREA has odd length\n");
181
		return (-1);
182
	}
183
184
	current_desktop = get_current_desktop();
185
186
	if (current_desktop < 0)
187
		return -1;
188
189
	return_words = (long *) prop_return;
190
191
	*x = return_words[current_desktop * 4 + net_workarea_x_offset];
192
	*y = return_words[current_desktop * 4 + net_workarea_y_offset];
193
	*width = return_words[current_desktop * 4 + net_workarea_width_offset];
194
	*height = return_words[current_desktop * 4 + net_workarea_height_offset];
195
196
	XFree(prop_return);
197
198
	return (0);
199
200
}
201
202
203
204
void
205
ewmh_init(Display *display)
206
{
207
	g_display = display;
208
	/* FIXME: Use XInternAtoms */
209
	g_net_wm_state_maximized_vert_atom =
210
		XInternAtom(g_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
211
	g_net_wm_state_maximized_horz_atom =
212
		XInternAtom(g_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
213
	g_net_wm_state_hidden_atom = XInternAtom(g_display, "_NET_WM_STATE_HIDDEN", False);
214
	g_net_wm_state_skip_taskbar_atom =
215
		XInternAtom(g_display, "_NET_WM_STATE_SKIP_TASKBAR", False);
216
	g_net_wm_state_skip_pager_atom = XInternAtom(g_display, "_NET_WM_STATE_SKIP_PAGER", False);
217
	g_net_wm_state_modal_atom = XInternAtom(g_display, "_NET_WM_STATE_MODAL", False);
218
	g_net_wm_state_above_atom = XInternAtom(g_display, "_NET_WM_STATE_ABOVE", False);
219
	g_net_wm_state_atom = XInternAtom(g_display, "_NET_WM_STATE", False);
220
	g_net_wm_state_fullscreen_atom = XInternAtom(g_display, "_NET_WM_STATE_FULLSCREEN", False);
221
	g_net_wm_desktop_atom = XInternAtom(g_display, "_NET_WM_DESKTOP", False);
222
	g_net_wm_name_atom = XInternAtom(g_display, "_NET_WM_NAME", False);
223
	g_net_wm_icon_atom = XInternAtom(g_display, "_NET_WM_ICON", False);
224
	g_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False);
225
}
226
227
228
/* 
229
   Get the window state: normal/minimized/maximized. 
230
*/
231
#ifndef MAKE_PROTO
232
int
233
ewmh_get_window_state(Window w)
234
{
235
	unsigned long nitems_return;
236
	unsigned char *prop_return;
237
	uint32 *return_words;
238
	unsigned long item;
239
	Bool maximized_vert, maximized_horz, hidden;
240
241
	maximized_vert = maximized_horz = hidden = False;
242
243
	if (get_property_value(w, "_NET_WM_STATE", 64, &nitems_return, &prop_return, 0) < 0)
244
		return SEAMLESSRDP_NORMAL;
245
246
	return_words = (uint32 *) prop_return;
247
248
	for (item = 0; item < nitems_return; item++)
249
	{
250
		if (return_words[item] == g_net_wm_state_maximized_vert_atom)
251
			maximized_vert = True;
252
		if (return_words[item] == g_net_wm_state_maximized_horz_atom)
253
			maximized_horz = True;
254
		if (return_words[item] == g_net_wm_state_hidden_atom)
255
			hidden = True;
256
	}
257
258
	XFree(prop_return);
259
260
	if (maximized_vert && maximized_horz)
261
		return SEAMLESSRDP_MAXIMIZED;
262
	else if (hidden)
263
		return SEAMLESSRDP_MINIMIZED;
264
	else
265
		return SEAMLESSRDP_NORMAL;
266
}
267
268
static int
269
ewmh_modify_state(Window wnd, Bool add, Atom atom1, Atom atom2)
270
{
271
	Status status;
272
	XEvent xevent;
273
274
	int result;
275
	unsigned long nitems;
276
	unsigned char *props;
277
	uint32 state = WithdrawnState;
278
279
	/* The spec states that the window manager must respect any
280
	   _NET_WM_STATE attributes on a withdrawn window. In order words, we
281
	   modify the attributes directly for withdrawn windows and ask the WM
282
	   to do it for active windows. */
283
	result = get_property_value(wnd, "WM_STATE", 64, &nitems, &props, 1);
284
	if ((result >= 0) && nitems)
285
	{
286
		state = *(uint32 *) props;
287
		XFree(props);
288
	}
289
290
	if (state == WithdrawnState)
291
	{
292
		if (add)
293
		{
294
			Atom atoms[2];
295
296
			atoms[0] = atom1;
297
			nitems = 1;
298
			if (atom2)
299
			{
300
				atoms[1] = atom2;
301
				nitems = 2;
302
			}
303
304
			XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
305
					32, PropModeAppend, (unsigned char *) atoms, nitems);
306
		}
307
		else
308
		{
309
			Atom *atoms;
310
			int i;
311
312
			if (get_property_value(wnd, "_NET_WM_STATE", 64, &nitems, &props, 1) < 0)
313
				return 0;
314
315
			atoms = (Atom *) props;
316
317
			for (i = 0; i < nitems; i++)
318
			{
319
				if ((atoms[i] == atom1) || (atom2 && (atoms[i] == atom2)))
320
				{
321
					if (i != (nitems - 1))
322
						memmove(&atoms[i], &atoms[i + 1],
323
							sizeof(Atom) * (nitems - i - 1));
324
					nitems--;
325
					i--;
326
				}
327
			}
328
329
			XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
330
					32, PropModeReplace, (unsigned char *) atoms, nitems);
331
332
			XFree(props);
333
		}
334
335
		return 0;
336
	}
337
338
	xevent.type = ClientMessage;
339
	xevent.xclient.window = wnd;
340
	xevent.xclient.message_type = g_net_wm_state_atom;
341
	xevent.xclient.format = 32;
342
	if (add)
343
		xevent.xclient.data.l[0] = _NET_WM_STATE_ADD;
344
	else
345
		xevent.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
346
	xevent.xclient.data.l[1] = atom1;
347
	xevent.xclient.data.l[2] = atom2;
348
	xevent.xclient.data.l[3] = 0;
349
	xevent.xclient.data.l[4] = 0;
350
	status = XSendEvent(g_display, DefaultRootWindow(g_display), False,
351
			    SubstructureNotifyMask | SubstructureRedirectMask, &xevent);
352
	if (!status)
353
		return -1;
354
355
	return 0;
356
}
357
358
359
int ewmh_state_fullscreen(Window wnd, Bool fullscreen)
360
{
361
	if (ewmh_modify_state(wnd, fullscreen, g_net_wm_state_fullscreen_atom, 0) < 0)
362
		return -1;
363
	return 0;
364
}
365
366
/* 
367
   Set the window state: normal/minimized/maximized. 
368
   Returns -1 on failure. 
369
*/
370
int
371
ewmh_change_state(Window wnd, int state)
372
{
373
	/*
374
	 * Deal with the max atoms
375
	 */
376
	if (state == SEAMLESSRDP_MAXIMIZED)
377
	{
378
		if (ewmh_modify_state
379
		    (wnd, 1, g_net_wm_state_maximized_vert_atom,
380
		     g_net_wm_state_maximized_horz_atom) < 0)
381
			return -1;
382
	}
383
	else
384
	{
385
		if (ewmh_modify_state
386
		    (wnd, 0, g_net_wm_state_maximized_vert_atom,
387
		     g_net_wm_state_maximized_horz_atom) < 0)
388
			return -1;
389
	}
390
391
	return 0;
392
}
393
394
395
int
396
ewmh_get_window_desktop(Window wnd)
397
{
398
	unsigned long nitems_return;
399
	unsigned char *prop_return;
400
	int desktop;
401
402
	if (get_property_value(wnd, "_NET_WM_DESKTOP", 1, &nitems_return, &prop_return, 0) < 0)
403
		return (-1);
404
405
	if (nitems_return != 1)
406
	{
407
		fprintf(stderr, "_NET_WM_DESKTOP has bad length\n");
408
		return (-1);
409
	}
410
411
	desktop = *prop_return;
412
	XFree(prop_return);
413
	return desktop;
414
}
415
416
417
int
418
ewmh_move_to_desktop(Window wnd, unsigned int desktop)
419
{
420
	Status status;
421
	XEvent xevent;
422
423
	xevent.type = ClientMessage;
424
	xevent.xclient.window = wnd;
425
	xevent.xclient.message_type = g_net_wm_desktop_atom;
426
	xevent.xclient.format = 32;
427
	xevent.xclient.data.l[0] = desktop;
428
	xevent.xclient.data.l[1] = 0;
429
	xevent.xclient.data.l[2] = 0;
430
	xevent.xclient.data.l[3] = 0;
431
	xevent.xclient.data.l[4] = 0;
432
	status = XSendEvent(g_display, DefaultRootWindow(g_display), False,
433
			    SubstructureNotifyMask | SubstructureRedirectMask, &xevent);
434
	if (!status)
435
		return -1;
436
437
	return 0;
438
}
439
440
void
441
ewmh_set_wm_name(Window wnd, const char *title)
442
{
443
	int len;
444
445
	len = strlen(title);
446
	XChangeProperty(g_display, wnd, g_net_wm_name_atom, g_utf8_string_atom,
447
			8, PropModeReplace, (unsigned char *) title, len);
448
}
449
450
451
int
452
ewmh_set_window_popup(Window wnd)
453
{
454
	if (ewmh_modify_state
455
	    (wnd, 1, g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom) < 0)
456
		return -1;
457
	return 0;
458
}
459
460
int
461
ewmh_set_window_modal(Window wnd)
462
{
463
	if (ewmh_modify_state(wnd, 1, g_net_wm_state_modal_atom, 0) < 0)
464
		return -1;
465
	return 0;
466
}
467
468
void
469
ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data)
470
{
471
	unsigned long nitems, i;
472
	unsigned char *props;
473
	unsigned long *cur_set, *new_set;
474
	unsigned long *icon;
475
476
	cur_set = NULL;
477
	new_set = NULL;
478
479
	if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) >= 0)
480
	{
481
		cur_set = (unsigned long *) props;
482
483
		for (i = 0; i < nitems;)
484
		{
485
			if (cur_set[i] == width && cur_set[i + 1] == height)
486
				break;
487
488
			i += 2 + cur_set[i] * cur_set[i + 1];
489
		}
490
491
		if (i != nitems)
492
			icon = cur_set + i;
493
		else
494
		{
495
			new_set = xmalloc((nitems + width * height + 2) * sizeof(unsigned long));
496
			memcpy(new_set, cur_set, nitems * sizeof(unsigned long));
497
			icon = new_set + nitems;
498
			nitems += width * height + 2;
499
		}
500
	}
501
	else
502
	{
503
		new_set = xmalloc((width * height + 2) * sizeof(unsigned long));
504
		icon = new_set;
505
		nitems = width * height + 2;
506
	}
507
508
	icon[0] = width;
509
	icon[1] = height;
510
511
	/* Convert RGBA -> ARGB */
512
	for (i = 0; i < width * height; i++)
513
	{
514
		icon[i + 2] =
515
			rgba_data[i * 4 + 3] << 24 |
516
			((rgba_data[i * 4 + 0] << 16) & 0x00FF0000) |
517
			((rgba_data[i * 4 + 1] << 8) & 0x0000FF00) |
518
			((rgba_data[i * 4 + 2] << 0) & 0x000000FF);
519
	}
520
521
	XChangeProperty(g_display, wnd, g_net_wm_icon_atom, XA_CARDINAL, 32,
522
			PropModeReplace, (unsigned char *) (new_set ? new_set : cur_set), nitems);
523
524
	if (cur_set)
525
		XFree(cur_set);
526
	if (new_set)
527
		free(new_set);
528
}
529
530
void
531
ewmh_del_icon(Window wnd, int width, int height)
532
{
533
	unsigned long nitems, i, icon_size;
534
	unsigned char *props;
535
	unsigned long *cur_set, *new_set;
536
537
	cur_set = NULL;
538
	new_set = NULL;
539
540
	if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) < 0)
541
		return;
542
543
	cur_set = (unsigned long *) props;
544
545
	for (i = 0; i < nitems;)
546
	{
547
		if (cur_set[i] == width && cur_set[i + 1] == height)
548
			break;
549
550
		i += 2 + cur_set[i] * cur_set[i + 1];
551
	}
552
553
	if (i == nitems)
554
		goto out;
555
556
	icon_size = width * height + 2;
557
	new_set = xmalloc((nitems - icon_size) * sizeof(unsigned long));
558
559
	if (i != 0)
560
		memcpy(new_set, cur_set, i * sizeof(unsigned long));
561
	if (i != nitems - icon_size)
562
		memcpy(new_set + i, cur_set + i + icon_size,
563
		       (nitems - (i + icon_size)) * sizeof(unsigned long));
564
565
	nitems -= icon_size;
566
567
	XChangeProperty(g_display, wnd, g_net_wm_icon_atom, XA_CARDINAL, 32,
568
			PropModeReplace, (unsigned char *) new_set, nitems);
569
570
	free(new_set);
571
572
      out:
573
	XFree(cur_set);
574
}
575
576
int
577
ewmh_set_window_above(Window wnd)
578
{
579
	if (ewmh_modify_state(wnd, 1, g_net_wm_state_above_atom, 0) < 0)
580
		return -1;
581
	return 0;
582
}
583
584
#endif /* MAKE_PROTO */
585
586
587
#if 0
588
589
/* FIXME: _NET_MOVERESIZE_WINDOW is for pagers, not for
590
   applications. We should implement _NET_WM_MOVERESIZE instead */
591
592
int
593
ewmh_net_moveresize_window(Window wnd, int x, int y, int width, int height)
594
{
595
	Status status;
596
	XEvent xevent;
597
	Atom moveresize;
598
599
	moveresize = XInternAtom(g_display, "_NET_MOVERESIZE_WINDOW", False);
600
	if (!moveresize)
601
	{
602
		return -1;
603
	}
604
605
	xevent.type = ClientMessage;
606
	xevent.xclient.window = wnd;
607
	xevent.xclient.message_type = moveresize;
608
	xevent.xclient.format = 32;
609
	xevent.xclient.data.l[0] = StaticGravity | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11);
610
	xevent.xclient.data.l[1] = x;
611
	xevent.xclient.data.l[2] = y;
612
	xevent.xclient.data.l[3] = width;
613
	xevent.xclient.data.l[4] = height;
614
615
	status = XSendEvent(g_display, DefaultRootWindow(g_display), False,
616
			    SubstructureNotifyMask | SubstructureRedirectMask, &xevent);
617
	if (!status)
618
		return -1;
619
	return 0;
620
}
621
622
#endif
(-)tigervnc/unix/vncviewer/Makefile.in (-4 / +19 lines)
Lines 1-4 Link Here
1
# Makefile.in generated by automake 1.11 from Makefile.am.
1
# Makefile.in generated by automake 1.11.1 from Makefile.am.
2
# @configure_input@
2
# @configure_input@
3
3
4
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
Lines 57-63 Link Here
57
am__objects_1 =
57
am__objects_1 =
58
am_vncviewer_OBJECTS = $(am__objects_1) \
58
am_vncviewer_OBJECTS = $(am__objects_1) \
59
	vncviewer-DesktopWindow.$(OBJEXT) vncviewer-CConn.$(OBJEXT) \
59
	vncviewer-DesktopWindow.$(OBJEXT) vncviewer-CConn.$(OBJEXT) \
60
	vncviewer-vncviewer.$(OBJEXT) vncviewer-buildtime.$(OBJEXT)
60
	vncviewer-vncviewer.$(OBJEXT) vncviewer-buildtime.$(OBJEXT) \
61
	vncviewer-ewmhints.$(OBJEXT)
61
vncviewer_OBJECTS = $(am_vncviewer_OBJECTS)
62
vncviewer_OBJECTS = $(am_vncviewer_OBJECTS)
62
vncviewer_DEPENDENCIES = $(top_builddir)/unix/tx/libtx.la \
63
vncviewer_DEPENDENCIES = $(top_builddir)/unix/tx/libtx.la \
63
	$(top_builddir)/common/rfb/librfb.la \
64
	$(top_builddir)/common/rfb/librfb.la \
Lines 179-185 Link Here
179
PACKAGE_NAME = @PACKAGE_NAME@
180
PACKAGE_NAME = @PACKAGE_NAME@
180
PACKAGE_STRING = @PACKAGE_STRING@
181
PACKAGE_STRING = @PACKAGE_STRING@
181
PACKAGE_TARNAME = @PACKAGE_TARNAME@
182
PACKAGE_TARNAME = @PACKAGE_TARNAME@
182
PACKAGE_URL = @PACKAGE_URL@
183
PACKAGE_VERSION = @PACKAGE_VERSION@
183
PACKAGE_VERSION = @PACKAGE_VERSION@
184
PATH_SEPARATOR = @PATH_SEPARATOR@
184
PATH_SEPARATOR = @PATH_SEPARATOR@
185
POSUB = @POSUB@
185
POSUB = @POSUB@
Lines 260-266 Link Here
260
	OptionsDialog.h parameters.h PasswdDialog.h ServerDialog.h
260
	OptionsDialog.h parameters.h PasswdDialog.h ServerDialog.h
261
261
262
vncviewer_SOURCES = $(HDRS) DesktopWindow.cxx CConn.cxx vncviewer.cxx \
262
vncviewer_SOURCES = $(HDRS) DesktopWindow.cxx CConn.cxx vncviewer.cxx \
263
	buildtime.c
263
	buildtime.c ewmhints.c
264
264
265
# X_CFLAGS are really CPPFLAGS
265
# X_CFLAGS are really CPPFLAGS
266
vncviewer_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/unix \
266
vncviewer_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/unix \
Lines 364-369 Link Here
364
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-CConn.Po@am__quote@
364
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-CConn.Po@am__quote@
365
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-DesktopWindow.Po@am__quote@
365
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-DesktopWindow.Po@am__quote@
366
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-buildtime.Po@am__quote@
366
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-buildtime.Po@am__quote@
367
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-ewmhints.Po@am__quote@
367
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-vncviewer.Po@am__quote@
368
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer-vncviewer.Po@am__quote@
368
369
369
.c.o:
370
.c.o:
Lines 401-406 Link Here
401
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
402
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
402
@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vncviewer-buildtime.obj `if test -f 'buildtime.c'; then $(CYGPATH_W) 'buildtime.c'; else $(CYGPATH_W) '$(srcdir)/buildtime.c'; fi`
403
@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vncviewer-buildtime.obj `if test -f 'buildtime.c'; then $(CYGPATH_W) 'buildtime.c'; else $(CYGPATH_W) '$(srcdir)/buildtime.c'; fi`
403
404
405
vncviewer-ewmhints.o: ewmhints.c
406
@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vncviewer-ewmhints.o -MD -MP -MF $(DEPDIR)/vncviewer-ewmhints.Tpo -c -o vncviewer-ewmhints.o `test -f 'ewmhints.c' || echo '$(srcdir)/'`ewmhints.c
407
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/vncviewer-ewmhints.Tpo $(DEPDIR)/vncviewer-ewmhints.Po
408
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='ewmhints.c' object='vncviewer-ewmhints.o' libtool=no @AMDEPBACKSLASH@
409
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
410
@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vncviewer-ewmhints.o `test -f 'ewmhints.c' || echo '$(srcdir)/'`ewmhints.c
411
412
vncviewer-ewmhints.obj: ewmhints.c
413
@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vncviewer-ewmhints.obj -MD -MP -MF $(DEPDIR)/vncviewer-ewmhints.Tpo -c -o vncviewer-ewmhints.obj `if test -f 'ewmhints.c'; then $(CYGPATH_W) 'ewmhints.c'; else $(CYGPATH_W) '$(srcdir)/ewmhints.c'; fi`
414
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/vncviewer-ewmhints.Tpo $(DEPDIR)/vncviewer-ewmhints.Po
415
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='ewmhints.c' object='vncviewer-ewmhints.obj' libtool=no @AMDEPBACKSLASH@
416
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
417
@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vncviewer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vncviewer-ewmhints.obj `if test -f 'ewmhints.c'; then $(CYGPATH_W) 'ewmhints.c'; else $(CYGPATH_W) '$(srcdir)/ewmhints.c'; fi`
418
404
.cxx.o:
419
.cxx.o:
405
@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
420
@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
406
@am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
421
@am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
(-)tigervnc/unix/vncviewer/ewmhints.h (+11 lines)
Line 0 Link Here
1
#ifdef __cplusplus
2
extern "C" {
3
#endif
4
5
void ewmh_init(Display *display);
6
int ewmh_state_fullscreen(Window wnd, Bool fullscreen);
7
8
#ifdef __cplusplus
9
}
10
#endif
11
(-)tigervnc/unix/vncviewer/CConn.cxx (-7 / +16 lines)
Lines 40-45 Link Here
40
#include "ServerDialog.h"
40
#include "ServerDialog.h"
41
#include "PasswdDialog.h"
41
#include "PasswdDialog.h"
42
#include "parameters.h"
42
#include "parameters.h"
43
#include "ewmhints.h"
43
44
44
using namespace rfb;
45
using namespace rfb;
45
46
Lines 65-70 Link Here
65
    menuKeysym(0), menu(dpy, this), options(dpy, this), about(dpy), info(dpy),
66
    menuKeysym(0), menu(dpy, this), options(dpy, this), about(dpy), info(dpy),
66
    reverseConnection(reverse), firstUpdate(true), pendingUpdate(false)
67
    reverseConnection(reverse), firstUpdate(true), pendingUpdate(false)
67
{
68
{
69
  ewmh_init(dpy);
68
  CharArray menuKeyStr(menuKey.getData());
70
  CharArray menuKeyStr(menuKey.getData());
69
  menuKeysym = XStringToKeysym(menuKeyStr.buf);
71
  menuKeysym = XStringToKeysym(menuKeyStr.buf);
70
72
Lines 733-738 Link Here
733
  }
735
  }
734
  viewport->toplevel(windowNameStr.buf, this, argc, argv);
736
  viewport->toplevel(windowNameStr.buf, this, argc, argv);
735
  viewport->setBumpScroll(fullScreen);
737
  viewport->setBumpScroll(fullScreen);
738
#if 0
736
  XSetWindowAttributes attr;
739
  XSetWindowAttributes attr;
737
  attr.override_redirect = fullScreen;
740
  attr.override_redirect = fullScreen;
738
  XChangeWindowAttributes(dpy, viewport->win(), CWOverrideRedirect, &attr);
741
  XChangeWindowAttributes(dpy, viewport->win(), CWOverrideRedirect, &attr);
Lines 740-754 Link Here
740
  XChangeWindowAttributes(dpy, options.win(), CWOverrideRedirect, &attr);
743
  XChangeWindowAttributes(dpy, options.win(), CWOverrideRedirect, &attr);
741
  XChangeWindowAttributes(dpy, about.win(), CWOverrideRedirect, &attr);
744
  XChangeWindowAttributes(dpy, about.win(), CWOverrideRedirect, &attr);
742
  XChangeWindowAttributes(dpy, info.win(), CWOverrideRedirect, &attr);
745
  XChangeWindowAttributes(dpy, info.win(), CWOverrideRedirect, &attr);
743
  reconfigureViewport();
746
#endif
747
748
  ewmh_state_fullscreen(viewport->win(), fullScreen);
749
750
  //reconfigureViewport(); ??
751
744
  menu.setTransientFor(viewport->win());
752
  menu.setTransientFor(viewport->win());
745
  viewport->map();
753
  viewport->map();
746
  if (fullScreen) {
754
//  if (fullScreen) {
747
    XGrabKeyboard(dpy, desktop->win(), True, GrabModeAsync, GrabModeAsync,
755
//    XGrabKeyboard(dpy, desktop->win(), True, GrabModeAsync, GrabModeAsync,
748
                  CurrentTime);
756
//                  CurrentTime);
749
  } else {
757
//  } else {
750
    XUngrabKeyboard(dpy, CurrentTime);
758
//    XUngrabKeyboard(dpy, CurrentTime);
751
  }
759
//  }
760
//
752
  if (oldViewport) delete oldViewport;
761
  if (oldViewport) delete oldViewport;
753
}
762
}
754
763
(-)tigervnc/unix/vncviewer/Makefile.am (-1 / +1 lines)
Lines 6-12 Link Here
6
	OptionsDialog.h parameters.h PasswdDialog.h ServerDialog.h
6
	OptionsDialog.h parameters.h PasswdDialog.h ServerDialog.h
7
7
8
vncviewer_SOURCES = $(HDRS) DesktopWindow.cxx CConn.cxx vncviewer.cxx \
8
vncviewer_SOURCES = $(HDRS) DesktopWindow.cxx CConn.cxx vncviewer.cxx \
9
	buildtime.c
9
	buildtime.c ewmhints.c
10
# X_CFLAGS are really CPPFLAGS
10
# X_CFLAGS are really CPPFLAGS
11
vncviewer_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/unix \
11
vncviewer_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/unix \
12
	-I$(top_srcdir)/unix/tx -I$(top_srcdir)/intl \
12
	-I$(top_srcdir)/unix/tx -I$(top_srcdir)/intl \

Return to bug 1052