Merge lp:~muktupavels/compiz/drop-xig into lp:compiz/0.9.13

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4182
Merged at revision: 4180
Proposed branch: lp:~muktupavels/compiz/drop-xig
Merge into: lp:compiz/0.9.13
Prerequisite: lp:~muktupavels/compiz/cmp0002
Diff against target: 793 lines (+0/-729)
11 files modified
cmake/base.cmake (+0/-1)
tests/integration/CMakeLists.txt (+0/-1)
tests/integration/xig/CMakeLists.txt (+0/-31)
tests/integration/xig/scripts/existing-window.conf (+0/-27)
tests/integration/xig/scripts/new-window.conf (+0/-29)
tests/integration/xig/scripts/restart.conf (+0/-18)
tests/integration/xig/scripts/startup.conf (+0/-14)
tests/integration/xig/scripts/xserver-quit.conf (+0/-13)
tests/integration/xig/src/CMakeLists.txt (+0/-12)
tests/integration/xig/src/config.h.in (+0/-3)
tests/integration/xig/src/test-runner.c (+0/-580)
To merge this branch: bzr merge lp:~muktupavels/compiz/drop-xig
Reviewer Review Type Date Requested Status
Dmitry Shachnev Approve
Compiz Maintainers Pending
Robert Ancell Pending
Review via email: mp+350724@code.launchpad.net

Commit message

Drop xig support.

