commit 06e5a78

Michael Forney  ·  2013-06-14 03:34:09 +0000 UTC
parent e7d1aa7
Remove testwm
9 files changed,  +2, -475
+1, -1
1@@ -29,5 +29,5 @@ libswc_la_LIBADD = $(wayland_server_LIBS) $(udev_LIBS) $(xkbcommon_LIBS) \
2 # 
3 # testclient_LDADD = $(wayland_client_LIBS)
4 
5-SUBDIRS = i915 testwm
6+SUBDIRS = i915
7 
+1, -1
1@@ -32,6 +32,6 @@ PKG_CHECK_MODULES([wayland_client], [wayland-client])
2 dnl }}}
3 
4 #AC_CONFIG_HEADERS([config.h])
5-AC_CONFIG_FILES([Makefile i915/Makefile testwm/Makefile])
6+AC_CONFIG_FILES([Makefile i915/Makefile])
7 AC_OUTPUT
8 
+0, -13
 1@@ -1,13 +0,0 @@
 2-# testwm/Makefile.am
 3-
 4-AM_CFLAGS = -I.. $(pixman_CFLAGS)
 5-
 6-bin_PROGRAMS = testwm
 7-
 8-testwm_SOURCES = \
 9-	main.c \
10-	shell.c shell.h \
11-	shell_surface.c shell_surface.h
12-
13-testwm_LDADD = ../libswc.la $(wayland_server_LIBS)
14-
+0, -173
  1@@ -1,173 +0,0 @@
  2-#include "shell.h"
  3-
  4-#include <compositor.h>
  5-
  6-#include <stdio.h>
  7-#include <stdlib.h>
  8-#include <signal.h>
  9-#include <unistd.h>
 10-#include <sys/wait.h>
 11-
 12-#include <wayland-server.h>
 13-#include <xkbcommon/xkbcommon-keysyms.h>
 14-
 15-const char socket_name[] = "wayland-0";
 16-
 17-void handle_terminate(uint32_t time, uint32_t value, void * data)
 18-{
 19-    struct wl_display * display = data;
 20-    printf("handling terminate\n");
 21-    wl_display_terminate(display);
 22-}
 23-
 24-void handle_switch_vt(uint32_t time, uint32_t value, void * data)
 25-{
 26-    struct swc_tty * tty = data;
 27-    uint32_t vt = value - XKB_KEY_XF86Switch_VT_1 + 1;
 28-    printf("handle switch vt%u\n", vt);
 29-    swc_tty_switch_vt(tty, value - XKB_KEY_XF86Switch_VT_1 + 1);
 30-}
 31-
 32-void handle_test_shm(uint32_t time, uint32_t value, void * data)
 33-{
 34-    printf("handle test shm\n");
 35-    if (fork() == 0)
 36-    {
 37-        printf("launching shm\n");
 38-        execlp("/home/michael/scm/freedesktop/weston/clients/simple-shm", "simple-shm", NULL);
 39-        exit(EXIT_SUCCESS);
 40-    }
 41-}
 42-
 43-void handle_test_term(uint32_t time, uint32_t value, void * data)
 44-{
 45-    printf("handle test term\n");
 46-    if (fork() == 0)
 47-    {
 48-        printf("launching term\n");
 49-        execlp("weston-terminal", "weston-terminal", NULL);
 50-        exit(EXIT_SUCCESS);
 51-    }
 52-}
 53-
 54-void handle_test_info(uint32_t time, uint32_t value, void * data)
 55-{
 56-    printf("handle test info\n");
 57-    if (fork() == 0)
 58-    {
 59-        printf("launching info\n");
 60-        execlp("weston-info", "weston-info", NULL);
 61-        exit(EXIT_SUCCESS);
 62-    }
 63-}
 64-
 65-void handle_test_egl(uint32_t time, uint32_t value, void * data)
 66-{
 67-    printf("handle test egl\n");
 68-    if (fork() == 0)
 69-    {
 70-        printf("launching info\n");
 71-        execlp("/home/michael/scm/freedesktop/weston/clients/simple-egl", "simple-egl", NULL);
 72-        exit(EXIT_SUCCESS);
 73-    }
 74-}
 75-
 76-void handle_flip(uint32_t time, uint32_t value, void * data)
 77-{
 78-    struct swc_compositor * compositor = data;
 79-    struct swc_output * output;
 80-
 81-    output = wl_container_of(compositor->outputs.next, output, link);
 82-
 83-    printf("output: 0x%x\n", output);
 84-    printf("output id: %u\n", output->id);
 85-    printf("compositor: 0x%x\n", compositor);
 86-    printf("handle flip\n");
 87-    swc_renderer_repaint_output(&compositor->renderer, output, &compositor->surfaces);
 88-    swc_output_switch_buffer(output);
 89-}
 90-
 91-int handle_sigint(int signal_number, void * data)
 92-{
 93-    struct wl_display * display = data;
 94-    printf("handle sigint\n");
 95-    wl_display_terminate(display);
 96-
 97-    return 1;
 98-}
 99-
