swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 06e5a78c1dc4a58abdb2a2472ae9dfcdaa75719b
parent e7d1aa7470c7a1eab2581adab120d774d60ada41
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 13 Jun 2013 20:34:09 -0700

Remove testwm

Diffstat:
MMakefile.am | 2+-
Mconfigure.ac | 2+-
Dtestwm/Makefile.am | 13-------------
Dtestwm/main.c | 173-------------------------------------------------------------------------------
Dtestwm/shell.c | 29-----------------------------
Dtestwm/shell.h | 15---------------
Dtestwm/shell_surface.c | 79-------------------------------------------------------------------------------
Dtestwm/shell_surface.h | 13-------------
Dtestwm/testwm.c | 151------------------------------------------------------------------------------
9 files changed, 2 insertions(+), 475 deletions(-)

diff --git a/Makefile.am b/Makefile.am @@ -29,5 +29,5 @@ libswc_la_LIBADD = $(wayland_server_LIBS) $(udev_LIBS) $(xkbcommon_LIBS) \ # # testclient_LDADD = $(wayland_client_LIBS) -SUBDIRS = i915 testwm +SUBDIRS = i915 diff --git a/configure.ac b/configure.ac @@ -32,6 +32,6 @@ PKG_CHECK_MODULES([wayland_client], [wayland-client]) dnl }}} #AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile i915/Makefile testwm/Makefile]) +AC_CONFIG_FILES([Makefile i915/Makefile]) AC_OUTPUT diff --git a/testwm/Makefile.am b/testwm/Makefile.am @@ -1,13 +0,0 @@ -# testwm/Makefile.am - -AM_CFLAGS = -I.. $(pixman_CFLAGS) - -bin_PROGRAMS = testwm - -testwm_SOURCES = \ - main.c \ - shell.c shell.h \ - shell_surface.c shell_surface.h - -testwm_LDADD = ../libswc.la $(wayland_server_LIBS) - diff --git a/testwm/main.c b/testwm/main.c @@ -1,173 +0,0 @@ -#include "shell.h" - -#include <compositor.h> - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/wait.h> - -#include <wayland-server.h> -#include <xkbcommon/xkbcommon-keysyms.h> - -const char socket_name[] = "wayland-0"; - -void handle_terminate(uint32_t time, uint32_t value, void * data) -{ - struct wl_display * display = data; - printf("handling terminate\n"); - wl_display_terminate(display); -} - -void handle_switch_vt(uint32_t time, uint32_t value, void * data) -{ - struct swc_tty * tty = data; - uint32_t vt = value - XKB_KEY_XF86Switch_VT_1 + 1; - printf("handle switch vt%u\n", vt); - swc_tty_switch_vt(tty, value - XKB_KEY_XF86Switch_VT_1 + 1); -} - -void handle_test_shm(uint32_t time, uint32_t value, void * data) -{ - printf("handle test shm\n"); - if (fork() == 0) - { - printf("launching shm\n"); - execlp("/home/michael/scm/freedesktop/weston/clients/simple-shm", "simple-shm", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_test_term(uint32_t time, uint32_t value, void * data) -{ - printf("handle test term\n"); - if (fork() == 0) - { - printf("launching term\n"); - execlp("weston-terminal", "weston-terminal", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_test_info(uint32_t time, uint32_t value, void * data) -{ - printf("handle test info\n"); - if (fork() == 0) - { - printf("launching info\n"); - execlp("weston-info", "weston-info", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_test_egl(uint32_t time, uint32_t value, void * data) -{ - printf("handle test egl\n"); - if (fork() == 0) - { - printf("launching info\n"); - execlp("/home/michael/scm/freedesktop/weston/clients/simple-egl", "simple-egl", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_flip(uint32_t time, uint32_t value, void * data) -{ - struct swc_compositor * compositor = data; - struct swc_output * output; - - output = wl_container_of(compositor->outputs.next, output, link); - - printf("output: 0x%x\n", output); - printf("output id: %u\n", output->id); - printf("compositor: 0x%x\n", compositor); - printf("handle flip\n"); - swc_renderer_repaint_output(&compositor->renderer, output, &compositor->surfaces); - swc_output_switch_buffer(output); -} - -int handle_sigint(int signal_number, void * data) -{ - struct wl_display * display = data; - printf("handle sigint\n"); - wl_display_terminate(display); - - return 1; -} - -int handle_sigchld(int signal_number, void * data) -{ - printf("handle SIGCHLD\n"); - while (waitpid(-1, NULL, WNOHANG) != -1); - - return 1; -} - -int main(int argc, char * argv[]) -{ - struct wl_display * display; - struct swc_compositor compositor; - struct wl_event_loop * event_loop; - struct wl_event_source * sigint_source, * sigchld_source; - xkb_keysym_t keysym; - - //struct shell shell; - - display = wl_display_create(); - - wl_display_init_shm(display); - wl_data_device_manager_init(display); - - event_loop = wl_display_get_event_loop(display); - sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, &handle_sigint, - display); - - sigchld_source = wl_event_loop_add_signal(event_loop, SIGCHLD, &handle_sigchld, - NULL); - - swc_compositor_initialize(&compositor, display); - swc_compositor_add_globals(&compositor, display); - - //shell_initialize(&shell, display); - - swc_compositor_add_key_binding(&compositor, - MOD_CTRL | MOD_ALT, XKB_KEY_BackSpace, &handle_terminate, display); - - for (keysym = XKB_KEY_XF86Switch_VT_1; - keysym <= XKB_KEY_XF86Switch_VT_12; - ++keysym) - { - swc_compositor_add_key_binding(&compositor, MOD_ANY, keysym, - &handle_switch_vt, &compositor.tty); - } - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_Return, - &handle_test_term, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_1, - &handle_test_info, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_2, - &handle_test_shm, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_3, - &handle_test_egl, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_0, - &handle_flip, &compositor); - - wl_display_add_socket(display, socket_name); - setenv("WAYLAND_DISPLAY", socket_name, 1); - - wl_display_run(display); - - /* Cleanup */ - wl_event_source_remove(sigint_source); - wl_event_source_remove(sigchld_source); - swc_compositor_finish(&compositor); - wl_display_destroy(display); - - return EXIT_SUCCESS; -} - diff --git a/testwm/shell.c b/testwm/shell.c @@ -1,29 +0,0 @@ -#include "shell.h" - -#include "shell_surface.h" - -static void get_shell_surface(struct wl_client * client, - struct wl_resource * resource, uint32_t id, - struct wl_resource * surface) -{ - wl_client_add_object(client, &wl_shell_surface_interface, - &shell_surface_implementation, id, surface->data); -} - -struct wl_shell_interface shell_implementation = { - .get_shell_surface = &get_shell_surface -}; - -static void bind_shell(struct wl_client * client, void * data, uint32_t version, - uint32_t id) -{ - wl_client_add_object(client, &wl_shell_interface, &shell_implementation, - id, NULL); -} - -void shell_initialize(struct shell * shell, struct wl_display * display) -{ - wl_display_add_global(display, &wl_shell_interface, &shell_implementation, - &bind_shell); -} - diff --git a/testwm/shell.h b/testwm/shell.h @@ -1,15 +0,0 @@ -#ifndef TESTWM_SHELL_H -#define TESTWM_SHELL_H 1 - -#include <wayland-server.h> - -struct shell -{ -}; - -extern struct wl_shell_interface shell_implementation; - -void shell_initialize(struct shell * shell, struct wl_display * display); - -#endif - diff --git a/testwm/shell_surface.c b/testwm/shell_surface.c @@ -1,79 +0,0 @@ -#include "shell_surface.h" - -#include <stdlib.h> -#include <wayland-server.h> - -static void pong(struct wl_client * client, struct wl_resource * resource, - uint32_t serial) -{ -} - -static void move(struct wl_client * client, struct wl_resource * resource, - struct wl_resource * seat_resource, uint32_t serial) -{ -} - -static void resize(struct wl_client * client, struct wl_resource * resource, - struct wl_resource * seat_resource, uint32_t serial, - uint32_t edges) -{ -} - -static void set_toplevel(struct wl_client * client, - struct wl_resource * resource) -{ -} - -static void set_transient(struct wl_client * client, - struct wl_resource * resource, - struct wl_resource * parent_resource, - int32_t x, int32_t y, uint32_t flags) -{ -} - -static void set_fullscreen(struct wl_client * client, - struct wl_resource * resource, uint32_t method, - uint32_t framerate, struct wl_resource * output) -{ -} - -static void set_popup(struct wl_client * client, struct wl_resource * resource, - struct wl_resource * seat_resource, uint32_t serial, - struct wl_resource * parent_resource, - int32_t x, int32_t y, uint32_t flags) -{ -} - -static void set_maximized(struct wl_client * client, - struct wl_resource * resource, - struct wl_resource * output) -{ -} - -static void set_class(struct wl_client * client, struct wl_resource * resource, - const char * class_) -{ -} - -struct wl_shell_surface_interface shell_surface_implementation = { - .pong = &pong, - .move = &move, - .resize = &resize, - .set_toplevel = &set_toplevel, - .set_transient = &set_transient, - .set_fullscreen = &set_fullscreen, - .set_popup = &set_popup, - .set_maximized = &set_maximized, - .set_class = &set_class -}; - -struct shell_surface * shell_surface_create(struct swc_surface * surface) -{ - struct shell_surface * shell_surface; - - shell_surface = malloc(sizeof *shell_surface); - shell_surface->surface = surface; - - return shell_surface; -} - diff --git a/testwm/shell_surface.h b/testwm/shell_surface.h @@ -1,13 +0,0 @@ -#ifndef TESTWM_SHELL_SURFACE_H -#define TESTWM_SHELL_SURFACE_H 1 - -struct shell_surface -{ - struct swc_surface * surface; - struct wl_resource * resource; -}; - -extern struct wl_shell_surface_interface shell_surface_implementation; - -#endif - diff --git a/testwm/testwm.c b/testwm/testwm.c @@ -1,151 +0,0 @@ -#include "compositor.h" - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/wait.h> - -#include <wayland-server.h> -#include <xkbcommon/xkbcommon-keysyms.h> - -const char socket_name[] = "wayland-0"; - -static void get_shell_surface(struct wl_client * client, - struct wl_resource * resource, uint32_t id, - struct wl_resource * surface) -{ - wl_client_add_object(client, &wl_shell_surface_interface, NULL, id, surface->data); -} - -struct wl_shell_interface shell_interface = { - .get_shell_surface = &get_shell_surface -}; - -void handle_terminate(uint32_t time, uint32_t value, void * data) -{ - struct wl_display * display = data; - printf("handling terminate\n"); - wl_display_terminate(display); -} - -void handle_switch_vt(uint32_t time, uint32_t value, void * data) -{ - struct swc_tty * tty = data; - uint32_t vt = value - XKB_KEY_XF86Switch_VT_1 + 1; - printf("handle switch vt%u\n", vt); - swc_tty_switch_vt(tty, value - XKB_KEY_XF86Switch_VT_1 + 1); -} - -void handle_test_shm(uint32_t time, uint32_t value, void * data) -{ - printf("handle test shm\n"); - if (fork() == 0) - { - printf("launching shm\n"); - execlp("/home/michael/scm/freedesktop/weston/clients/simple-shm", "simple-shm", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_test_term(uint32_t time, uint32_t value, void * data) -{ - printf("handle test term\n"); - if (fork() == 0) - { - printf("launching term\n"); - execlp("weston-terminal", "weston-terminal", NULL); - exit(EXIT_SUCCESS); - } -} - -void handle_test_info(uint32_t time, uint32_t value, void * data) -{ - printf("handle test term\n"); - if (fork() == 0) - { - printf("launching info\n"); - execlp("weston-info", "weston-info", NULL); - exit(EXIT_SUCCESS); - } -} - -int handle_sigint(int signal_number, void * data) -{ - struct wl_display * display = data; - printf("handle sigint\n"); - wl_display_terminate(display); - - return 1; -} - -int handle_sigchld(int signal_number, void * data) -{ - printf("handle SIGCHLD\n"); - while (waitpid(-1, NULL, WNOHANG) != -1); -} - -static void bind_shell(struct wl_client * client, void * data, uint32_t version, uint32_t id) -{ - wl_client_add_object(client, &wl_shell_interface, &shell_interface, id, NULL); -} - -int main(int argc, char * argv[]) -{ - struct wl_display * display; - struct swc_compositor compositor; - struct wl_event_loop * event_loop; - struct wl_event_source * sigint_source, * sigchld_source; - xkb_keysym_t keysym; - - display = wl_display_create(); - - wl_display_init_shm(display); - wl_data_device_manager_init(display); - - event_loop = wl_display_get_event_loop(display); - sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, &handle_sigint, - display); - - sigchld_source = wl_event_loop_add_signal(event_loop, SIGCHLD, &handle_sigchld, - NULL); - - swc_compositor_initialize(&compositor, display); - swc_compositor_add_globals(&compositor, display); - - wl_display_add_global(display, &wl_shell_interface, NULL, &bind_shell); - - swc_compositor_add_key_binding(&compositor, - MOD_CTRL | MOD_ALT, XKB_KEY_BackSpace, &handle_terminate, display); - - for (keysym = XKB_KEY_XF86Switch_VT_1; - keysym <= XKB_KEY_XF86Switch_VT_12; - ++keysym) - { - swc_compositor_add_key_binding(&compositor, MOD_ANY, keysym, - &handle_switch_vt, &compositor.tty); - } - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_Return, - &handle_test_term, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_1, - &handle_test_info, NULL); - - swc_compositor_add_key_binding(&compositor, MOD_SUPER, XKB_KEY_2, - &handle_test_shm, NULL); - - wl_display_add_socket(display, socket_name); - setenv("WAYLAND_DISPLAY", socket_name, 1); - - wl_display_run(display); - - /* Cleanup */ - wl_event_source_remove(sigint_source); - wl_event_source_remove(sigchld_source); - swc_compositor_finish(&compositor); - wl_display_destroy(display); - - return EXIT_SUCCESS; -} -