To post a comment you must log in.
Revision history for this message
Dmitry Shachnev (mitya57) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/base.cmake'
2--- cmake/base.cmake 2015-12-10 16:34:35 +0000
3+++ cmake/base.cmake 2018-07-24 13:58:13 +0000
4@@ -10,7 +10,6 @@
5
6 compiz_print_result_message ("protocol buffers" USE_PROTOBUF)
7 compiz_print_result_message ("file system change notifications" HAVE_INOTIFY)
8- compiz_print_result_message ("Xig Tests" COMPIZ_XIG_TEST_FOUND)
9
10 compiz_print_configure_footer ()
11 compiz_print_plugin_stats ("${CMAKE_SOURCE_DIR}/plugins")
12
13=== modified file 'tests/integration/CMakeLists.txt'
14--- tests/integration/CMakeLists.txt 2012-12-02 12:06:02 +0000
15+++ tests/integration/CMakeLists.txt 2018-07-24 13:58:13 +0000
16@@ -1,2 +1,1 @@
17-add_subdirectory (xig)
18 add_subdirectory (glib)
19
20=== removed directory 'tests/integration/xig'
21=== removed file 'tests/integration/xig/CMakeLists.txt'
22--- tests/integration/xig/CMakeLists.txt 2012-01-21 13:37:47 +0000
23+++ tests/integration/xig/CMakeLists.txt 1970-01-01 00:00:00 +0000
24@@ -1,31 +0,0 @@
25-include (CompizCommon)
26-include (FindPkgConfig)
27-
28-pkg_check_modules (COMPIZ_XIG_TEST xig-0 glib-2.0 gobject-2.0)
29-
30-if (COMPIZ_XIG_TEST_FOUND)
31-
32- compiz_set (COMPIZ_XIG_TEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
33- compiz_set (COMPIZ_XIG_TEST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
34-
35- add_subdirectory (src)
36-
37- add_test (compiz-xig-test-startup
38- ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xig-test-runner startup)
39-
40- add_test (compiz-xig-test-restart
41- ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xig-test-runner restart)
42-
43- add_test (compiz-xig-test-xserver-quit
44- ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xig-test-runner xserver-quit)
45-
46- add_test (compiz-xig-test-new-window
47- ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xig-test-runner new-window)
48-
49- add_test (compiz-xig-test-existing-window
50- ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xig-test-runner existing-window)
51-
52-else (COMPIZ_XIG_TEST_FOUND)
53-
54- message (WARNING "Xig not found, you will not be able to run X Server integration tests")
55-endif (COMPIZ_XIG_TEST_FOUND)
56
57=== removed directory 'tests/integration/xig/scripts'
58=== removed file 'tests/integration/xig/scripts/existing-window.conf'
59--- tests/integration/xig/scripts/existing-window.conf 2012-01-20 16:29:27 +0000
60+++ tests/integration/xig/scripts/existing-window.conf 1970-01-01 00:00:00 +0000
61@@ -1,27 +0,0 @@
62-#
63-# Check Compiz correctly places a window
64-#
65-
66-# Place a window
67-#?*CREATE-WINDOW ID=123 X=0 Y=0 WIDTH=100 HEIGHT=100
68-#?*MAP-WINDOW ID=123
69-
70-# X server maps us (no window manager)
71-#?MAP-NOTIFY ID=123
72-
73-# Start Compiz
74-#?COMPIZ START
75-
76-# Compiz connects to X server
77-#?X CLIENT-CONNECTED
78-
79-# Compiz reparents us
80-#?UNMAP-NOTIFY ID=123
81-#?REPARENT-NOTIFY ID=123
82-#?MAP-NOTIFY ID=123
83-
84-# Cleanup
85-#?*STOP-COMPIZ
86-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
87-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
88-
89
90=== removed file 'tests/integration/xig/scripts/new-window.conf'
91--- tests/integration/xig/scripts/new-window.conf 2012-01-20 16:29:27 +0000
92+++ tests/integration/xig/scripts/new-window.conf 1970-01-01 00:00:00 +0000
93@@ -1,29 +0,0 @@
94-#
95-# Check Compiz correctly places a window
96-#
97-
98-# Start Compiz
99-#?COMPIZ START
100-
101-# Compiz connects to X server
102-#?X CLIENT-CONNECTED
103-
104-# Place a window
105-#?*CREATE-WINDOW ID=123 X=0 Y=0 WIDTH=100 HEIGHT=100
106-#?*MAP-WINDOW ID=123
107-
108-# FIXME: Compiz is reparentining after the map
109-#?MAP-NOTIFY ID=123
110-#?UNMAP-NOTIFY ID=123
111-
112-# Compiz reparents us
113-#?REPARENT-NOTIFY ID=123
114-
115-# Window is mapped by Compiz
116-#?MAP-NOTIFY ID=123
117-
118-# Cleanup
119-#?*STOP-COMPIZ
120-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
121-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
122-
123
124=== removed file 'tests/integration/xig/scripts/restart.conf'
125--- tests/integration/xig/scripts/restart.conf 2012-01-24 09:54:34 +0000
126+++ tests/integration/xig/scripts/restart.conf 1970-01-01 00:00:00 +0000
127@@ -1,18 +0,0 @@
128-#
129-# Check Compiz restarts
130-#
131-
132-# Start Compiz
133-#?COMPIZ START
134-
135-# Compiz connects to X server
136-#?X CLIENT-CONNECTED
137-
138-# Restart
139-#?*RESTART-COMPIZ
140-#?(X CLIENT-DISCONNECTED|X CLIENT-CONNECTED)
141-#?(X CLIENT-DISCONNECTED|X CLIENT-CONNECTED|)
142-
143-#?*STOP-COMPIZ
144-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
145-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
146
147=== removed file 'tests/integration/xig/scripts/startup.conf'
148--- tests/integration/xig/scripts/startup.conf 2012-01-20 16:29:27 +0000
149+++ tests/integration/xig/scripts/startup.conf 1970-01-01 00:00:00 +0000
150@@ -1,14 +0,0 @@
151-#
152-# Check Compiz starts
153-#
154-
155-# Start Compiz
156-#?COMPIZ START
157-
158-# Compiz connects to X server
159-#?X CLIENT-CONNECTED
160-
161-# Cleanup
162-#?*STOP-COMPIZ
163-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
164-#?(X CLIENT-DISCONNECTED|COMPIZ EXIT STATUS=0)
165
166=== removed file 'tests/integration/xig/scripts/xserver-quit.conf'
167--- tests/integration/xig/scripts/xserver-quit.conf 2012-01-20 16:29:27 +0000
168+++ tests/integration/xig/scripts/xserver-quit.conf 1970-01-01 00:00:00 +0000
169@@ -1,13 +0,0 @@
170-#
171-# Check Compiz quits with an error when the X server quits
172-#
173-
174-# Start Compiz
175-#?COMPIZ START
176-
177-# Compiz connects to X server
178-#?X CLIENT-CONNECTED
179-
180-# Cleanup
181-#?*STOP-XSERVER
182-#?COMPIZ EXIT STATUS=1
183
184=== removed directory 'tests/integration/xig/src'
185=== removed file 'tests/integration/xig/src/CMakeLists.txt'
186--- tests/integration/xig/src/CMakeLists.txt 2012-01-20 16:29:27 +0000
187+++ tests/integration/xig/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
188@@ -1,12 +0,0 @@
189-include_directories (${COMPIZ_XIG_TEST_INCLUDE_DIRS}
190- ${CMAKE_CURRENT_BINARY_DIR})
191-link_directories (${COMPIZ_XIG_TEST_LIBRARY_DIRS})
192-
193-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
194- ${CMAKE_CURRENT_BINARY_DIR}/config.h)
195-
196-add_executable (compiz-xig-test-runner
197- test-runner.c)
198-
199-target_link_libraries (compiz-xig-test-runner
200- ${COMPIZ_XIG_TEST_LIBRARIES})
201
202=== removed file 'tests/integration/xig/src/config.h.in'
203--- tests/integration/xig/src/config.h.in 2012-01-20 16:29:27 +0000
204+++ tests/integration/xig/src/config.h.in 1970-01-01 00:00:00 +0000
205@@ -1,3 +0,0 @@
206-#define COMPIZ_XIG_TEST_SOURCE_DIR "@COMPIZ_XIG_TEST_SOURCE_DIR@"
207-#define COMPIZ_XIG_TEST_BINARY_DIR "@COMPIZ_XIG_TEST_BINARY_DIR@"
208-#define compiz_BINARY_DIR "@compiz_BINARY_DIR@"
209
210=== removed file 'tests/integration/xig/src/test-runner.c'
211--- tests/integration/xig/src/test-runner.c 2012-12-01 17:57:53 +0000
212+++ tests/integration/xig/src/test-runner.c 1970-01-01 00:00:00 +0000
213@@ -1,580 +0,0 @@
214-#include <stdlib.h>
215-#include <stdio.h>
216-#include <string.h>
217-#include <ctype.h>
218-#include <errno.h>
219-#include <glib.h>
220-#include <gio/gio.h>
221-#include <unistd.h>
222-#include <sys/types.h>
223-#include <sys/socket.h>
224-#include <sys/un.h>
225-#include <sys/wait.h>
226-#include <config.h>
227-
228-#include <xig.h>
229-
230-/* For some reason sys/un.h doesn't define this */
231-#ifndef UNIX_PATH_MAX
232-#define UNIX_PATH_MAX 108
233-#endif
234-
235-/* Timeout in ms waiting for the status we expect */
236-#define STATUS_TIMEOUT 2000
237-
238-/* Timeout in ms to wait for SIGTERM to kill compiz */
239-#define KILL_TIMEOUT 2000
240-
241-static XigServer *xserver;
242-static GKeyFile *config;
243-static GPid compiz_pid = 0;
244-static GList *statuses = NULL;
245-static GList *script = NULL;
246-static GList *script_iter = NULL;
247-static guint status_timeout = 0;
248-static gboolean failed = FALSE;
249-static guint compiz_kill_timeout = 0;
250-
251-static void check_status (const gchar *status);
252-
253-static gboolean
254-compiz_kill_timeout_cb (gpointer data)
255-{
256- if (getenv ("DEBUG"))
257- g_print ("Sending SIGKILL to compiz\n");
258- kill (compiz_pid, SIGKILL);
259- compiz_kill_timeout = 0;
260- return FALSE;
261-}
262-
263-static void
264-stop_compiz ()
265-{
266- if (compiz_pid && compiz_kill_timeout == 0)
267- {
268- if (getenv ("DEBUG"))
269- g_print ("Sending SIGTERM to compiz process %d\n", compiz_pid);
270- kill (compiz_pid, SIGINT);
271- compiz_kill_timeout = g_timeout_add (KILL_TIMEOUT, compiz_kill_timeout_cb, NULL);
272- }
273-}
274-
275-static void
276-restart_compiz ()
277-{
278- if (compiz_pid)
279- {
280- if (getenv ("DEBUG"))
281- g_print ("Sending SIGHUP to compiz process %d\n", compiz_pid);
282- kill (compiz_pid, SIGHUP);
283- }
284-}
285-
286-static void
287-quit (int status)
288-{
289- if (xserver)
290- xig_server_stop (xserver);
291- if (compiz_pid)
292- kill (compiz_pid, SIGKILL);
293-
294- exit (status);
295-}
296-
297-static void
298-fail (const gchar *event, const gchar *expected)
299-{
300- GList *link;
301-
302- if (failed)
303- return;
304- failed = TRUE;
305-
306- g_printerr ("Test failed, got the following events:\n");
307- for (link = statuses; link; link = link->next)
308- g_printerr (" %s\n", (gchar *)link->data);
309- if (event)
310- g_printerr (" %s\n", event);
311- if (expected)
312- g_printerr (" ^^^ expected \"%s\"\n", expected);
313- else
314- g_printerr ("^^^ expected nothing\n");
315-
316- /* Either wait for the compiz to quit, or stop now if it already is */
317- if (compiz_pid)
318- stop_compiz ();
319- else
320- quit (EXIT_FAILURE);
321-}
322-
323-static gchar *
324-get_script_line ()
325-{
326- if (!script_iter)
327- return NULL;
328- return script_iter->data;
329-}
330-
331-static void
332-compiz_exit_cb (GPid pid, gint status, gpointer data)
333-{
334- gchar *status_text;
335-
336- compiz_pid = 0;
337-
338- if (compiz_kill_timeout)
339- g_source_remove (compiz_kill_timeout);
340- compiz_kill_timeout = 0;
341-
342- /* Quit when compiz does */
343- if (failed)
344- quit (EXIT_FAILURE);
345-
346- if (WIFEXITED (status))
347- status_text = g_strdup_printf ("COMPIZ EXIT STATUS=%d", WEXITSTATUS (status));
348- else
349- status_text = g_strdup_printf ("COMPIZ TERMINATE SIGNAL=%d", WTERMSIG (status));
350- check_status (status_text);
351- g_free (status_text);
352-}
353-
354-static void
355-unmap_notify_cb (XigWindow *window)
356-{
357- gchar *status_text;
358-
359- status_text = g_strdup_printf ("UNMAP-NOTIFY ID=%d", xig_window_get_id (window));
360- check_status (status_text);
361- g_free (status_text);
362-}
363-
364-static void
365-map_notify_cb (XigWindow *window)
366-{
367- gchar *status_text;
368-
369- status_text = g_strdup_printf ("MAP-NOTIFY ID=%d", xig_window_get_id (window));
370- check_status (status_text);
371- g_free (status_text);
372-}
373-
374-static void
375-reparent_notify_cb (XigWindow *window)
376-{
377- gchar *status_text;
378-
379- status_text = g_strdup_printf ("REPARENT-NOTIFY ID=%d", xig_window_get_id (window));
380- check_status (status_text);
381- g_free (status_text);
382-}
383-
384-static void
385-configure_notify_cb (XigWindow *window)
386-{
387- gchar *status_text;
388-
389- status_text = g_strdup_printf ("CONFIGURE-NOTIFY ID=%d", xig_window_get_id (window));
390- check_status (status_text);
391- g_free (status_text);
392-}
393-
394-static void
395-run_commands ()
396-{
397- /* Stop compiz if requested */
398- while (TRUE)
399- {
400- gchar *command, *name = NULL, *c;
401- GHashTable *params;
402-
403- command = get_script_line ();
404- if (!command)
405- break;
406-
407- /* Commands start with an asterisk */
408- if (command[0] != '*')
409- break;
410- statuses = g_list_append (statuses, g_strdup (command));
411- script_iter = script_iter->next;
412-
413- c = command + 1;
414- while (*c && !isspace (*c))
415- c++;
416- name = g_strdup_printf ("%.*s", (int) (c - command - 1), command + 1);
417-
418- params = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
419- while (TRUE)
420- {
421- gchar *start, *param_name, *param_value;
422-
423- while (isspace (*c))
424- c++;
425- start = c;
426- while (*c && !isspace (*c) && *c != '=')
427- c++;
428- if (*c == '\0')
429- break;
430-
431- param_name = g_strdup_printf ("%.*s", (int) (c - start), start);
432-
433- if (*c == '=')
434- {
435- c++;
436- while (isspace (*c))
437- c++;
438- if (*c == '\"')
439- {
440- gboolean escaped = FALSE;
441- GString *value;
442-
443- c++;
444- value = g_string_new ("");
445- while (*c)
446- {
447- if (*c == '\\')
448- {
449- if (escaped)
450- {
451- g_string_append_c (value, '\\');
452- escaped = FALSE;
453- }
454- else
455- escaped = TRUE;
456- }
457- else if (!escaped && *c == '\"')
458- break;
459- if (!escaped)
460- g_string_append_c (value, *c);
461- c++;
462- }
463- param_value = value->str;
464- g_string_free (value, FALSE);
465- if (*c == '\"')
466- c++;
467- }
468- else
469- {
470- start = c;
471- while (*c && !isspace (*c))
472- c++;
473- param_value = g_strdup_printf ("%.*s", (int) (c - start), start);
474- }
475- }
476- else
477- param_value = g_strdup ("");
478-
479- g_hash_table_insert (params, param_name, param_value);
480- }
481-
482- if (strcmp (name, "STOP-XSERVER") == 0)
483- xig_server_stop (xserver);
484- else if (strcmp (name, "STOP-COMPIZ") == 0)
485- stop_compiz ();
486- else if (strcmp (name, "RESTART-COMPIZ") == 0)
487- restart_compiz ();
488- else if (strcmp (name, "CREATE-WINDOW") == 0)
489- {
490- XigWindow *root, *window;
491- gchar *v;
492- guint32 id = 0;
493- gint16 x = 0, y = 0;
494- guint16 width = 0, height = 0, border_width = 0;
495-
496- v = g_hash_table_lookup (params, "ID");
497- if (v)
498- id = atoi (v);
499- v = g_hash_table_lookup (params, "X");
500- if (v)
501- x = atoi (v);
502- v = g_hash_table_lookup (params, "Y");
503- if (v)
504- y = atoi (v);
505- v = g_hash_table_lookup (params, "WIDTH");
506- if (v)
507- width = atoi (v);
508- v = g_hash_table_lookup (params, "HEIGHT");
509- if (v)
510- height = atoi (v);
511- v = g_hash_table_lookup (params, "BORDER-WIDTH");
512- if (v)
513- border_width = atoi (v);
514-
515- root = xig_server_get_root (xserver, 0);
516- window = xig_window_add_child (root, NULL, id,
517- XIG_WINDOW_CLASS_InputOutput,
518- x, y, width, height, border_width,
519- xig_window_get_visual (root),
520- 0, NULL, 0, NULL, 0, 0, 0, 0, 0, 0, FALSE, FALSE);
521- g_signal_connect (window, "unmap-notify", G_CALLBACK (unmap_notify_cb), NULL);
522- g_signal_connect (window, "map-notify", G_CALLBACK (map_notify_cb), NULL);
523- g_signal_connect (window, "reparent-notify", G_CALLBACK (reparent_notify_cb), NULL);
524- g_signal_connect (window, "configure-notify", G_CALLBACK (configure_notify_cb), NULL);
525- }
526- else if (strcmp (name, "MAP-WINDOW") == 0)
527- {
528- gchar *v;
529- guint32 id = 0;
530- XigWindow *window;
531-
532- v = g_hash_table_lookup (params, "ID");
533- if (v)
534- id = atoi (v);
535-
536- window = xig_server_get_window (xserver, id);
537- xig_window_map (window, NULL);
538- }
539- else
540- {
541- g_printerr ("Unknown command '%s'\n", name);
542- quit (EXIT_FAILURE);
543- return;
544- }
545-
546- g_free (name);
547- g_hash_table_unref (params);
548- }
549-
550- gchar *l = get_script_line ();
551-
552- /* Stop at the end of the script */
553- if (l == NULL)
554- {
555- if (compiz_pid)
556- stop_compiz ();
557- else
558- quit (EXIT_SUCCESS);
559- }
560-}
561-
562-static gboolean
563-status_timeout_cb (gpointer data)
564-{
565- fail ("(timeout)", get_script_line ());
566- status_timeout = 0;
567- return FALSE;
568-}
569-
570-static void
571-check_status (const gchar *status)
572-{
573- gchar *pattern;
574-
575- if (getenv ("DEBUG"))
576- g_print ("%s\n", status);
577-
578- if (failed)
579- return;
580-
581- statuses = g_list_append (statuses, g_strdup (status));
582-
583- /* Try and match against expected */
584- pattern = get_script_line ();
585- if (!pattern || !g_regex_match_simple (pattern, status, 0, 0))
586- {
587- fail (NULL, pattern);
588- return;
589- }
590- script_iter = script_iter->next;
591-
592- /* Restart timeout */
593- if (status_timeout)
594- g_source_remove (status_timeout);
595- status_timeout = g_timeout_add (STATUS_TIMEOUT, status_timeout_cb, NULL);
596-
597- run_commands ();
598-}
599-
600-static void
601-signal_cb (int signum)
602-{
603- if (compiz_pid != 0)
604- {
605- if (compiz_pid)
606- {
607- g_print ("Caught signal %d, killing Compiz\n", signum);
608- kill (compiz_pid, SIGKILL);
609- }
610- else
611- g_print ("Caught signal %d, quitting\n", signum);
612- }
613- else
614- {
615- g_print ("Caught signal %d, quitting\n", signum);
616- quit (EXIT_FAILURE);
617- }
618-}
619-
620-static void
621-load_script (const gchar *filename)
622-{
623- int i;
624- gchar *data, **lines;
625-
626- if (!g_file_get_contents (filename, &data, NULL, NULL))
627- {
628- g_printerr ("Unable to load script: %s\n", filename);
629- quit (EXIT_FAILURE);
630- }
631-
632- lines = g_strsplit (data, "\n", -1);
633- g_free (data);
634-
635- /* Load lines with #? prefix as expected behaviour */
636- for (i = 0; lines[i]; i++)
637- {
638- gchar *line = g_strstrip (lines[i]);
639- if (g_str_has_prefix (line, "#?"))
640- script = g_list_append (script, g_strdup (line+2));
641- }
642- script_iter = script;
643- g_strfreev (lines);
644-}
645-
646-static void
647-client_connected_cb (XigServer *server,
648- XigRemoteClient *client)
649-{
650- check_status ("X CLIENT-CONNECTED");
651-}
652-
653-static void
654-client_disconnected_cb (XigServer *server, XigRemoteClient *client)
655-{
656- check_status ("X CLIENT-DISCONNECTED");
657-}
658-
659-static gboolean
660-client_stdout_cb (GIOChannel *source,
661- GIOCondition condition,
662- gpointer data)
663-{
664- gchar *str_return;
665- gsize length;
666- gsize terminator_pos;
667- GError *error;
668-
669- if (condition & G_IO_IN)
670- {
671- while (g_io_channel_read_line (source,
672- &str_return,
673- &length,
674- &terminator_pos,
675- &error) == G_IO_STATUS_NORMAL)
676- {
677- if (getenv ("DEBUG"))
678- g_print ("%s", str_return);
679- }
680- }
681-
682- return TRUE;
683-}
684-
685-int
686-main (int argc, char **argv)
687-{
688- GMainLoop *loop;
689- XigScreen *screen;
690- XigVisual *visual;
691- gchar *script_name, *config_file, *config_path;
692- GString *command_line;
693- gchar **compiz_env, **compiz_argv;
694- gint compiz_stdin, compiz_stdout, compiz_stderr;
695- GIOChannel *compiz_stdout_channel = NULL;
696- GError *error = NULL;
697-
698- signal (SIGINT, signal_cb);
699- signal (SIGTERM, signal_cb);
700-
701- g_type_init ();
702-
703- loop = g_main_loop_new (NULL, FALSE);
704-
705- if (argc != 2)
706- {
707- g_printerr ("Usage %s SCRIPT-NAME\n", argv[0]);
708- quit (EXIT_FAILURE);
709- }
710- script_name = argv[1];
711- config_file = g_strdup_printf ("%s.conf", script_name);
712- config_path = g_build_filename (COMPIZ_XIG_TEST_SOURCE_DIR "/scripts", config_file, NULL);
713- g_free (config_file);
714-
715- config = g_key_file_new ();
716- g_key_file_load_from_file (config, config_path, G_KEY_FILE_NONE, NULL);
717-
718- load_script (config_path);
719-
720- /* Disable config if requested */
721- if (g_key_file_has_key (config, "test-runner-config", "have-config", NULL) &&
722- !g_key_file_get_boolean (config, "test-runner-config", "have-config", NULL))
723- config_path = NULL;
724-
725- g_print ("----------------------------------------\n");
726- g_print ("Running script %s\n", script_name);
727-
728- /* Create an X server to test with */
729- xserver = xig_server_new ("compiz-test", 99);
730- xig_server_set_listen_tcp (xserver, FALSE);
731- g_signal_connect (xserver, "client-connected", G_CALLBACK (client_connected_cb), NULL);
732- g_signal_connect (xserver, "client-disconnected", G_CALLBACK (client_disconnected_cb), NULL);
733- xig_server_add_pixmap_format (xserver, 1, 1, 32);
734- xig_server_add_pixmap_format (xserver, 4, 8, 32);
735- xig_server_add_pixmap_format (xserver, 8, 8, 32);
736- xig_server_add_pixmap_format (xserver, 15, 16, 32);
737- xig_server_add_pixmap_format (xserver, 16, 16, 32);
738- xig_server_add_pixmap_format (xserver, 24, 32, 32);
739- xig_server_add_pixmap_format (xserver, 32, 32, 32);
740- screen = xig_server_add_screen (xserver, 0x00FFFFFF, 0x00000000, 1024, 768, 1024, 768);
741- visual = xig_screen_add_visual (screen, 24, XIG_VISUAL_CLASS_TrueColor, 8, 1, 0x00FF0000, 0x0000FF00, 0x000000FF);
742- xig_screen_add_root (screen, visual);
743-
744- run_commands ();
745-
746- status_timeout = g_timeout_add (STATUS_TIMEOUT, status_timeout_cb, NULL);
747-
748- if (!xig_server_start (xserver, &error))
749- {
750- g_printerr ("Failed to start Xig X server: %s", error->message);
751- quit (EXIT_FAILURE);
752- }
753-
754- compiz_env = g_strsplit ("DISPLAY=:99", " ", -1);
755- command_line = g_string_new (compiz_BINARY_DIR "/src/compiz");
756- g_print ("Start Compiz with command: %s\n", command_line->str);
757- if (!g_shell_parse_argv (command_line->str, NULL, &compiz_argv, &error))
758- {
759- g_warning ("Error parsing command line: %s", error->message);
760- quit (EXIT_FAILURE);
761- }
762- g_clear_error (&error);
763- if (!g_spawn_async_with_pipes (NULL, /* working directory */
764- compiz_argv,
765- compiz_env,
766- G_SPAWN_DO_NOT_REAP_CHILD,
767- NULL, NULL, /* child setup */
768- &compiz_pid,
769- &compiz_stdin,
770- &compiz_stdout,
771- &compiz_stderr,
772- &error))
773- {
774- g_warning ("Error launching Compiz: %s", error->message);
775- quit (EXIT_FAILURE);
776- }
777- g_clear_error (&error);
778- g_child_watch_add (compiz_pid, compiz_exit_cb, NULL);
779- if (getenv ("DEBUG"))
780- g_print ("Compiz running with PID %d\n", compiz_pid);
781-
782- compiz_stdout_channel = g_io_channel_unix_new (compiz_stdout);
783- g_io_channel_set_flags (compiz_stdout_channel, G_IO_FLAG_NONBLOCK, NULL);
784- g_io_add_watch (compiz_stdout_channel, G_IO_IN, client_stdout_cb, NULL);
785-
786- check_status ("COMPIZ START");
787-
788- g_main_loop_run (loop);
789-
790- g_object_unref (compiz_stdout_channel);
791-
792- return EXIT_FAILURE;
793-}

Subscribers

People subscribed via source and target branches