100-int handle_sigchld(int signal_number, void * data)
101-{
102-    printf("handle SIGCHLD\n");
103-    while (waitpid(-1, NULL, WNOHANG) != -1);
104-
105-    return 1;
106-}
107-
108-int main(int argc, char * argv[])
109-{
110-    struct wl_display * display;
111-    struct swc_compositor compositor;
112-    struct wl_event_loop * event_loop;
113-    struct wl_event_source * sigint_source, * sigchld_source;
114-    xkb_keysym_t keysym;
115-
116-    //struct shell shell;
117-
118-    display = wl_display_create();
119-
120-    wl_display_init_shm(display);
121-    wl_data_device_manager_init(display);
122-
123-    event_loop = wl_display_get_event_loop(display);
124-    sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, &handle_sigint,
125-                                             display);
126-
127-    sigchld_source = wl_event_loop_add_signal(event_loop, SIGCHLD, &handle_sigchld,
128-                                              NULL);
129-
130-    swc_compositor_initialize(&compositor, display);
131-    swc_compositor_add_globals(&compositor, display);
132-
133-    //shell_initialize(&shell, display);
134-
135-    swc_compositor_add_key_binding(&compositor,
136-        MOD_CTRL | MOD_ALT, XKB_KEY_BackSpace, &handle_terminate, display);
137-
138-    for (keysym = XKB_KEY_XF86Switch_VT_1;
139-         keysym <= XKB_KEY_XF86Switch_VT_12;
140-         ++keysym)
141-    {
142-        swc_compositor_add_key_binding(&compositor, MOD_ANY, keysym,
143-                                       &handle_switch_vt, &compositor.tty);
144-    }
145-
146-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_Return,
147-                                   &handle_test_term, NULL);
148-
149-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_1,
150-                                   &handle_test_info, NULL);
151-
152-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_2,
153-                                   &handle_test_shm, NULL);
154-
155-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_3,
156-                                   &handle_test_egl, NULL);
157-
158-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_0,
159-                                   &handle_flip, &compositor);
160-
161-    wl_display_add_socket(display, socket_name);
162-    setenv("WAYLAND_DISPLAY", socket_name, 1);
163-
164-    wl_display_run(display);
165-
166-    /* Cleanup */
167-    wl_event_source_remove(sigint_source);
168-    wl_event_source_remove(sigchld_source);
169-    swc_compositor_finish(&compositor);
170-    wl_display_destroy(display);
171-
172-    return EXIT_SUCCESS;
173-}
174-
+0, -29
 1@@ -1,29 +0,0 @@
 2-#include "shell.h"
 3-
 4-#include "shell_surface.h"
 5-
 6-static void get_shell_surface(struct wl_client * client,
 7-                              struct wl_resource * resource, uint32_t id,
 8-                              struct wl_resource * surface)
 9-{
10-    wl_client_add_object(client, &wl_shell_surface_interface,
11-                         &shell_surface_implementation, id, surface->data);
12-}
13-
14-struct wl_shell_interface shell_implementation = {
15-    .get_shell_surface = &get_shell_surface
16-};
17-
18-static void bind_shell(struct wl_client * client, void * data, uint32_t version,
19-                       uint32_t id)
20-{
21-    wl_client_add_object(client, &wl_shell_interface, &shell_implementation,
22-                         id, NULL);
23-}
24-
25-void shell_initialize(struct shell * shell, struct wl_display * display)
26-{
27-    wl_display_add_global(display, &wl_shell_interface, &shell_implementation,
28-                          &bind_shell);
29-}
30-
+0, -15
 1@@ -1,15 +0,0 @@
 2-#ifndef TESTWM_SHELL_H
 3-#define TESTWM_SHELL_H 1
 4-
 5-#include <wayland-server.h>
 6-
 7-struct shell
 8-{
 9-};
10-
11-extern struct wl_shell_interface shell_implementation;
12-
13-void shell_initialize(struct shell * shell, struct wl_display * display);
14-
15-#endif
16-
+0, -79
 1@@ -1,79 +0,0 @@
 2-#include "shell_surface.h"
 3-
 4-#include <stdlib.h>
 5-#include <wayland-server.h>
 6-
 7-static void pong(struct wl_client * client, struct wl_resource * resource,
 8-                 uint32_t serial)
 9-{
10-}
11-
12-static void move(struct wl_client * client, struct wl_resource * resource,
13-                 struct wl_resource * seat_resource, uint32_t serial)
14-{
15-}
16-
17-static void resize(struct wl_client * client, struct wl_resource * resource,
18-                   struct wl_resource * seat_resource, uint32_t serial,
19-                   uint32_t edges)
20-{
21-}
22-
23-static void set_toplevel(struct wl_client * client,
24-                         struct wl_resource * resource)
25-{
26-}
27-
28-static void set_transient(struct wl_client * client,
29-                          struct wl_resource * resource,
30-                          struct wl_resource * parent_resource,
31-                          int32_t x, int32_t y, uint32_t flags)
32-{
33-}
34-
35-static void set_fullscreen(struct wl_client * client,
36-                           struct wl_resource * resource, uint32_t method,
37-                           uint32_t framerate, struct wl_resource * output)
38-{
39-}
40-
41-static void set_popup(struct wl_client * client, struct wl_resource * resource,
42-                      struct wl_resource * seat_resource, uint32_t serial,
43-                      struct wl_resource * parent_resource,
44-                      int32_t x, int32_t y, uint32_t flags)
45-{
46-}
47-
48-static void set_maximized(struct wl_client * client,
49-                          struct wl_resource * resource,
50-                          struct wl_resource * output)
51-{
52-}
53-
54-static void set_class(struct wl_client * client, struct wl_resource * resource,
55-                      const char * class_)
56-{
57-}
58-
59-struct wl_shell_surface_interface shell_surface_implementation = {
60-    .pong = &pong,
61-    .move = &move,
62-    .resize = &resize,
63-    .set_toplevel = &set_toplevel,
64-    .set_transient = &set_transient,
65-    .set_fullscreen = &set_fullscreen,
66-    .set_popup = &set_popup,
67-    .set_maximized = &set_maximized,
68-    .set_class = &set_class
69-};
70-
71-struct shell_surface * shell_surface_create(struct swc_surface * surface)
72-{
73-    struct shell_surface * shell_surface;
74-
75-    shell_surface = malloc(sizeof *shell_surface);
76-    shell_surface->surface = surface;
77-
78-    return shell_surface;
79-}
80-
+0, -13
 1@@ -1,13 +0,0 @@
 2-#ifndef TESTWM_SHELL_SURFACE_H
 3-#define TESTWM_SHELL_SURFACE_H 1
 4-
 5-struct shell_surface
 6-{
 7-    struct swc_surface * surface;
 8-    struct wl_resource * resource;
 9-};
10-
11-extern struct wl_shell_surface_interface shell_surface_implementation;
12-
13-#endif
14-
+0, -151
  1@@ -1,151 +0,0 @@
  2-#include "compositor.h"
  3-
  4-#include <stdio.h>
  5-#include <stdlib.h>
  6-#include <signal.h>
  7-#include <unistd.h>
  8-#include <sys/wait.h>
  9-
 10-#include <wayland-server.h>
 11-#include <xkbcommon/xkbcommon-keysyms.h>
 12-
 13-const char socket_name[] = "wayland-0";
 14-
 15-static void get_shell_surface(struct wl_client * client,
 16-                              struct wl_resource * resource, uint32_t id,
 17-                              struct wl_resource * surface)
 18-{
 19-    wl_client_add_object(client, &wl_shell_surface_interface, NULL, id, surface->data);
 20-}
 21-
 22-struct wl_shell_interface shell_interface = {
 23-    .get_shell_surface = &get_shell_surface
 24-};
 25-
 26-void handle_terminate(uint32_t time, uint32_t value, void * data)
 27-{
 28-    struct wl_display * display = data;
 29-    printf("handling terminate\n");
 30-    wl_display_terminate(display);
 31-}
 32-
 33-void handle_switch_vt(uint32_t time, uint32_t value, void * data)
 34-{
 35-    struct swc_tty * tty = data;
 36-    uint32_t vt = value - XKB_KEY_XF86Switch_VT_1 + 1;
 37-    printf("handle switch vt%u\n", vt);
 38-    swc_tty_switch_vt(tty, value - XKB_KEY_XF86Switch_VT_1 + 1);
 39-}
 40-
 41-void handle_test_shm(uint32_t time, uint32_t value, void * data)
 42-{
 43-    printf("handle test shm\n");
 44-    if (fork() == 0)
 45-    {
 46-        printf("launching shm\n");
 47-        execlp("/home/michael/scm/freedesktop/weston/clients/simple-shm", "simple-shm", NULL);
 48-        exit(EXIT_SUCCESS);
 49-    }
 50-}
 51-
 52-void handle_test_term(uint32_t time, uint32_t value, void * data)
 53-{
 54-    printf("handle test term\n");
 55-    if (fork() == 0)
 56-    {
 57-        printf("launching term\n");
 58-        execlp("weston-terminal", "weston-terminal", NULL);
 59-        exit(EXIT_SUCCESS);
 60-    }
 61-}
 62-
 63-void handle_test_info(uint32_t time, uint32_t value, void * data)
 64-{
 65-    printf("handle test term\n");
 66-    if (fork() == 0)
 67-    {
 68-        printf("launching info\n");
 69-        execlp("weston-info", "weston-info", NULL);
 70-        exit(EXIT_SUCCESS);
 71-    }
 72-}
 73-
 74-int handle_sigint(int signal_number, void * data)
 75-{
 76-    struct wl_display * display = data;
 77-    printf("handle sigint\n");
 78-    wl_display_terminate(display);
 79-
 80-    return 1;
 81-}
 82-
 83-int handle_sigchld(int signal_number, void * data)
 84-{
 85-    printf("handle SIGCHLD\n");
 86-    while (waitpid(-1, NULL, WNOHANG) != -1);
 87-}
 88-
 89-static void bind_shell(struct wl_client * client, void * data, uint32_t version, uint32_t id)
 90-{
 91-    wl_client_add_object(client, &wl_shell_interface, &shell_interface, id, NULL);
 92-}
 93-
 94-int main(int argc, char * argv[])
 95-{
 96-    struct wl_display * display;
 97-    struct swc_compositor compositor;
 98-    struct wl_event_loop * event_loop;
 99-    struct wl_event_source * sigint_source, * sigchld_source;
100-    xkb_keysym_t keysym;
101-
102-    display = wl_display_create();
103-
104-    wl_display_init_shm(display);
105-    wl_data_device_manager_init(display);
106-
107-    event_loop = wl_display_get_event_loop(display);
108-    sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, &handle_sigint,
109-                                             display);
110-
111-    sigchld_source = wl_event_loop_add_signal(event_loop, SIGCHLD, &handle_sigchld,
112-                                              NULL);
113-
114-    swc_compositor_initialize(&compositor, display);
115-    swc_compositor_add_globals(&compositor, display);
116-
117-    wl_display_add_global(display, &wl_shell_interface, NULL, &bind_shell);
118-
119-    swc_compositor_add_key_binding(&compositor,
120-        MOD_CTRL | MOD_ALT, XKB_KEY_BackSpace, &handle_terminate, display);
121-
122-    for (keysym = XKB_KEY_XF86Switch_VT_1;
123-         keysym <= XKB_KEY_XF86Switch_VT_12;
124-         ++keysym)
125-    {
126-        swc_compositor_add_key_binding(&compositor, MOD_ANY, keysym,
127-                                       &handle_switch_vt, &compositor.tty);
128-    }
129-
130-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_Return,
131-                                   &handle_test_term, NULL);
132-
133-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_1,
134-                                   &handle_test_info, NULL);
135-
136-    swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_2,
137-                                   &handle_test_shm, NULL);
138-
139-    wl_display_add_socket(display, socket_name);
140-    setenv("WAYLAND_DISPLAY", socket_name, 1);
141-
142-    wl_display_run(display);
143-
144-    /* Cleanup */
145-    wl_event_source_remove(sigint_source);
146-    wl_event_source_remove(sigchld_source);
147-    swc_compositor_finish(&compositor);
148-    wl_display_destroy(display);
149-
150-    return EXIT_SUCCESS;
151-}
152-