-SUBDIRS = shared compositor clients data
+SUBDIRS = shared src clients data
wscreensaver \
eventdemo
-desktop_shell = wayland-desktop-shell
-tablet_shell = wayland-tablet-shell
+desktop_shell = weston-desktop-shell
+tablet_shell = weston-tablet-shell
noinst_LIBRARIES = libtoytoolkit.a
eventdemo_SOURCES = eventdemo.c
eventdemo_LDADD = $(toolkit_libs)
-wayland_desktop_shell_SOURCES = \
+weston_desktop_shell_SOURCES = \
desktop-shell.c \
desktop-shell-client-protocol.h \
desktop-shell-protocol.c
-wayland_desktop_shell_LDADD = $(toolkit_libs) \
+weston_desktop_shell_LDADD = $(toolkit_libs) \
../shared/libconfig-parser.la
-wayland_tablet_shell_SOURCES = \
+weston_tablet_shell_SOURCES = \
tablet-shell.c \
tablet-shell-client-protocol.h \
tablet-shell-protocol.c
-wayland_tablet_shell_LDADD = $(toolkit_libs) \
+weston_tablet_shell_LDADD = $(toolkit_libs) \
../shared/libconfig-parser.la
BUILT_SOURCES = \
+++ /dev/null
-/*
- * Copyright © 2008-2011 Kristian Høgsberg
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The copyright holders make
- * no representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
-#define _WAYLAND_SYSTEM_COMPOSITOR_H_
-
-#include <libudev.h>
-#include <pixman.h>
-#include <wayland-server.h>
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-struct wlsc_matrix {
- GLfloat d[16];
-};
-
-struct wlsc_vector {
- GLfloat f[4];
-};
-
-void
-wlsc_matrix_init(struct wlsc_matrix *matrix);
-void
-wlsc_matrix_scale(struct wlsc_matrix *matrix, GLfloat x, GLfloat y, GLfloat z);
-void
-wlsc_matrix_translate(struct wlsc_matrix *matrix,
- GLfloat x, GLfloat y, GLfloat z);
-void
-wlsc_matrix_transform(struct wlsc_matrix *matrix, struct wlsc_vector *v);
-
-struct wlsc_transform {
- struct wlsc_matrix matrix;
- struct wlsc_matrix inverse;
-};
-
-struct wlsc_surface;
-struct wlsc_input_device;
-
-struct wlsc_mode {
- uint32_t flags;
- int32_t width, height;
- uint32_t refresh;
- struct wl_list link;
-};
-
-struct wlsc_output {
- struct wl_list link;
- struct wlsc_compositor *compositor;
- struct wlsc_matrix matrix;
- struct wl_list frame_callback_list;
- int32_t x, y, mm_width, mm_height;
- pixman_region32_t region;
- pixman_region32_t previous_damage;
- uint32_t flags;
- int repaint_needed;
- int repaint_scheduled;
-
- char *make, *model;
- uint32_t subpixel;
-
- struct wlsc_mode *current;
- struct wl_list mode_list;
- struct wl_buffer *scanout_buffer;
- struct wl_listener scanout_buffer_destroy_listener;
- struct wl_buffer *pending_scanout_buffer;
- struct wl_listener pending_scanout_buffer_destroy_listener;
-
- int (*prepare_render)(struct wlsc_output *output);
- int (*present)(struct wlsc_output *output);
- int (*prepare_scanout_surface)(struct wlsc_output *output,
- struct wlsc_surface *es);
- int (*set_hardware_cursor)(struct wlsc_output *output,
- struct wlsc_input_device *input);
- void (*destroy)(struct wlsc_output *output);
-};
-
-struct wlsc_input_device {
- struct wl_input_device input_device;
- struct wlsc_compositor *compositor;
- struct wlsc_surface *sprite;
- int32_t hotspot_x, hotspot_y;
- struct wl_list link;
- uint32_t modifier_state;
- struct wl_selection *selection;
-
- struct wl_list drag_resource_list;
- struct wlsc_data_source *drag_data_source;
- struct wl_surface *drag_focus;
- struct wl_resource *drag_focus_resource;
- struct wl_listener drag_focus_listener;
-
- struct wlsc_data_source *selection_data_source;
- struct wl_listener selection_data_source_listener;
- struct wl_grab grab;
-
- uint32_t num_tp;
- struct wl_surface *touch_focus;
- struct wl_listener touch_focus_listener;
- struct wl_resource *touch_focus_resource;
- struct wl_listener touch_focus_resource_listener;
-};
-
-enum wlsc_visual {
- WLSC_NONE_VISUAL,
- WLSC_ARGB_VISUAL,
- WLSC_PREMUL_ARGB_VISUAL,
- WLSC_RGB_VISUAL
-};
-
-struct wlsc_shader {
- GLuint program;
- GLuint vertex_shader, fragment_shader;
- GLuint proj_uniform;
- GLuint tex_uniform;
- GLuint alpha_uniform;
- GLuint color_uniform;
-};
-
-struct wlsc_animation {
- void (*frame)(struct wlsc_animation *animation,
- struct wlsc_output *output, uint32_t msecs);
- struct wl_list link;
-};
-
-struct wlsc_spring {
- double k;
- double friction;
- double current;
- double target;
- double previous;
- uint32_t timestamp;
-};
-
-struct wlsc_shell {
- void (*lock)(struct wlsc_shell *shell);
- void (*unlock)(struct wlsc_shell *shell);
- void (*map)(struct wlsc_shell *shell, struct wlsc_surface *surface,
- int32_t width, int32_t height);
- void (*configure)(struct wlsc_shell *shell,
- struct wlsc_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height);
-};
-
-enum {
- WLSC_COMPOSITOR_ACTIVE,
- WLSC_COMPOSITOR_IDLE, /* shell->unlock called on activity */
- WLSC_COMPOSITOR_SLEEPING /* no rendering, no frame events */
-};
-
-struct wlsc_compositor {
- struct wl_shm *shm;
- struct wlsc_xserver *wxs;
-
- EGLDisplay display;
- EGLContext context;
- EGLConfig config;
- GLuint fbo;
- GLuint proj_uniform, tex_uniform, alpha_uniform;
- uint32_t current_alpha;
- struct wlsc_shader texture_shader;
- struct wlsc_shader solid_shader;
- struct wl_display *wl_display;
-
- struct wlsc_shell *shell;
-
- /* There can be more than one, but not right now... */
- struct wl_input_device *input_device;
-
- struct wl_list output_list;
- struct wl_list input_device_list;
- struct wl_list surface_list;
- struct wl_list binding_list;
- struct wl_list animation_list;
- struct {
- struct wlsc_spring spring;
- struct wlsc_animation animation;
- } fade;
-
- uint32_t state;
- struct wl_event_source *idle_source;
- uint32_t idle_inhibit;
- int option_idle_time; /* default timeout, s */
- int idle_time; /* effective timeout, s */
-
- /* Repaint state. */
- struct timespec previous_swap;
- struct wl_array vertices, indices;
-
- struct wlsc_surface *overlay;
- struct wlsc_switcher *switcher;
- uint32_t focus;
-
- PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC
- image_target_renderbuffer_storage;
- PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
- PFNEGLCREATEIMAGEKHRPROC create_image;
- PFNEGLDESTROYIMAGEKHRPROC destroy_image;
- PFNEGLBINDWAYLANDDISPLAYWL bind_display;
- PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display;
- int has_bind_display;
-
- void (*destroy)(struct wlsc_compositor *ec);
- int (*authenticate)(struct wlsc_compositor *c, uint32_t id);
- EGLImageKHR (*create_cursor_image)(struct wlsc_compositor *c,
- int32_t *width, int32_t *height);
-};
-
-#define MODIFIER_CTRL (1 << 8)
-#define MODIFIER_ALT (1 << 9)
-#define MODIFIER_SUPER (1 << 10)
-
-enum wlsc_output_flags {
- WL_OUTPUT_FLIPPED = 0x01
-};
-
-struct wlsc_surface {
- struct wl_surface surface;
- struct wlsc_compositor *compositor;
- GLuint texture, saved_texture;
- pixman_region32_t damage;
- pixman_region32_t opaque;
- int32_t x, y, width, height;
- int32_t pitch;
- struct wl_list link;
- struct wl_list buffer_link;
- struct wlsc_transform *transform;
- uint32_t alpha;
- uint32_t visual;
-
- /*
- * Which output to vsync this surface to.
- * Used to determine, whether to send or queue frame events.
- * Must be NULL, if 'link' is not in wlsc_compositor::surface_list.
- */
- struct wlsc_output *output;
-
- struct wlsc_output *fullscreen_output;
- struct wl_list frame_callback_list;
-
- EGLImageKHR image;
-
- struct wl_buffer *buffer;
- struct wl_listener buffer_destroy_listener;
-};
-
-struct wlsc_data_source {
- struct wl_resource resource;
- struct wl_array mime_types;
- int refcount;
- void *data;
-
- struct wl_resource *(*create_offer)(struct wlsc_data_source *source,
- struct wl_resource *target);
-
- void (*cancel)(struct wlsc_data_source *source);
-};
-
-void
-wlsc_data_source_unref(struct wlsc_data_source *source);
-
-void
-wlsc_input_device_set_selection(struct wlsc_input_device *device,
- struct wlsc_data_source *source,
- uint32_t time);
-
-void
-wlsc_spring_init(struct wlsc_spring *spring,
- double k, double current, double target);
-void
-wlsc_spring_update(struct wlsc_spring *spring, uint32_t msec);
-int
-wlsc_spring_done(struct wlsc_spring *spring);
-
-void
-wlsc_surface_activate(struct wlsc_surface *surface,
- struct wlsc_input_device *device, uint32_t time);
-
-void
-notify_motion(struct wl_input_device *device,
- uint32_t time, int x, int y);
-void
-notify_button(struct wl_input_device *device,
- uint32_t time, int32_t button, int32_t state);
-void
-notify_key(struct wl_input_device *device,
- uint32_t time, uint32_t key, uint32_t state);
-
-void
-notify_pointer_focus(struct wl_input_device *device,
- uint32_t time,
- struct wlsc_output *output,
- int32_t x, int32_t y);
-
-void
-notify_keyboard_focus(struct wl_input_device *device,
- uint32_t time, struct wlsc_output *output,
- struct wl_array *keys);
-
-void
-notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
- int x, int y, int touch_type);
-
-void
-wlsc_output_finish_frame(struct wlsc_output *output, int msecs);
-void
-wlsc_output_damage(struct wlsc_output *output);
-void
-wlsc_compositor_repick(struct wlsc_compositor *compositor);
-void
-wlsc_compositor_schedule_repaint(struct wlsc_compositor *compositor);
-void
-wlsc_compositor_fade(struct wlsc_compositor *compositor, float tint);
-void
-wlsc_compositor_damage_all(struct wlsc_compositor *compositor);
-void
-wlsc_compositor_unlock(struct wlsc_compositor *compositor);
-void
-wlsc_compositor_wake(struct wlsc_compositor *compositor);
-void
-wlsc_compositor_activity(struct wlsc_compositor *compositor);
-
-struct wlsc_binding;
-typedef void (*wlsc_binding_handler_t)(struct wl_input_device *device,
- uint32_t time, uint32_t key,
- uint32_t button,
- uint32_t state, void *data);
-struct wlsc_binding *
-wlsc_compositor_add_binding(struct wlsc_compositor *compositor,
- uint32_t key, uint32_t button, uint32_t modifier,
- wlsc_binding_handler_t binding, void *data);
-void
-wlsc_binding_destroy(struct wlsc_binding *binding);
-
-void
-wlsc_compositor_run_binding(struct wlsc_compositor *compositor,
- struct wlsc_input_device *device,
- uint32_t time,
- uint32_t key, uint32_t button, int32_t state);
-
-struct wlsc_surface *
-wlsc_surface_create(struct wlsc_compositor *compositor,
- int32_t x, int32_t y, int32_t width, int32_t height);
-
-void
-wlsc_surface_configure(struct wlsc_surface *surface,
- int x, int y, int width, int height);
-
-void
-wlsc_surface_assign_output(struct wlsc_surface *surface);
-
-void
-wlsc_surface_damage(struct wlsc_surface *surface);
-
-void
-wlsc_surface_damage_below(struct wlsc_surface *surface);
-
-void
-wlsc_surface_damage_rectangle(struct wlsc_surface *surface,
- int32_t x, int32_t y,
- int32_t width, int32_t height);
-
-struct wlsc_surface *
-pick_surface(struct wl_input_device *device, int32_t *sx, int32_t *sy);
-
-uint32_t
-wlsc_compositor_get_time(void);
-
-int
-wlsc_compositor_init(struct wlsc_compositor *ec, struct wl_display *display);
-void
-wlsc_compositor_shutdown(struct wlsc_compositor *ec);
-void
-wlsc_output_move(struct wlsc_output *output, int x, int y);
-void
-wlsc_output_init(struct wlsc_output *output, struct wlsc_compositor *c,
- int x, int y, int width, int height, uint32_t flags);
-void
-wlsc_output_destroy(struct wlsc_output *output);
-
-void
-wlsc_input_device_init(struct wlsc_input_device *device,
- struct wlsc_compositor *ec);
-
-void
-wlsc_switcher_init(struct wlsc_compositor *compositor);
-
-enum {
- TTY_ENTER_VT,
- TTY_LEAVE_VT
-};
-
-typedef void (*tty_vt_func_t)(struct wlsc_compositor *compositor, int event);
-
-struct tty *
-tty_create(struct wlsc_compositor *compositor, tty_vt_func_t vt_func,
- int tty_nr);
-
-void
-tty_destroy(struct tty *tty);
-
-void
-screenshooter_create(struct wlsc_compositor *ec);
-
-uint32_t *
-wlsc_load_image(const char *filename,
- int32_t *width_arg, int32_t *height_arg, uint32_t *stride_arg);
-
-struct wlsc_process;
-typedef void (*wlsc_process_cleanup_func_t)(struct wlsc_process *process,
- int status);
-
-struct wlsc_process {
- pid_t pid;
- wlsc_process_cleanup_func_t cleanup;
- struct wl_list link;
-};
-
-struct wl_client *
-wlsc_client_launch(struct wlsc_compositor *compositor,
- struct wlsc_process *proc,
- const char *path,
- wlsc_process_cleanup_func_t cleanup);
-
-int
-wlsc_data_device_manager_init(struct wlsc_compositor *compositor);
-void
-wlsc_data_device_set_keyboard_focus(struct wlsc_input_device *device);
-
-void
-wlsc_watch_process(struct wlsc_process *process);
-
-int
-wlsc_xserver_init(struct wlsc_compositor *compositor);
-void
-wlsc_xserver_destroy(struct wlsc_compositor *compositor);
-void
-wlsc_xserver_surface_activate(struct wlsc_surface *surface);
-void
-wlsc_xserver_set_selection(struct wlsc_input_device *device);
-
-struct wlsc_zoom;
-typedef void (*wlsc_zoom_done_func_t)(struct wlsc_zoom *zoom, void *data);
-
-struct wlsc_zoom *
-wlsc_zoom_run(struct wlsc_surface *surface, GLfloat start, GLfloat stop,
- wlsc_zoom_done_func_t done, void *data);
-
-#endif
AC_CONFIG_FILES([Makefile
shared/Makefile
- compositor/Makefile
+ src/Makefile
clients/Makefile
data/Makefile])
AC_OUTPUT
-waylanddatadir = $(datadir)/wayland
+westondatadir = $(datadir)/weston
-dist_waylanddata_DATA = \
+dist_westondata_DATA = \
bottom_left_corner.png \
bottom_right_corner.png \
bottom_side.png \
-bin_PROGRAMS = wayland-compositor
+bin_PROGRAMS = weston
AM_CPPFLAGS = \
-DDATADIR='"$(datadir)"' \
-DXSERVER_PATH='"@XSERVER_PATH@"' \
$(COMPOSITOR_CFLAGS)
-wayland_compositor_LDFLAGS = -export-dynamic
-wayland_compositor_CFLAGS = $(GCC_CFLAGS)
-wayland_compositor_LDADD = \
+weston_LDFLAGS = -export-dynamic
+weston_CFLAGS = $(GCC_CFLAGS)
+weston_LDADD = \
$(COMPOSITOR_LIBS) $(DLOPEN_LIBS) $(XSERVER_LAUNCHER_LIBS)
-wayland_compositor_SOURCES = \
+weston_SOURCES = \
compositor.c \
compositor.h \
image-loader.c \
hash.h
endif
-moduledir = @libdir@/wayland
+moduledir = @libdir@/weston
module_LTLIBRARIES = \
$(desktop_shell) \
$(tablet_shell) \
#include "evdev.h"
struct drm_compositor {
- struct wlsc_compositor base;
+ struct weston_compositor base;
struct udev *udev;
struct wl_event_source *drm_source;
};
struct drm_mode {
- struct wlsc_mode base;
+ struct weston_mode base;
drmModeModeInfo mode_info;
};
struct drm_output {
- struct wlsc_output base;
+ struct weston_output base;
uint32_t crtc_id;
uint32_t connector_id;
};
static int
-drm_output_prepare_render(struct wlsc_output *output_base)
+drm_output_prepare_render(struct weston_output *output_base)
{
struct drm_output *output = (struct drm_output *) output_base;
}
static int
-drm_output_present(struct wlsc_output *output_base)
+drm_output_present(struct weston_output *output_base)
{
struct drm_output *output = (struct drm_output *) output_base;
struct drm_compositor *c =
}
msecs = sec * 1000 + usec / 1000;
- wlsc_output_finish_frame(&output->base, msecs);
+ weston_output_finish_frame(&output->base, msecs);
}
static int
-drm_output_prepare_scanout_surface(struct wlsc_output *output_base,
- struct wlsc_surface *es)
+drm_output_prepare_scanout_surface(struct weston_output *output_base,
+ struct weston_surface *es)
{
struct drm_output *output = (struct drm_output *) output_base;
struct drm_compositor *c =
}
static int
-drm_output_set_cursor(struct wlsc_output *output_base,
- struct wlsc_input_device *eid)
+drm_output_set_cursor(struct weston_output *output_base,
+ struct weston_input_device *eid)
{
struct drm_output *output = (struct drm_output *) output_base;
struct drm_compositor *c =
}
static void
-drm_output_destroy(struct wlsc_output *output_base)
+drm_output_destroy(struct weston_output *output_base)
{
struct drm_output *output = (struct drm_output *) output_base;
struct drm_compositor *c =
c->crtc_allocator &= ~(1 << output->crtc_id);
c->connector_allocator &= ~(1 << output->connector_id);
- wlsc_output_destroy(&output->base);
+ weston_output_destroy(&output->base);
wl_list_remove(&output->base.link);
free(output);
goto err_fb;
}
- wlsc_output_init(&output->base, &ec->base, x, y,
+ weston_output_init(&output->base, &ec->base, x, y,
connector->mmWidth, connector->mmHeight, 0);
wl_list_insert(ec->base.output_list.prev, &output->base.link);
}
x += container_of(ec->base.output_list.prev,
- struct wlsc_output,
+ struct weston_output,
link)->current->width;
}
connected |= (1 << connector_id);
if (!(ec->connector_allocator & (1 << connector_id))) {
- struct wlsc_output *last =
+ struct weston_output *last =
container_of(ec->base.output_list.prev,
- struct wlsc_output, link);
+ struct weston_output, link);
/* XXX: not yet needed, we die with 0 outputs */
if (!wl_list_empty(&ec->base.output_list))
wl_list_for_each_safe(output, next, &ec->base.output_list,
base.link) {
if (x_offset != 0 || y_offset != 0) {
- wlsc_output_move(&output->base,
+ weston_output_move(&output->base,
output->base.x - x_offset,
output->base.y - y_offset);
}
}
static EGLImageKHR
-drm_compositor_create_cursor_image(struct wlsc_compositor *ec,
+drm_compositor_create_cursor_image(struct weston_compositor *ec,
int32_t *width, int32_t *height)
{
struct drm_compositor *c = (struct drm_compositor *) ec;
}
static void
-drm_destroy(struct wlsc_compositor *ec)
+drm_destroy(struct weston_compositor *ec)
{
struct drm_compositor *d = (struct drm_compositor *) ec;
- struct wlsc_input_device *input, *next;
+ struct weston_input_device *input, *next;
- wlsc_compositor_shutdown(ec);
+ weston_compositor_shutdown(ec);
gbm_device_destroy(d->gbm);
tty_destroy(d->tty);
}
static void
-vt_func(struct wlsc_compositor *compositor, int event)
+vt_func(struct weston_compositor *compositor, int event)
{
struct drm_compositor *ec = (struct drm_compositor *) compositor;
- struct wlsc_output *output;
- struct wlsc_input_device *input;
+ struct weston_output *output;
+ struct weston_input_device *input;
switch (event) {
case TTY_ENTER_VT:
compositor->focus = 1;
drmSetMaster(ec->drm.fd);
compositor->state = ec->prev_state;
- wlsc_compositor_damage_all(compositor);
+ weston_compositor_damage_all(compositor);
wl_list_for_each(input, &compositor->input_device_list, link)
evdev_add_devices(ec->udev, input);
break;
case TTY_LEAVE_VT:
compositor->focus = 0;
ec->prev_state = compositor->state;
- compositor->state = WLSC_COMPOSITOR_SLEEPING;
+ compositor->state = WESTON_COMPOSITOR_SLEEPING;
wl_list_for_each(input, &compositor->input_device_list, link)
evdev_remove_devices(input);
static const char default_seat[] = "seat0";
-static struct wlsc_compositor *
+static struct weston_compositor *
drm_compositor_create(struct wl_display *display,
int connector, const char *seat, int tty)
{
ec->base.focus = 1;
- ec->prev_state = WLSC_COMPOSITOR_ACTIVE;
+ ec->prev_state = WESTON_COMPOSITOR_ACTIVE;
glGenFramebuffers(1, &ec->base.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, ec->base.fbo);
/* Can't init base class until we have a current egl context */
- if (wlsc_compositor_init(&ec->base, display) < 0)
+ if (weston_compositor_init(&ec->base, display) < 0)
return NULL;
if (create_outputs(ec, connector) < 0) {
return &ec->base;
}
-struct wlsc_compositor *
+struct weston_compositor *
backend_init(struct wl_display *display, char *options);
-WL_EXPORT struct wlsc_compositor *
+WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, char *options)
{
int connector = 0, i;
#include "compositor.h"
struct wayland_compositor {
- struct wlsc_compositor base;
+ struct weston_compositor base;
struct {
struct wl_display *display;
};
struct wayland_output {
- struct wlsc_output base;
+ struct weston_output base;
struct {
struct wl_surface *surface;
struct wl_egl_window *egl_window;
} parent;
EGLSurface egl_surface;
- struct wlsc_mode mode;
+ struct weston_mode mode;
};
struct wayland_input {
static int
wayland_input_create(struct wayland_compositor *c)
{
- struct wlsc_input_device *input;
+ struct weston_input_device *input;
input = malloc(sizeof *input);
if (input == NULL)
return -1;
memset(input, 0, sizeof *input);
- wlsc_input_device_init(input, &c->base);
+ weston_input_device_init(input, &c->base);
c->base.input_device = &input->input_device;
}
static int
-wayland_output_prepare_render(struct wlsc_output *output_base)
+wayland_output_prepare_render(struct weston_output *output_base)
{
struct wayland_output *output = (struct wayland_output *) output_base;
- struct wlsc_compositor *ec = output->base.compositor;
+ struct weston_compositor *ec = output->base.compositor;
if (!eglMakeCurrent(ec->display, output->egl_surface,
output->egl_surface, ec->context)) {
static void
frame_done(void *data, struct wl_callback *wl_callback, uint32_t time)
{
- struct wlsc_output *output = data;
+ struct weston_output *output = data;
- wlsc_output_finish_frame(output, time);
+ weston_output_finish_frame(output, time);
}
static const struct wl_callback_listener frame_listener = {
};
static int
-wayland_output_present(struct wlsc_output *output_base)
+wayland_output_present(struct weston_output *output_base)
{
struct wayland_output *output = (struct wayland_output *) output_base;
struct wayland_compositor *c =
}
static int
-wayland_output_prepare_scanout_surface(struct wlsc_output *output_base,
- struct wlsc_surface *es)
+wayland_output_prepare_scanout_surface(struct weston_output *output_base,
+ struct weston_surface *es)
{
return -1;
}
static int
-wayland_output_set_cursor(struct wlsc_output *output_base,
- struct wlsc_input_device *input)
+wayland_output_set_cursor(struct weston_output *output_base,
+ struct weston_input_device *input)
{
return -1;
}
static void
-wayland_output_destroy(struct wlsc_output *output_base)
+wayland_output_destroy(struct weston_output *output_base)
{
struct wayland_output *output = (struct wayland_output *) output_base;
- struct wlsc_compositor *ec = output->base.compositor;
+ struct weston_compositor *ec = output->base.compositor;
eglDestroySurface(ec->display, output->egl_surface);
wl_egl_window_destroy(output->parent.egl_window);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
- wlsc_output_init(&output->base, &c->base, 0, 0, width, height,
+ weston_output_init(&output->base, &c->base, 0, 0, width, height,
WL_OUTPUT_FLIPPED);
output->parent.surface =
cleanup_window:
wl_egl_window_destroy(output->parent.egl_window);
cleanup_output:
- /* FIXME: cleanup wlsc_output */
+ /* FIXME: cleanup weston_output */
free(output);
return -1;
}
static void
-wayland_destroy(struct wlsc_compositor *ec)
+wayland_destroy(struct weston_compositor *ec)
{
- wlsc_compositor_shutdown(ec);
+ weston_compositor_shutdown(ec);
free(ec);
}
-static struct wlsc_compositor *
+static struct weston_compositor *
wayland_compositor_create(struct wl_display *display, int width, int height)
{
struct wayland_compositor *c;
c->base.destroy = wayland_destroy;
/* Can't init base class until we have a current egl context */
- if (wlsc_compositor_init(&c->base, display) < 0)
+ if (weston_compositor_init(&c->base, display) < 0)
return NULL;
if (wayland_compositor_create_output(c, width, height) < 0)
return &c->base;
}
-struct wlsc_compositor *
+struct weston_compositor *
backend_init(struct wl_display *display, char *options);
-WL_EXPORT struct wlsc_compositor *
+WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, char *options)
{
int width = 1024, height = 640, i;
#include "compositor.h"
struct x11_compositor {
- struct wlsc_compositor base;
+ struct weston_compositor base;
Display *dpy;
xcb_connection_t *conn;
};
struct x11_output {
- struct wlsc_output base;
+ struct weston_output base;
xcb_window_t window;
EGLSurface egl_surface;
- struct wlsc_mode mode;
+ struct weston_mode mode;
struct wl_event_source *finish_frame_timer;
};
struct x11_input {
- struct wlsc_input_device base;
+ struct weston_input_device base;
};
return -1;
memset(input, 0, sizeof *input);
- wlsc_input_device_init(&input->base, &c->base);
+ weston_input_device_init(&input->base, &c->base);
c->base.input_device = &input->base.input_device;
}
static int
-x11_output_prepare_render(struct wlsc_output *output_base)
+x11_output_prepare_render(struct weston_output *output_base)
{
struct x11_output *output = (struct x11_output *) output_base;
- struct wlsc_compositor *ec = output->base.compositor;
+ struct weston_compositor *ec = output->base.compositor;
if (!eglMakeCurrent(ec->display, output->egl_surface,
output->egl_surface, ec->context)) {
gettimeofday(&tv, NULL);
msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
- wlsc_output_finish_frame(&output->base, msec);
+ weston_output_finish_frame(&output->base, msec);
return 1;
}
static int
-x11_output_present(struct wlsc_output *output_base)
+x11_output_present(struct weston_output *output_base)
{
struct x11_output *output = (struct x11_output *) output_base;
- struct wlsc_compositor *ec = output->base.compositor;
+ struct weston_compositor *ec = output->base.compositor;
if (x11_output_prepare_render(&output->base))
return -1;
}
static int
-x11_output_prepare_scanout_surface(struct wlsc_output *output_base,
- struct wlsc_surface *es)
+x11_output_prepare_scanout_surface(struct weston_output *output_base,
+ struct weston_surface *es)
{
return -1;
}
static int
-x11_output_set_cursor(struct wlsc_output *output_base,
- struct wlsc_input_device *input)
+x11_output_set_cursor(struct weston_output *output_base,
+ struct weston_input_device *input)
{
return -1;
}
static void
-x11_output_destroy(struct wlsc_output *output_base)
+x11_output_destroy(struct weston_output *output_base)
{
return;
}
uint32_t *icon, *pixels, stride;
int32_t width, height;
- pixels = wlsc_load_image(filename, &width, &height, &stride);
+ pixels = weston_load_image(filename, &width, &height, &stride);
if (!pixels)
return;
icon = malloc(width * height * 4 + 8);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
- wlsc_output_init(&output->base, &c->base, x, y, width, height,
+ weston_output_init(&output->base, &c->base, x, y, width, height,
WL_OUTPUT_FLIPPED);
values[1] = c->null_cursor;
}
notify_button(c->base.input_device,
- wlsc_compositor_get_time(), button, state);
+ weston_compositor_get_time(), button, state);
}
static int
* and fall through and handle the new
* event below. */
notify_key(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
key_release->detail - 8, 0);
free(prev);
prev = NULL;
output = x11_compositor_find_output(c, focus_in->event);
notify_keyboard_focus(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
&output->base, &c->keys);
free(prev);
case XCB_KEY_PRESS:
key_press = (xcb_key_press_event_t *) event;
notify_key(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
key_press->detail - 8, 1);
break;
case XCB_KEY_RELEASE:
motion_notify = (xcb_motion_notify_event_t *) event;
output = x11_compositor_find_output(c, motion_notify->event);
notify_motion(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
output->base.x + motion_notify->event_x,
output->base.y + motion_notify->event_y);
break;
/* FIXME: schedule output repaint */
/* output = x11_compositor_find_output(c, expose->window); */
- wlsc_compositor_schedule_repaint(&c->base);
+ weston_compositor_schedule_repaint(&c->base);
break;
case XCB_ENTER_NOTIFY:
break;
output = x11_compositor_find_output(c, enter_notify->event);
notify_pointer_focus(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
&output->base,
output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y);
break;
output = x11_compositor_find_output(c, enter_notify->event);
notify_pointer_focus(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
NULL,
output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y);
focus_in->mode == XCB_NOTIFY_MODE_UNGRAB)
break;
notify_keyboard_focus(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
NULL, NULL);
break;
case XCB_KEY_RELEASE:
key_release = (xcb_key_press_event_t *) prev;
notify_key(c->base.input_device,
- wlsc_compositor_get_time(),
+ weston_compositor_get_time(),
key_release->detail - 8, 0);
free(prev);
prev = NULL;
}
static void
-x11_destroy(struct wlsc_compositor *ec)
+x11_destroy(struct weston_compositor *ec)
{
- wlsc_compositor_shutdown(ec);
+ weston_compositor_shutdown(ec);
free(ec);
}
-static struct wlsc_compositor *
+static struct weston_compositor *
x11_compositor_create(struct wl_display *display,
int width, int height, int count, int fullscreen)
{
c->base.destroy = x11_destroy;
/* Can't init base class until we have a current egl context */
- if (wlsc_compositor_init(&c->base, display) < 0)
+ if (weston_compositor_init(&c->base, display) < 0)
return NULL;
for (i = 0, x = 0; i < count; i++) {
return &c->base;
}
-struct wlsc_compositor *
+struct weston_compositor *
backend_init(struct wl_display *display, char *options);
-WL_EXPORT struct wlsc_compositor *
+WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, char *options)
{
int width = 1024, height = 640, fullscreen = 0, count = 1, i;
static int
sigchld_handler(int signal_number, void *data)
{
- struct wlsc_process *p;
+ struct weston_process *p;
int status;
pid_t pid;
}
WL_EXPORT void
-wlsc_watch_process(struct wlsc_process *process)
+weston_watch_process(struct weston_process *process)
{
wl_list_insert(&child_process_list, &process->link);
}
}
WL_EXPORT struct wl_client *
-wlsc_client_launch(struct wlsc_compositor *compositor,
- struct wlsc_process *proc,
- const char *path,
- wlsc_process_cleanup_func_t cleanup)
+weston_client_launch(struct weston_compositor *compositor,
+ struct weston_process *proc,
+ const char *path,
+ weston_process_cleanup_func_t cleanup)
{
int sv[2];
pid_t pid;
struct wl_client *client;
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
- fprintf(stderr, "wlsc_client_launch: "
+ fprintf(stderr, "weston_client_launch: "
"socketpair failed while launching '%s': %m\n",
path);
return NULL;
if (pid == -1) {
close(sv[0]);
close(sv[1]);
- fprintf(stderr, "wlsc_client_launch: "
+ fprintf(stderr, "weston_client_launch: "
"fork failed while launching '%s': %m\n", path);
return NULL;
}
client = wl_client_create(compositor->wl_display, sv[0]);
if (!client) {
close(sv[0]);
- fprintf(stderr, "wlsc_client_launch: "
+ fprintf(stderr, "weston_client_launch: "
"wl_client_create failed while launching '%s'.\n",
path);
return NULL;
proc->pid = pid;
proc->cleanup = cleanup;
- wlsc_watch_process(proc);
+ weston_watch_process(proc);
return client;
}
surface_handle_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_surface *es = container_of(listener, struct wlsc_surface,
- buffer_destroy_listener);
+ struct weston_surface *es =
+ container_of(listener, struct weston_surface,
+ buffer_destroy_listener);
es->buffer = NULL;
}
struct wl_resource *resource,
uint32_t time)
{
- struct wlsc_output *output =
- container_of(listener, struct wlsc_output,
+ struct weston_output *output =
+ container_of(listener, struct weston_output,
scanout_buffer_destroy_listener);
output->scanout_buffer = NULL;
if (!output->pending_scanout_buffer)
- wlsc_compositor_schedule_repaint(output->compositor);
+ weston_compositor_schedule_repaint(output->compositor);
}
static void
struct wl_resource *resource,
uint32_t time)
{
- struct wlsc_output *output =
- container_of(listener, struct wlsc_output,
+ struct weston_output *output =
+ container_of(listener, struct weston_output,
pending_scanout_buffer_destroy_listener);
output->pending_scanout_buffer = NULL;
- wlsc_compositor_schedule_repaint(output->compositor);
+ weston_compositor_schedule_repaint(output->compositor);
}
-WL_EXPORT struct wlsc_surface *
-wlsc_surface_create(struct wlsc_compositor *compositor,
- int32_t x, int32_t y, int32_t width, int32_t height)
+WL_EXPORT struct weston_surface *
+weston_surface_create(struct weston_compositor *compositor,
+ int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
surface = calloc(1, sizeof *surface);
if (surface == NULL)
surface->surface.resource.client = NULL;
surface->compositor = compositor;
- surface->visual = WLSC_NONE_VISUAL;
+ surface->visual = WESTON_NONE_VISUAL;
surface->image = EGL_NO_IMAGE_KHR;
surface->saved_texture = 0;
surface->x = x;
}
WL_EXPORT void
-wlsc_surface_damage_rectangle(struct wlsc_surface *surface,
+weston_surface_damage_rectangle(struct weston_surface *surface,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
- struct wlsc_compositor *compositor = surface->compositor;
+ struct weston_compositor *compositor = surface->compositor;
pixman_region32_union_rect(&surface->damage,
&surface->damage,
surface->x + x, surface->y + y,
width, height);
- wlsc_compositor_schedule_repaint(compositor);
+ weston_compositor_schedule_repaint(compositor);
}
WL_EXPORT void
-wlsc_surface_damage(struct wlsc_surface *surface)
+weston_surface_damage(struct weston_surface *surface)
{
- wlsc_surface_damage_rectangle(surface, 0, 0,
+ weston_surface_damage_rectangle(surface, 0, 0,
surface->width, surface->height);
}
WL_EXPORT void
-wlsc_surface_damage_below(struct wlsc_surface *surface)
+weston_surface_damage_below(struct weston_surface *surface)
{
- struct wlsc_surface *below;
+ struct weston_surface *below;
if (surface->output == NULL)
return;
if (surface->link.next == &surface->compositor->surface_list)
return;
- below = container_of(surface->link.next, struct wlsc_surface, link);
+ below = container_of(surface->link.next, struct weston_surface, link);
pixman_region32_union_rect(&below->damage,
&below->damage,
surface->x, surface->y,
surface->width, surface->height);
- wlsc_compositor_schedule_repaint(surface->compositor);
+ weston_compositor_schedule_repaint(surface->compositor);
}
WL_EXPORT void
-wlsc_surface_configure(struct wlsc_surface *surface,
- int x, int y, int width, int height)
+weston_surface_configure(struct weston_surface *surface,
+ int x, int y, int width, int height)
{
- wlsc_surface_damage_below(surface);
+ weston_surface_damage_below(surface);
surface->x = x;
surface->y = y;
surface->width = width;
surface->height = height;
- wlsc_surface_assign_output(surface);
- wlsc_surface_damage(surface);
+ weston_surface_assign_output(surface);
+ weston_surface_damage(surface);
pixman_region32_fini(&surface->opaque);
- if (surface->visual == WLSC_RGB_VISUAL)
+ if (surface->visual == WESTON_RGB_VISUAL)
pixman_region32_init_rect(&surface->opaque,
surface->x, surface->y,
surface->width, surface->height);
}
WL_EXPORT uint32_t
-wlsc_compositor_get_time(void)
+weston_compositor_get_time(void)
{
struct timeval tv;
}
WL_EXPORT void
-wlsc_compositor_repick(struct wlsc_compositor *compositor)
+weston_compositor_repick(struct weston_compositor *compositor)
{
- struct wlsc_input_device *device;
- struct wlsc_surface *surface;
+ struct weston_input_device *device;
+ struct weston_surface *surface;
int32_t sx, sy;
uint32_t time;
if (!compositor->focus)
return;
- time = wlsc_compositor_get_time();
+ time = weston_compositor_get_time();
wl_list_for_each(device, &compositor->input_device_list, link) {
if (device->input_device.grab)
continue;
static void
destroy_surface(struct wl_resource *resource)
{
- struct wlsc_surface *surface =
- container_of(resource, struct wlsc_surface, surface.resource);
- struct wlsc_compositor *compositor = surface->compositor;
+ struct weston_surface *surface =
+ container_of(resource,
+ struct weston_surface, surface.resource);
+ struct weston_compositor *compositor = surface->compositor;
- wlsc_surface_damage_below(surface);
+ weston_surface_damage_below(surface);
wl_list_remove(&surface->link);
- wlsc_compositor_repick(compositor);
+ weston_compositor_repick(compositor);
if (surface->saved_texture == 0)
glDeleteTextures(1, &surface->texture);
}
static void
-wlsc_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
+weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
{
- struct wlsc_surface *es = (struct wlsc_surface *) surface;
- struct wlsc_compositor *ec = es->compositor;
+ struct weston_surface *es = (struct weston_surface *) surface;
+ struct weston_compositor *ec = es->compositor;
struct wl_list *surfaces_attached_to;
if (es->saved_texture != 0)
switch (wl_shm_buffer_get_format(buffer)) {
case WL_SHM_FORMAT_ARGB32:
- es->visual = WLSC_ARGB_VISUAL;
+ es->visual = WESTON_ARGB_VISUAL;
break;
case WL_SHM_FORMAT_PREMULTIPLIED_ARGB32:
- es->visual = WLSC_PREMUL_ARGB_VISUAL;
+ es->visual = WESTON_PREMUL_ARGB_VISUAL;
break;
case WL_SHM_FORMAT_XRGB32:
- es->visual = WLSC_RGB_VISUAL;
+ es->visual = WESTON_RGB_VISUAL;
break;
}
ec->image_target_texture_2d(GL_TEXTURE_2D, es->image);
/* FIXME: we need to get the visual from the wl_buffer */
- es->visual = WLSC_PREMUL_ARGB_VISUAL;
+ es->visual = WESTON_PREMUL_ARGB_VISUAL;
es->pitch = es->width;
}
}
static int
-texture_region(struct wlsc_surface *es, pixman_region32_t *region)
+texture_region(struct weston_surface *es, pixman_region32_t *region)
{
- struct wlsc_compositor *ec = es->compositor;
+ struct weston_compositor *ec = es->compositor;
GLfloat *v, inv_width, inv_height;
pixman_box32_t *rectangles;
unsigned int *p;
}
static void
-transform_vertex(struct wlsc_surface *surface,
+transform_vertex(struct weston_surface *surface,
GLfloat x, GLfloat y, GLfloat u, GLfloat v, GLfloat *r)
{
- struct wlsc_vector t;
+ struct weston_vector t;
t.f[0] = x;
t.f[1] = y;
t.f[2] = 0.0;
t.f[3] = 1.0;
- wlsc_matrix_transform(&surface->transform->matrix, &t);
+ weston_matrix_transform(&surface->transform->matrix, &t);
r[ 0] = t.f[0];
r[ 1] = t.f[1];
}
static int
-texture_transformed_surface(struct wlsc_surface *es)
+texture_transformed_surface(struct weston_surface *es)
{
- struct wlsc_compositor *ec = es->compositor;
+ struct weston_compositor *ec = es->compositor;
GLfloat *v;
unsigned int *p;
}
static void
-wlsc_surface_draw(struct wlsc_surface *es,
- struct wlsc_output *output, pixman_region32_t *clip)
+weston_surface_draw(struct weston_surface *es,
+ struct weston_output *output, pixman_region32_t *clip)
{
- struct wlsc_compositor *ec = es->compositor;
+ struct weston_compositor *ec = es->compositor;
GLfloat *v;
pixman_region32_t repaint;
GLint filter;
return;
switch (es->visual) {
- case WLSC_ARGB_VISUAL:
+ case WESTON_ARGB_VISUAL:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
break;
- case WLSC_PREMUL_ARGB_VISUAL:
+ case WESTON_PREMUL_ARGB_VISUAL:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
break;
- case WLSC_RGB_VISUAL:
+ case WESTON_RGB_VISUAL:
glDisable(GL_BLEND);
break;
default:
}
static void
-wlsc_surface_raise(struct wlsc_surface *surface)
+weston_surface_raise(struct weston_surface *surface)
{
- struct wlsc_compositor *compositor = surface->compositor;
+ struct weston_compositor *compositor = surface->compositor;
wl_list_remove(&surface->link);
wl_list_insert(&compositor->surface_list, &surface->link);
- wlsc_compositor_repick(compositor);
- wlsc_surface_damage(surface);
+ weston_compositor_repick(compositor);
+ weston_surface_damage(surface);
}
WL_EXPORT void
-wlsc_compositor_damage_all(struct wlsc_compositor *compositor)
+weston_compositor_damage_all(struct weston_compositor *compositor)
{
- struct wlsc_output *output;
+ struct weston_output *output;
wl_list_for_each(output, &compositor->output_list, link)
- wlsc_output_damage(output);
+ weston_output_damage(output);
}
static inline void
-wlsc_buffer_post_release(struct wl_buffer *buffer)
+weston_buffer_post_release(struct wl_buffer *buffer)
{
if (--buffer->busy_count > 0)
return;
}
WL_EXPORT void
-wlsc_output_damage(struct wlsc_output *output)
+weston_output_damage(struct weston_output *output)
{
- struct wlsc_compositor *compositor = output->compositor;
- struct wlsc_surface *es;
+ struct weston_compositor *compositor = output->compositor;
+ struct weston_surface *es;
if (wl_list_empty(&compositor->surface_list))
return;
es = container_of(compositor->surface_list.next,
- struct wlsc_surface, link);
+ struct weston_surface, link);
pixman_region32_union(&es->damage, &es->damage, &output->region);
- wlsc_compositor_schedule_repaint(compositor);
+ weston_compositor_schedule_repaint(compositor);
}
static void
-fade_frame(struct wlsc_animation *animation,
- struct wlsc_output *output, uint32_t msecs)
+fade_frame(struct weston_animation *animation,
+ struct weston_output *output, uint32_t msecs)
{
- struct wlsc_compositor *compositor =
+ struct weston_compositor *compositor =
container_of(animation,
- struct wlsc_compositor, fade.animation);
+ struct weston_compositor, fade.animation);
- wlsc_spring_update(&compositor->fade.spring, msecs);
- if (wlsc_spring_done(&compositor->fade.spring)) {
+ weston_spring_update(&compositor->fade.spring, msecs);
+ if (weston_spring_done(&compositor->fade.spring)) {
compositor->fade.spring.current =
compositor->fade.spring.target;
wl_list_remove(&animation->link);
wl_list_init(&animation->link);
if (compositor->fade.spring.current > 0.999) {
- compositor->state = WLSC_COMPOSITOR_SLEEPING;
+ compositor->state = WESTON_COMPOSITOR_SLEEPING;
compositor->shell->lock(compositor->shell);
}
}
- wlsc_output_damage(output);
+ weston_output_damage(output);
}
static void
-fade_output(struct wlsc_output *output,
+fade_output(struct weston_output *output,
GLfloat tint, pixman_region32_t *region)
{
- struct wlsc_compositor *compositor = output->compositor;
- struct wlsc_surface surface;
+ struct weston_compositor *compositor = output->compositor;
+ struct weston_surface surface;
GLfloat color[4] = { 0.0, 0.0, 0.0, tint };
surface.compositor = compositor;
surface.alpha = compositor->current_alpha;
if (tint <= 1.0)
- surface.visual = WLSC_PREMUL_ARGB_VISUAL;
+ surface.visual = WESTON_PREMUL_ARGB_VISUAL;
else
- surface.visual = WLSC_RGB_VISUAL;
+ surface.visual = WESTON_RGB_VISUAL;
glUseProgram(compositor->solid_shader.program);
glUniformMatrix4fv(compositor->solid_shader.proj_uniform,
1, GL_FALSE, output->matrix.d);
glUniform4fv(compositor->solid_shader.color_uniform, 1, color);
- wlsc_surface_draw(&surface, output, region);
+ weston_surface_draw(&surface, output, region);
}
static void
-wlsc_output_set_cursor(struct wlsc_output *output,
- struct wl_input_device *dev, int force_sw)
+weston_output_set_cursor(struct weston_output *output,
+ struct wl_input_device *dev, int force_sw)
{
- struct wlsc_compositor *ec = output->compositor;
- struct wlsc_input_device *device = (struct wlsc_input_device *) dev;
+ struct weston_compositor *ec = output->compositor;
+ struct weston_input_device *device =
+ (struct weston_input_device *) dev;
pixman_region32_t cursor_region;
int use_hardware_cursor = 1, prior_was_hardware;
prior_was_hardware = wl_list_empty(&device->sprite->link);
if (force_sw || output->set_hardware_cursor(output, device) < 0) {
if (prior_was_hardware) {
- wlsc_surface_damage(device->sprite);
+ weston_surface_damage(device->sprite);
output->set_hardware_cursor(output, NULL);
}
use_hardware_cursor = 0;
} else if (!prior_was_hardware) {
- wlsc_surface_damage_below(device->sprite);
+ weston_surface_damage_below(device->sprite);
}
/* Remove always to be on top. */
}
static int
-setup_scanout_surface(struct wlsc_output *output, struct wlsc_surface *es)
+setup_scanout_surface(struct weston_output *output, struct weston_surface *es)
{
- if (es->visual != WLSC_RGB_VISUAL ||
+ if (es->visual != WESTON_RGB_VISUAL ||
output->prepare_scanout_surface(output, es) != 0)
return -1;
}
static void
-wlsc_output_repaint(struct wlsc_output *output)
+weston_output_repaint(struct weston_output *output)
{
- struct wlsc_compositor *ec = output->compositor;
- struct wlsc_surface *es;
+ struct weston_compositor *ec = output->compositor;
+ struct weston_surface *es;
pixman_region32_t opaque, new_damage, total_damage, repaint;
output->prepare_render(output);
1, GL_FALSE, output->matrix.d);
glUniform1i(ec->texture_shader.tex_uniform, 0);
- wlsc_output_set_cursor(output, ec->input_device,
+ weston_output_set_cursor(output, ec->input_device,
ec->fade.spring.current >= 0.001);
pixman_region32_init(&new_damage);
pixman_region32_fini(&opaque);
pixman_region32_fini(&new_damage);
- es = container_of(ec->surface_list.next, struct wlsc_surface, link);
+ es = container_of(ec->surface_list.next, struct weston_surface, link);
if (setup_scanout_surface(output, es) == 0)
/* We're drawing nothing, just let the damage accumulate */
if (es->width < output->current->width ||
es->height < output->current->height)
glClear(GL_COLOR_BUFFER_BIT);
- wlsc_surface_draw(es, output, &total_damage);
+ weston_surface_draw(es, output, &total_damage);
} else {
wl_list_for_each(es, &ec->surface_list, link) {
pixman_region32_copy(&es->damage, &total_damage);
pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, &output->region,
&es->damage);
- wlsc_surface_draw(es, output, &repaint);
+ weston_surface_draw(es, output, &repaint);
pixman_region32_subtract(&es->damage,
&es->damage, &output->region);
}
fade_output(output, ec->fade.spring.current, &total_damage);
}
-struct wlsc_frame_callback {
+struct weston_frame_callback {
struct wl_resource resource;
struct wl_list link;
};
static void
repaint(void *data, int msecs)
{
- struct wlsc_output *output = data;
- struct wlsc_compositor *compositor = output->compositor;
- struct wlsc_animation *animation, *next;
- struct wlsc_frame_callback *cb, *cnext;
+ struct weston_output *output = data;
+ struct weston_compositor *compositor = output->compositor;
+ struct weston_animation *animation, *next;
+ struct weston_frame_callback *cb, *cnext;
- wlsc_output_repaint(output);
+ weston_output_repaint(output);
output->repaint_needed = 0;
output->repaint_scheduled = 1;
output->present(output);
static void
idle_repaint(void *data)
{
- repaint(data, wlsc_compositor_get_time());
+ repaint(data, weston_compositor_get_time());
}
WL_EXPORT void
-wlsc_output_finish_frame(struct wlsc_output *output, int msecs)
+weston_output_finish_frame(struct weston_output *output, int msecs)
{
if (output->scanout_buffer) {
- wlsc_buffer_post_release(output->scanout_buffer);
+ weston_buffer_post_release(output->scanout_buffer);
wl_list_remove(&output->scanout_buffer_destroy_listener.link);
output->scanout_buffer = NULL;
}
}
WL_EXPORT void
-wlsc_compositor_schedule_repaint(struct wlsc_compositor *compositor)
+weston_compositor_schedule_repaint(struct weston_compositor *compositor)
{
- struct wlsc_output *output;
+ struct weston_output *output;
struct wl_event_loop *loop;
- if (compositor->state == WLSC_COMPOSITOR_SLEEPING)
+ if (compositor->state == WESTON_COMPOSITOR_SLEEPING)
return;
loop = wl_display_get_event_loop(compositor->wl_display);
}
WL_EXPORT void
-wlsc_compositor_fade(struct wlsc_compositor *compositor, float tint)
+weston_compositor_fade(struct weston_compositor *compositor, float tint)
{
int done;
- done = wlsc_spring_done(&compositor->fade.spring);
+ done = weston_spring_done(&compositor->fade.spring);
compositor->fade.spring.target = tint;
- if (wlsc_spring_done(&compositor->fade.spring))
+ if (weston_spring_done(&compositor->fade.spring))
return;
if (done)
compositor->fade.spring.timestamp =
- wlsc_compositor_get_time();
+ weston_compositor_get_time();
- wlsc_compositor_damage_all(compositor);
+ weston_compositor_damage_all(compositor);
if (wl_list_empty(&compositor->fade.animation.link))
wl_list_insert(compositor->animation_list.prev,
&compositor->fade.animation.link);
static void
surface_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, wlsc_compositor_get_time());
+ wl_resource_destroy(resource, weston_compositor_get_time());
}
WL_EXPORT void
-wlsc_surface_assign_output(struct wlsc_surface *es)
+weston_surface_assign_output(struct weston_surface *es)
{
- struct wlsc_compositor *ec = es->compositor;
- struct wlsc_output *output, *new_output;
+ struct weston_compositor *ec = es->compositor;
+ struct weston_output *output, *new_output;
pixman_region32_t region;
uint32_t max, area;
pixman_box32_t *e;
struct wl_resource *resource,
struct wl_resource *buffer_resource, int32_t x, int32_t y)
{
- struct wlsc_surface *es = resource->data;
- struct wlsc_shell *shell = es->compositor->shell;
+ struct weston_surface *es = resource->data;
+ struct weston_shell *shell = es->compositor->shell;
struct wl_buffer *buffer = buffer_resource->data;
if (es->buffer) {
- wlsc_buffer_post_release(es->buffer);
+ weston_buffer_post_release(es->buffer);
wl_list_remove(&es->buffer_destroy_listener.link);
}
wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
&es->buffer_destroy_listener.link);
- if (es->visual == WLSC_NONE_VISUAL) {
+ if (es->visual == WESTON_NONE_VISUAL) {
shell->map(shell, es, buffer->width, buffer->height);
} else if (x != 0 || y != 0 ||
es->width != buffer->width ||
buffer->width, buffer->height);
}
- wlsc_buffer_attach(buffer, &es->surface);
+ weston_buffer_attach(buffer, &es->surface);
}
static void
struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct wlsc_surface *es = resource->data;
+ struct weston_surface *es = resource->data;
- wlsc_surface_damage_rectangle(es, x, y, width, height);
+ weston_surface_damage_rectangle(es, x, y, width, height);
}
static void
destroy_frame_callback(struct wl_resource *resource)
{
- struct wlsc_frame_callback *cb = resource->data;
+ struct weston_frame_callback *cb = resource->data;
wl_list_remove(&cb->link);
free(cb);
surface_frame(struct wl_client *client,
struct wl_resource *resource, uint32_t callback)
{
- struct wlsc_frame_callback *cb;
- struct wlsc_surface *es = resource->data;
+ struct weston_frame_callback *cb;
+ struct weston_surface *es = resource->data;
cb = malloc(sizeof *cb);
if (cb == NULL) {
compositor_create_surface(struct wl_client *client,
struct wl_resource *resource, uint32_t id)
{
- struct wlsc_compositor *ec = resource->data;
- struct wlsc_surface *surface;
+ struct weston_compositor *ec = resource->data;
+ struct weston_surface *surface;
- surface = wlsc_surface_create(ec, 0, 0, 0, 0);
+ surface = weston_surface_create(ec, 0, 0, 0, 0);
if (surface == NULL) {
wl_resource_post_no_memory(resource);
return;
};
static void
-wlsc_surface_transform(struct wlsc_surface *surface,
+weston_surface_transform(struct weston_surface *surface,
int32_t x, int32_t y, int32_t *sx, int32_t *sy)
{
*sx = x - surface->x;
*sy = y - surface->y;
}
-static struct wlsc_surface *
-wlsc_compositor_pick_surface(struct wlsc_compositor *compositor,
- int32_t x, int32_t y, int32_t *sx, int32_t *sy)
+static struct weston_surface *
+weston_compositor_pick_surface(struct weston_compositor *compositor,
+ int32_t x, int32_t y, int32_t *sx, int32_t *sy)
{
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
wl_list_for_each(surface, &compositor->surface_list, link) {
if (surface->surface.resource.client == NULL)
continue;
- wlsc_surface_transform(surface, x, y, sx, sy);
+ weston_surface_transform(surface, x, y, sx, sy);
if (0 <= *sx && *sx < surface->width &&
0 <= *sy && *sy < surface->height)
return surface;
return NULL;
}
-WL_EXPORT struct wlsc_surface *
+WL_EXPORT struct weston_surface *
pick_surface(struct wl_input_device *device, int32_t *sx, int32_t *sy)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
- return wlsc_compositor_pick_surface(wd->compositor,
+ return weston_compositor_pick_surface(wd->compositor,
device->x, device->y, sx, sy);
}
implicit_grab_motion(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
- struct wlsc_input_device *device =
- (struct wlsc_input_device *) grab->input_device;
- struct wlsc_surface *es =
- (struct wlsc_surface *) device->input_device.pointer_focus;
+ struct weston_input_device *device =
+ (struct weston_input_device *) grab->input_device;
+ struct weston_surface *es =
+ (struct weston_surface *) device->input_device.pointer_focus;
int32_t sx, sy;
struct wl_resource *resource;
resource = grab->input_device->pointer_focus_resource;
if (resource) {
- wlsc_surface_transform(es, x, y, &sx, &sy);
+ weston_surface_transform(es, x, y, &sx, &sy);
wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION,
time, x, y, sx, sy);
}
};
WL_EXPORT void
-wlsc_compositor_wake(struct wlsc_compositor *compositor)
+weston_compositor_wake(struct weston_compositor *compositor)
{
- compositor->state = WLSC_COMPOSITOR_ACTIVE;
- wlsc_compositor_fade(compositor, 0.0);
+ compositor->state = WESTON_COMPOSITOR_ACTIVE;
+ weston_compositor_fade(compositor, 0.0);
wl_event_source_timer_update(compositor->idle_source,
compositor->idle_time * 1000);
}
WL_EXPORT void
-wlsc_compositor_activity(struct wlsc_compositor *compositor)
+weston_compositor_activity(struct weston_compositor *compositor)
{
- if (compositor->state == WLSC_COMPOSITOR_ACTIVE) {
- wlsc_compositor_wake(compositor);
+ if (compositor->state == WESTON_COMPOSITOR_ACTIVE) {
+ weston_compositor_wake(compositor);
} else {
compositor->shell->unlock(compositor->shell);
}
}
static void
-wlsc_compositor_idle_inhibit(struct wlsc_compositor *compositor)
+weston_compositor_idle_inhibit(struct weston_compositor *compositor)
{
- wlsc_compositor_activity(compositor);
+ weston_compositor_activity(compositor);
compositor->idle_inhibit++;
}
static void
-wlsc_compositor_idle_release(struct wlsc_compositor *compositor)
+weston_compositor_idle_release(struct weston_compositor *compositor)
{
compositor->idle_inhibit--;
- wlsc_compositor_activity(compositor);
+ weston_compositor_activity(compositor);
}
static int
idle_handler(void *data)
{
- struct wlsc_compositor *compositor = data;
+ struct weston_compositor *compositor = data;
if (compositor->idle_inhibit)
return 1;
- wlsc_compositor_fade(compositor, 1.0);
+ weston_compositor_fade(compositor, 1.0);
return 1;
}
WL_EXPORT void
notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
{
- struct wlsc_surface *es;
- struct wlsc_output *output;
+ struct weston_surface *es;
+ struct weston_output *output;
const struct wl_grab_interface *interface;
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *ec = wd->compositor;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *ec = wd->compositor;
int32_t sx, sy;
int x_valid = 0, y_valid = 0;
int min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN;
- wlsc_compositor_activity(ec);
+ weston_compositor_activity(ec);
wl_list_for_each(output, &ec->output_list, link) {
if (output->x <= x && x <= output->x + output->current->width)
}
if (wd->sprite) {
- wlsc_surface_damage_below(wd->sprite);
+ weston_surface_damage_below(wd->sprite);
wd->sprite->x = device->x - wd->hotspot_x;
wd->sprite->y = device->y - wd->hotspot_y;
- wlsc_surface_damage(wd->sprite);
+ weston_surface_damage(wd->sprite);
}
}
WL_EXPORT void
-wlsc_surface_activate(struct wlsc_surface *surface,
- struct wlsc_input_device *device, uint32_t time)
+weston_surface_activate(struct weston_surface *surface,
+ struct weston_input_device *device, uint32_t time)
{
- wlsc_surface_raise(surface);
+ weston_surface_raise(surface);
wl_input_device_set_keyboard_focus(&device->input_device,
&surface->surface, time);
- wlsc_data_device_set_keyboard_focus(device);
+ weston_data_device_set_keyboard_focus(device);
}
WL_EXPORT void
notify_button(struct wl_input_device *device,
uint32_t time, int32_t button, int32_t state)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *compositor = wd->compositor;
- struct wlsc_surface *surface =
- (struct wlsc_surface *) device->pointer_focus;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *compositor = wd->compositor;
+ struct weston_surface *surface =
+ (struct weston_surface *) device->pointer_focus;
int32_t sx, sy;
if (state)
- wlsc_compositor_idle_inhibit(compositor);
+ weston_compositor_idle_inhibit(compositor);
else
- wlsc_compositor_idle_release(compositor);
+ weston_compositor_idle_release(compositor);
- wlsc_compositor_run_binding(compositor, wd, time, 0, button, state);
+ weston_compositor_run_binding(compositor, wd, time, 0, button, state);
if (state && surface && device->grab == NULL) {
wl_input_device_start_grab(device,
}
static void
-update_modifier_state(struct wlsc_input_device *device,
+update_modifier_state(struct weston_input_device *device,
uint32_t key, uint32_t state)
{
uint32_t modifier;
notify_key(struct wl_input_device *device,
uint32_t time, uint32_t key, uint32_t state)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *compositor = wd->compositor;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *compositor = wd->compositor;
uint32_t *k, *end;
if (state)
- wlsc_compositor_idle_inhibit(compositor);
+ weston_compositor_idle_inhibit(compositor);
else
- wlsc_compositor_idle_release(compositor);
+ weston_compositor_idle_release(compositor);
- wlsc_compositor_run_binding(compositor, wd, time, key, 0, state);
+ weston_compositor_run_binding(compositor, wd, time, key, 0, state);
update_modifier_state(wd, key, state);
end = device->keys.data + device->keys.size;
WL_EXPORT void
notify_pointer_focus(struct wl_input_device *device,
- uint32_t time, struct wlsc_output *output,
+ uint32_t time, struct weston_output *output,
int32_t x, int32_t y)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *compositor = wd->compositor;
- struct wlsc_surface *es;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *compositor = wd->compositor;
+ struct weston_surface *es;
int32_t sx, sy;
if (output) {
WL_EXPORT void
notify_keyboard_focus(struct wl_input_device *device,
- uint32_t time, struct wlsc_output *output,
+ uint32_t time, struct weston_output *output,
struct wl_array *keys)
{
- struct wlsc_input_device *wd =
- (struct wlsc_input_device *) device;
- struct wlsc_compositor *compositor = wd->compositor;
- struct wlsc_surface *es;
+ struct weston_input_device *wd =
+ (struct weston_input_device *) device;
+ struct weston_compositor *compositor = wd->compositor;
+ struct weston_surface *es;
uint32_t *k, *end;
if (!wl_list_empty(&compositor->surface_list))
es = container_of(compositor->surface_list.next,
- struct wlsc_surface, link);
+ struct weston_surface, link);
else
es = NULL;
wd->modifier_state = 0;
end = device->keys.data + device->keys.size;
for (k = device->keys.data; k < end; k++) {
- wlsc_compositor_idle_inhibit(compositor);
+ weston_compositor_idle_inhibit(compositor);
update_modifier_state(wd, *k, 1);
}
} else {
end = device->keys.data + device->keys.size;
for (k = device->keys.data; k < end; k++)
- wlsc_compositor_idle_release(compositor);
+ weston_compositor_idle_release(compositor);
wd->modifier_state = 0;
wl_input_device_set_keyboard_focus(&wd->input_device,
lose_touch_focus_resource(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_input_device *device =
- container_of(listener, struct wlsc_input_device,
+ struct weston_input_device *device =
+ container_of(listener, struct weston_input_device,
touch_focus_resource_listener);
device->touch_focus_resource = NULL;
lose_touch_focus(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_input_device *device =
- container_of(listener, struct wlsc_input_device,
+ struct weston_input_device *device =
+ container_of(listener, struct weston_input_device,
touch_focus_listener);
device->touch_focus = NULL;
}
static void
-touch_set_focus(struct wlsc_input_device *device,
+touch_set_focus(struct weston_input_device *device,
struct wl_surface *surface, uint32_t time)
{
struct wl_input_device *input_device = &device->input_device;
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
int x, int y, int touch_type)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *ec = wd->compositor;
- struct wlsc_surface *es;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *ec = wd->compositor;
+ struct weston_surface *es;
int32_t sx, sy;
switch (touch_type) {
case WL_INPUT_DEVICE_TOUCH_DOWN:
- wlsc_compositor_idle_inhibit(ec);
+ weston_compositor_idle_inhibit(ec);
wd->num_tp++;
* to that surface for the remainder of the touch session i.e.
* until all touch points are up again. */
if (wd->num_tp == 1) {
- es = wlsc_compositor_pick_surface(ec, x, y, &sx, &sy);
+ es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
touch_set_focus(wd, &es->surface, time);
} else if (wd->touch_focus) {
- es = (struct wlsc_surface *) wd->touch_focus;
- wlsc_surface_transform(es, x, y, &sx, &sy);
+ es = (struct weston_surface *) wd->touch_focus;
+ weston_surface_transform(es, x, y, &sx, &sy);
}
if (wd->touch_focus_resource && wd->touch_focus)
touch_id, sx, sy);
break;
case WL_INPUT_DEVICE_TOUCH_MOTION:
- es = (struct wlsc_surface *) wd->touch_focus;
+ es = (struct weston_surface *) wd->touch_focus;
if (!es)
break;
- wlsc_surface_transform(es, x, y, &sx, &sy);
+ weston_surface_transform(es, x, y, &sx, &sy);
if (wd->touch_focus_resource)
wl_resource_post_event(wd->touch_focus_resource,
touch_type, time,
touch_id, sx, sy);
break;
case WL_INPUT_DEVICE_TOUCH_UP:
- wlsc_compositor_idle_release(ec);
+ weston_compositor_idle_release(ec);
wd->num_tp--;
if (wd->touch_focus_resource)
uint32_t time,
struct wl_resource *buffer_resource, int32_t x, int32_t y)
{
- struct wlsc_input_device *device = resource->data;
- struct wlsc_compositor *compositor = device->compositor;
+ struct weston_input_device *device = resource->data;
+ struct weston_compositor *compositor = device->compositor;
struct wl_buffer *buffer;
if (time < device->input_device.pointer_focus_time)
return;
if (device->sprite)
- wlsc_surface_damage_below(device->sprite);
+ weston_surface_damage_below(device->sprite);
if (!buffer_resource) {
destroy_surface(&device->sprite->surface.resource);
if (!device->sprite) {
device->sprite =
- wlsc_surface_create(compositor,
+ weston_surface_create(compositor,
device->input_device.x,
device->input_device.y, 32, 32);
wl_list_init(&device->sprite->link);
}
buffer = buffer_resource->data;
- wlsc_buffer_attach(buffer, &device->sprite->surface);
+ weston_buffer_attach(buffer, &device->sprite->surface);
device->hotspot_x = x;
device->hotspot_y = y;
device->sprite->x = device->input_device.x - device->hotspot_x;
device->sprite->y = device->input_device.y - device->hotspot_y;
- wlsc_surface_damage(device->sprite);
+ weston_surface_damage(device->sprite);
}
const static struct wl_input_device_interface input_device_interface = {
}
WL_EXPORT void
-wlsc_input_device_init(struct wlsc_input_device *device,
- struct wlsc_compositor *ec)
+weston_input_device_init(struct weston_input_device *device,
+ struct weston_compositor *ec)
{
wl_input_device_init(&device->input_device);
wl_list_init(&device->drag_resource_list);
bind_output(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- struct wlsc_output *output = data;
- struct wlsc_mode *mode;
+ struct weston_output *output = data;
+ struct weston_mode *mode;
struct wl_resource *resource;
resource = wl_client_add_object(client,
}
static int
-wlsc_shader_init(struct wlsc_shader *shader,
- const char *vertex_source, const char *fragment_source)
+weston_shader_init(struct weston_shader *shader,
+ const char *vertex_source, const char *fragment_source)
{
char msg[512];
GLint status;
}
static int
-init_solid_shader(struct wlsc_shader *shader,
+init_solid_shader(struct weston_shader *shader,
GLuint vertex_shader, const char *fragment_source)
{
GLint status;
}
WL_EXPORT void
-wlsc_output_destroy(struct wlsc_output *output)
+weston_output_destroy(struct weston_output *output)
{
pixman_region32_fini(&output->region);
pixman_region32_fini(&output->previous_damage);
}
WL_EXPORT void
-wlsc_output_move(struct wlsc_output *output, int x, int y)
+weston_output_move(struct weston_output *output, int x, int y)
{
int flip;
output->current->width,
output->current->height);
- wlsc_matrix_init(&output->matrix);
- wlsc_matrix_translate(&output->matrix,
+ weston_matrix_init(&output->matrix);
+ weston_matrix_translate(&output->matrix,
-output->x - output->current->width / 2.0,
-output->y - output->current->height / 2.0, 0);
flip = (output->flags & WL_OUTPUT_FLIPPED) ? -1 : 1;
- wlsc_matrix_scale(&output->matrix,
+ weston_matrix_scale(&output->matrix,
2.0 / output->current->width,
flip * 2.0 / output->current->height, 1);
- wlsc_output_damage(output);
+ weston_output_damage(output);
}
WL_EXPORT void
-wlsc_output_init(struct wlsc_output *output, struct wlsc_compositor *c,
- int x, int y, int width, int height, uint32_t flags)
+weston_output_init(struct weston_output *output, struct weston_compositor *c,
+ int x, int y, int width, int height, uint32_t flags)
{
output->compositor = c;
output->x = x;
output->mm_height = height;
output->flags = flags;
- wlsc_output_move(output, x, y);
+ weston_output_move(output, x, y);
output->scanout_buffer_destroy_listener.func =
output_handle_scanout_buffer_destroy;
int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_list *surfaces_attached_to = buffer->user_data;
- struct wlsc_surface *es;
+ struct weston_surface *es;
GLsizei tex_width = wl_shm_buffer_get_stride(buffer) / 4;
wl_list_for_each(es, surfaces_attached_to, buffer_link) {
shm_buffer_destroyed(struct wl_buffer *buffer)
{
struct wl_list *surfaces_attached_to = buffer->user_data;
- struct wlsc_surface *es, *next;
+ struct weston_surface *es, *next;
wl_list_for_each_safe(es, next, surfaces_attached_to, buffer_link) {
wl_list_remove(&es->buffer_link);
compositor_bind(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- struct wlsc_compositor *compositor = data;
+ struct weston_compositor *compositor = data;
wl_client_add_object(client, &wl_compositor_interface,
&compositor_interface, id, compositor);
}
WL_EXPORT int
-wlsc_compositor_init(struct wlsc_compositor *ec, struct wl_display *display)
+weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
{
struct wl_event_loop *loop;
const char *extensions;
wl_list_init(&ec->output_list);
wl_list_init(&ec->binding_list);
wl_list_init(&ec->animation_list);
- wlsc_spring_init(&ec->fade.spring, 30.0, 1.0, 1.0);
+ weston_spring_init(&ec->fade.spring, 30.0, 1.0, 1.0);
ec->fade.animation.frame = fade_frame;
wl_list_init(&ec->fade.animation.link);
screenshooter_create(ec);
- wlsc_data_device_manager_init(ec);
+ weston_data_device_manager_init(ec);
glActiveTexture(GL_TEXTURE0);
- if (wlsc_shader_init(&ec->texture_shader,
+ if (weston_shader_init(&ec->texture_shader,
vertex_shader, texture_fragment_shader) < 0)
return -1;
if (init_solid_shader(&ec->solid_shader,
ec->idle_source = wl_event_loop_add_timer(loop, idle_handler, ec);
wl_event_source_timer_update(ec->idle_source, ec->idle_time * 1000);
- wlsc_compositor_schedule_repaint(ec);
+ weston_compositor_schedule_repaint(ec);
return 0;
}
WL_EXPORT void
-wlsc_compositor_shutdown(struct wlsc_compositor *ec)
+weston_compositor_shutdown(struct weston_compositor *ec)
{
- struct wlsc_output *output, *next;
+ struct weston_output *output, *next;
/* Destroy all outputs associated with this compositor */
wl_list_for_each_safe(output, next, &ec->output_list, link)
int main(int argc, char *argv[])
{
struct wl_display *display;
- struct wlsc_compositor *ec;
+ struct weston_compositor *ec;
struct wl_event_loop *loop;
int o, xserver = 0;
void *shell_module, *backend_module;
- int (*shell_init)(struct wlsc_compositor *ec);
- struct wlsc_compositor
+ int (*shell_init)(struct weston_compositor *ec);
+ struct weston_compositor
*(*backend_init)(struct wl_display *display, char *options);
char *backend = NULL;
char *backend_options = "";
exit(EXIT_FAILURE);
if (xserver)
- wlsc_xserver_init(ec);
+ weston_xserver_init(ec);
if (wl_display_add_socket(display, option_socket_name)) {
fprintf(stderr, "failed to add socket: %m\n");
wl_display_run(display);
if (xserver)
- wlsc_xserver_destroy(ec);
+ weston_xserver_destroy(ec);
if (ec->has_bind_display)
ec->unbind_display(ec->display, display);
--- /dev/null
+/*
+ * Copyright © 2008-2011 Kristian Høgsberg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The copyright holders make
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
+#define _WAYLAND_SYSTEM_COMPOSITOR_H_
+
+#include <libudev.h>
+#include <pixman.h>
+#include <wayland-server.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+struct weston_matrix {
+ GLfloat d[16];
+};
+
+struct weston_vector {
+ GLfloat f[4];
+};
+
+void
+weston_matrix_init(struct weston_matrix *matrix);
+void
+weston_matrix_scale(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z);
+void
+weston_matrix_translate(struct weston_matrix *matrix,
+ GLfloat x, GLfloat y, GLfloat z);
+void
+weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v);
+
+struct weston_transform {
+ struct weston_matrix matrix;
+ struct weston_matrix inverse;
+};
+
+struct weston_surface;
+struct weston_input_device;
+
+struct weston_mode {
+ uint32_t flags;
+ int32_t width, height;
+ uint32_t refresh;
+ struct wl_list link;
+};
+
+struct weston_output {
+ struct wl_list link;
+ struct weston_compositor *compositor;
+ struct weston_matrix matrix;
+ struct wl_list frame_callback_list;
+ int32_t x, y, mm_width, mm_height;
+ pixman_region32_t region;
+ pixman_region32_t previous_damage;
+ uint32_t flags;
+ int repaint_needed;
+ int repaint_scheduled;
+
+ char *make, *model;
+ uint32_t subpixel;
+
+ struct weston_mode *current;
+ struct wl_list mode_list;
+ struct wl_buffer *scanout_buffer;
+ struct wl_listener scanout_buffer_destroy_listener;
+ struct wl_buffer *pending_scanout_buffer;
+ struct wl_listener pending_scanout_buffer_destroy_listener;
+
+ int (*prepare_render)(struct weston_output *output);
+ int (*present)(struct weston_output *output);
+ int (*prepare_scanout_surface)(struct weston_output *output,
+ struct weston_surface *es);
+ int (*set_hardware_cursor)(struct weston_output *output,
+ struct weston_input_device *input);
+ void (*destroy)(struct weston_output *output);
+};
+
+struct weston_input_device {
+ struct wl_input_device input_device;
+ struct weston_compositor *compositor;
+ struct weston_surface *sprite;
+ int32_t hotspot_x, hotspot_y;
+ struct wl_list link;
+ uint32_t modifier_state;
+ struct wl_selection *selection;
+
+ struct wl_list drag_resource_list;
+ struct weston_data_source *drag_data_source;
+ struct wl_surface *drag_focus;
+ struct wl_resource *drag_focus_resource;
+ struct wl_listener drag_focus_listener;
+
+ struct weston_data_source *selection_data_source;
+ struct wl_listener selection_data_source_listener;
+ struct wl_grab grab;
+
+ uint32_t num_tp;
+ struct wl_surface *touch_focus;
+ struct wl_listener touch_focus_listener;
+ struct wl_resource *touch_focus_resource;
+ struct wl_listener touch_focus_resource_listener;
+};
+
+enum weston_visual {
+ WESTON_NONE_VISUAL,
+ WESTON_ARGB_VISUAL,
+ WESTON_PREMUL_ARGB_VISUAL,
+ WESTON_RGB_VISUAL
+};
+
+struct weston_shader {
+ GLuint program;
+ GLuint vertex_shader, fragment_shader;
+ GLuint proj_uniform;
+ GLuint tex_uniform;
+ GLuint alpha_uniform;
+ GLuint color_uniform;
+};
+
+struct weston_animation {
+ void (*frame)(struct weston_animation *animation,
+ struct weston_output *output, uint32_t msecs);
+ struct wl_list link;
+};
+
+struct weston_spring {
+ double k;
+ double friction;
+ double current;
+ double target;
+ double previous;
+ uint32_t timestamp;
+};
+
+struct weston_shell {
+ void (*lock)(struct weston_shell *shell);
+ void (*unlock)(struct weston_shell *shell);
+ void (*map)(struct weston_shell *shell, struct weston_surface *surface,
+ int32_t width, int32_t height);
+ void (*configure)(struct weston_shell *shell,
+ struct weston_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height);
+};
+
+enum {
+ WESTON_COMPOSITOR_ACTIVE,
+ WESTON_COMPOSITOR_IDLE, /* shell->unlock called on activity */
+ WESTON_COMPOSITOR_SLEEPING /* no rendering, no frame events */
+};
+
+struct weston_compositor {
+ struct wl_shm *shm;
+ struct weston_xserver *wxs;
+
+ EGLDisplay display;
+ EGLContext context;
+ EGLConfig config;
+ GLuint fbo;
+ GLuint proj_uniform, tex_uniform, alpha_uniform;
+ uint32_t current_alpha;
+ struct weston_shader texture_shader;
+ struct weston_shader solid_shader;
+ struct wl_display *wl_display;
+
+ struct weston_shell *shell;
+
+ /* There can be more than one, but not right now... */
+ struct wl_input_device *input_device;
+
+ struct wl_list output_list;
+ struct wl_list input_device_list;
+ struct wl_list surface_list;
+ struct wl_list binding_list;
+ struct wl_list animation_list;
+ struct {
+ struct weston_spring spring;
+ struct weston_animation animation;
+ } fade;
+
+ uint32_t state;
+ struct wl_event_source *idle_source;
+ uint32_t idle_inhibit;
+ int option_idle_time; /* default timeout, s */
+ int idle_time; /* effective timeout, s */
+
+ /* Repaint state. */
+ struct timespec previous_swap;
+ struct wl_array vertices, indices;
+
+ struct weston_surface *overlay;
+ struct weston_switcher *switcher;
+ uint32_t focus;
+
+ PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC
+ image_target_renderbuffer_storage;
+ PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
+ PFNEGLCREATEIMAGEKHRPROC create_image;
+ PFNEGLDESTROYIMAGEKHRPROC destroy_image;
+ PFNEGLBINDWAYLANDDISPLAYWL bind_display;
+ PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display;
+ int has_bind_display;
+
+ void (*destroy)(struct weston_compositor *ec);
+ int (*authenticate)(struct weston_compositor *c, uint32_t id);
+ EGLImageKHR (*create_cursor_image)(struct weston_compositor *c,
+ int32_t *width, int32_t *height);
+};
+
+#define MODIFIER_CTRL (1 << 8)
+#define MODIFIER_ALT (1 << 9)
+#define MODIFIER_SUPER (1 << 10)
+
+enum weston_output_flags {
+ WL_OUTPUT_FLIPPED = 0x01
+};
+
+struct weston_surface {
+ struct wl_surface surface;
+ struct weston_compositor *compositor;
+ GLuint texture, saved_texture;
+ pixman_region32_t damage;
+ pixman_region32_t opaque;
+ int32_t x, y, width, height;
+ int32_t pitch;
+ struct wl_list link;
+ struct wl_list buffer_link;
+ struct weston_transform *transform;
+ uint32_t alpha;
+ uint32_t visual;
+
+ /*
+ * Which output to vsync this surface to.
+ * Used to determine, whether to send or queue frame events.
+ * Must be NULL, if 'link' is not in weston_compositor::surface_list.
+ */
+ struct weston_output *output;
+
+ struct weston_output *fullscreen_output;
+ struct wl_list frame_callback_list;
+
+ EGLImageKHR image;
+
+ struct wl_buffer *buffer;
+ struct wl_listener buffer_destroy_listener;
+};
+
+struct weston_data_source {
+ struct wl_resource resource;
+ struct wl_array mime_types;
+ int refcount;
+ void *data;
+
+ struct wl_resource *(*create_offer)(struct weston_data_source *source,
+ struct wl_resource *target);
+
+ void (*cancel)(struct weston_data_source *source);
+};
+
+void
+weston_data_source_unref(struct weston_data_source *source);
+
+void
+weston_input_device_set_selection(struct weston_input_device *device,
+ struct weston_data_source *source,
+ uint32_t time);
+
+void
+weston_spring_init(struct weston_spring *spring,
+ double k, double current, double target);
+void
+weston_spring_update(struct weston_spring *spring, uint32_t msec);
+int
+weston_spring_done(struct weston_spring *spring);
+
+void
+weston_surface_activate(struct weston_surface *surface,
+ struct weston_input_device *device, uint32_t time);
+
+void
+notify_motion(struct wl_input_device *device,
+ uint32_t time, int x, int y);
+void
+notify_button(struct wl_input_device *device,
+ uint32_t time, int32_t button, int32_t state);
+void
+notify_key(struct wl_input_device *device,
+ uint32_t time, uint32_t key, uint32_t state);
+
+void
+notify_pointer_focus(struct wl_input_device *device,
+ uint32_t time,
+ struct weston_output *output,
+ int32_t x, int32_t y);
+
+void
+notify_keyboard_focus(struct wl_input_device *device,
+ uint32_t time, struct weston_output *output,
+ struct wl_array *keys);
+
+void
+notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
+ int x, int y, int touch_type);
+
+void
+weston_output_finish_frame(struct weston_output *output, int msecs);
+void
+weston_output_damage(struct weston_output *output);
+void
+weston_compositor_repick(struct weston_compositor *compositor);
+void
+weston_compositor_schedule_repaint(struct weston_compositor *compositor);
+void
+weston_compositor_fade(struct weston_compositor *compositor, float tint);
+void
+weston_compositor_damage_all(struct weston_compositor *compositor);
+void
+weston_compositor_unlock(struct weston_compositor *compositor);
+void
+weston_compositor_wake(struct weston_compositor *compositor);
+void
+weston_compositor_activity(struct weston_compositor *compositor);
+
+struct weston_binding;
+typedef void (*weston_binding_handler_t)(struct wl_input_device *device,
+ uint32_t time, uint32_t key,
+ uint32_t button,
+ uint32_t state, void *data);
+struct weston_binding *
+weston_compositor_add_binding(struct weston_compositor *compositor,
+ uint32_t key, uint32_t button, uint32_t modifier,
+ weston_binding_handler_t binding, void *data);
+void
+weston_binding_destroy(struct weston_binding *binding);
+
+void
+weston_compositor_run_binding(struct weston_compositor *compositor,
+ struct weston_input_device *device,
+ uint32_t time,
+ uint32_t key, uint32_t button, int32_t state);
+
+struct weston_surface *
+weston_surface_create(struct weston_compositor *compositor,
+ int32_t x, int32_t y, int32_t width, int32_t height);
+
+void
+weston_surface_configure(struct weston_surface *surface,
+ int x, int y, int width, int height);
+
+void
+weston_surface_assign_output(struct weston_surface *surface);
+
+void
+weston_surface_damage(struct weston_surface *surface);
+
+void
+weston_surface_damage_below(struct weston_surface *surface);
+
+void
+weston_surface_damage_rectangle(struct weston_surface *surface,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
+
+struct weston_surface *
+pick_surface(struct wl_input_device *device, int32_t *sx, int32_t *sy);
+
+uint32_t
+weston_compositor_get_time(void);
+
+int
+weston_compositor_init(struct weston_compositor *ec, struct wl_display *display);
+void
+weston_compositor_shutdown(struct weston_compositor *ec);
+void
+weston_output_move(struct weston_output *output, int x, int y);
+void
+weston_output_init(struct weston_output *output, struct weston_compositor *c,
+ int x, int y, int width, int height, uint32_t flags);
+void
+weston_output_destroy(struct weston_output *output);
+
+void
+weston_input_device_init(struct weston_input_device *device,
+ struct weston_compositor *ec);
+
+void
+weston_switcher_init(struct weston_compositor *compositor);
+
+enum {
+ TTY_ENTER_VT,
+ TTY_LEAVE_VT
+};
+
+typedef void (*tty_vt_func_t)(struct weston_compositor *compositor, int event);
+
+struct tty *
+tty_create(struct weston_compositor *compositor,
+ tty_vt_func_t vt_func, int tty_nr);
+
+void
+tty_destroy(struct tty *tty);
+
+void
+screenshooter_create(struct weston_compositor *ec);
+
+uint32_t *
+weston_load_image(const char *filename,
+ int32_t *width_arg, int32_t *height_arg,
+ uint32_t *stride_arg);
+
+struct weston_process;
+typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
+ int status);
+
+struct weston_process {
+ pid_t pid;
+ weston_process_cleanup_func_t cleanup;
+ struct wl_list link;
+};
+
+struct wl_client *
+weston_client_launch(struct weston_compositor *compositor,
+ struct weston_process *proc,
+ const char *path,
+ weston_process_cleanup_func_t cleanup);
+
+int
+weston_data_device_manager_init(struct weston_compositor *compositor);
+void
+weston_data_device_set_keyboard_focus(struct weston_input_device *device);
+
+void
+weston_watch_process(struct weston_process *process);
+
+int
+weston_xserver_init(struct weston_compositor *compositor);
+void
+weston_xserver_destroy(struct weston_compositor *compositor);
+void
+weston_xserver_surface_activate(struct weston_surface *surface);
+void
+weston_xserver_set_selection(struct weston_input_device *device);
+
+struct weston_zoom;
+typedef void (*weston_zoom_done_func_t)(struct weston_zoom *zoom, void *data);
+
+struct weston_zoom *
+weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
+ weston_zoom_done_func_t done, void *data);
+
+#endif
#include "compositor.h"
void
-wlsc_data_source_unref(struct wlsc_data_source *source)
+weston_data_source_unref(struct weston_data_source *source)
{
source->refcount--;
if (source->refcount == 0)
data_offer_accept(struct wl_client *client, struct wl_resource *resource,
uint32_t time, const char *mime_type)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
/* FIXME: Check that client is currently focused by the input
* device that is currently dragging this data source. Should
data_offer_receive(struct wl_client *client, struct wl_resource *resource,
const char *mime_type, int32_t fd)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
wl_resource_post_event(&source->resource,
WL_DATA_SOURCE_SEND, mime_type, fd);
static void
data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, wlsc_compositor_get_time());
+ wl_resource_destroy(resource, weston_compositor_get_time());
}
static void
destroy_data_offer(struct wl_resource *resource)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
- wlsc_data_source_unref(source);
+ weston_data_source_unref(source);
free(resource);
}
};
static struct wl_resource *
-data_source_create_offer(struct wlsc_data_source *source,
+data_source_create_offer(struct weston_data_source *source,
struct wl_resource *target)
{
struct wl_resource *resource;
}
static void
-data_source_cancel(struct wlsc_data_source *source)
+data_source_cancel(struct weston_data_source *source)
{
wl_resource_post_event(&source->resource, WL_DATA_SOURCE_CANCELLED);
}
static struct wl_resource *
-wlsc_data_source_send_offer(struct wlsc_data_source *source,
+weston_data_source_send_offer(struct weston_data_source *source,
struct wl_resource *target)
{
struct wl_resource *resource;
struct wl_resource *resource,
const char *type)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
char **p;
p = wl_array_add(&source->mime_types, sizeof *p);
static void
data_source_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, wlsc_compositor_get_time());
+ wl_resource_destroy(resource, weston_compositor_get_time());
}
static struct wl_data_source_interface data_source_interface = {
destroy_drag_focus(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_input_device *device =
- container_of(listener, struct wlsc_input_device,
+ struct weston_input_device *device =
+ container_of(listener, struct weston_input_device,
drag_focus_listener);
device->drag_focus_resource = NULL;
}
static void
-drag_set_focus(struct wlsc_input_device *device,
+drag_set_focus(struct weston_input_device *device,
struct wl_surface *surface, uint32_t time,
int32_t x, int32_t y)
{
resource = find_resource(&device->drag_resource_list,
surface->resource.client);
if (surface && resource) {
- offer = wlsc_data_source_send_offer(device->drag_data_source,
+ offer = weston_data_source_send_offer(device->drag_data_source,
resource);
wl_resource_post_event(resource,
drag_grab_motion(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
- struct wlsc_input_device *device =
- container_of(grab, struct wlsc_input_device, grab);
- struct wlsc_surface *es;
+ struct weston_input_device *device =
+ container_of(grab, struct weston_input_device, grab);
+ struct weston_surface *es;
es = pick_surface(&device->input_device, &x, &y);
drag_set_focus(device, &es->surface, time, x, y);
static void
drag_grab_end(struct wl_grab *grab, uint32_t time)
{
- struct wlsc_input_device *device =
- container_of(grab, struct wlsc_input_device, grab);
+ struct weston_input_device *device =
+ container_of(grab, struct weston_input_device, grab);
if (device->drag_focus_resource)
wl_resource_post_event(device->drag_focus_resource,
WL_DATA_DEVICE_DROP);
drag_set_focus(device, NULL, time, 0, 0);
- wlsc_data_source_unref(device->drag_data_source);
+ weston_data_source_unref(device->drag_data_source);
device->drag_data_source = NULL;
}
struct wl_resource *source_resource,
struct wl_resource *surface_resource, uint32_t time)
{
- struct wlsc_input_device *device = resource->data;
- struct wlsc_surface *surface = surface_resource->data;
- struct wlsc_surface *target;
+ struct weston_input_device *device = resource->data;
+ struct weston_surface *surface = surface_resource->data;
+ struct weston_surface *target;
int32_t sx, sy;
/* FIXME: Check that client has implicit grab on the surface
destroy_selection_data_source(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_input_device *device =
- container_of(listener, struct wlsc_input_device,
+ struct weston_input_device *device =
+ container_of(listener, struct weston_input_device,
selection_data_source_listener);
struct wl_resource *data_device, *focus;
}
void
-wlsc_input_device_set_selection(struct wlsc_input_device *device,
- struct wlsc_data_source *source, uint32_t time)
+weston_input_device_set_selection(struct weston_input_device *device,
+ struct weston_data_source *source, uint32_t time)
{
struct wl_resource *data_device, *focus, *offer;
* won't get destroyed until every client has been
* activated and seen the new selection event. */
wl_list_remove(&device->selection_data_source_listener.link);
- wlsc_data_source_unref(device->selection_data_source);
+ weston_data_source_unref(device->selection_data_source);
device->selection_data_source = NULL;
}
data_device = find_resource(&device->drag_resource_list,
focus->client);
if (data_device) {
- offer = wlsc_data_source_send_offer(device->selection_data_source,
+ offer = weston_data_source_send_offer(device->selection_data_source,
data_device);
wl_resource_post_event(data_device,
WL_DATA_DEVICE_SELECTION,
}
}
- wlsc_xserver_set_selection(device);
+ weston_xserver_set_selection(device);
device->selection_data_source_listener.func =
destroy_selection_data_source;
if (!source_resource)
return;
- wlsc_input_device_set_selection(resource->data,
+ weston_input_device_set_selection(resource->data,
source_resource->data, time);
}
static void
destroy_data_source(struct wl_resource *resource)
{
- struct wlsc_data_source *source =
- container_of(resource, struct wlsc_data_source, resource);
+ struct weston_data_source *source =
+ container_of(resource, struct weston_data_source, resource);
char **p, **end;
end = source->mime_types.data + source->mime_types.size;
wl_array_release(&source->mime_types);
source->resource.object.id = 0;
- wlsc_data_source_unref(source);
+ weston_data_source_unref(source);
}
static void
create_data_source(struct wl_client *client,
struct wl_resource *resource, uint32_t id)
{
- struct wlsc_data_source *source;
+ struct weston_data_source *source;
source = malloc(sizeof *source);
if (source == NULL) {
struct wl_resource *manager_resource,
uint32_t id, struct wl_resource *input_device)
{
- struct wlsc_input_device *device = input_device->data;
+ struct weston_input_device *device = input_device->data;
struct wl_resource *resource;
resource =
}
WL_EXPORT void
-wlsc_data_device_set_keyboard_focus(struct wlsc_input_device *device)
+weston_data_device_set_keyboard_focus(struct weston_input_device *device)
{
struct wl_resource *data_device, *focus, *offer;
- struct wlsc_data_source *source;
+ struct weston_data_source *source;
focus = device->input_device.keyboard_focus_resource;
if (!focus)
source = device->selection_data_source;
if (source) {
- offer = wlsc_data_source_send_offer(source, data_device);
+ offer = weston_data_source_send_offer(source, data_device);
wl_resource_post_event(data_device,
WL_DATA_DEVICE_SELECTION, offer);
}
}
WL_EXPORT int
-wlsc_data_device_manager_init(struct wlsc_compositor *compositor)
+weston_data_device_manager_init(struct weston_compositor *compositor)
{
if (wl_display_add_global(compositor->wl_display,
&wl_data_device_manager_interface,
#include "evdev.h"
struct evdev_input {
- struct wlsc_input_device base;
+ struct weston_input_device base;
struct wl_list devices_list;
struct udev_monitor *udev_monitor;
char *seat_id;
struct evdev_input *master;
struct wl_list link;
struct wl_event_source *source;
- struct wlsc_output *output;
+ struct weston_output *output;
char *devnode;
int fd;
struct {
static int
evdev_input_device_data(int fd, uint32_t mask, void *data)
{
- struct wlsc_compositor *ec;
+ struct weston_compositor *ec;
struct evdev_input_device *device = data;
struct input_event ev[8], *e, *end;
int len;
{
struct evdev_input_device *device;
struct wl_event_loop *loop;
- struct wlsc_compositor *ec;
+ struct weston_compositor *ec;
device = malloc(sizeof *device);
if (device == NULL)
ec = master->base.compositor;
device->output =
- container_of(ec->output_list.next, struct wlsc_output, link);
+ container_of(ec->output_list.next, struct weston_output, link);
device->master = master;
device->is_touchpad = 0;
static void
device_added(struct udev_device *udev_device, struct evdev_input *master)
{
- struct wlsc_compositor *c;
+ struct weston_compositor *c;
const char *devnode;
const char *device_seat;
}
void
-evdev_add_devices(struct udev *udev, struct wlsc_input_device *input_base)
+evdev_add_devices(struct udev *udev, struct weston_input_device *input_base)
{
struct evdev_input *input = (struct evdev_input *) input_base;
struct udev_enumerate *e;
evdev_config_udev_monitor(struct udev *udev, struct evdev_input *master)
{
struct wl_event_loop *loop;
- struct wlsc_compositor *c = master->base.compositor;
+ struct weston_compositor *c = master->base.compositor;
master->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
if (!master->udev_monitor)
}
void
-evdev_input_create(struct wlsc_compositor *c, struct udev *udev,
+evdev_input_create(struct weston_compositor *c, struct udev *udev,
const char *seat)
{
struct evdev_input *input;
return;
memset(input, 0, sizeof *input);
- wlsc_input_device_init(&input->base, c);
+ weston_input_device_init(&input->base, c);
wl_list_init(&input->devices_list);
input->seat_id = strdup(seat);
}
void
-evdev_remove_devices(struct wlsc_input_device *input_base)
+evdev_remove_devices(struct weston_input_device *input_base)
{
struct evdev_input *input = (struct evdev_input *) input_base;
struct evdev_input_device *device, *next;
}
void
-evdev_input_destroy(struct wlsc_input_device *input_base)
+evdev_input_destroy(struct weston_input_device *input_base)
{
struct evdev_input *input = (struct evdev_input *) input_base;
*/
void
-evdev_add_devices(struct udev *udev, struct wlsc_input_device
+evdev_add_devices(struct udev *udev, struct weston_input_device
*input_base);
void
-evdev_remove_devices(struct wlsc_input_device *input_base);
+evdev_remove_devices(struct weston_input_device *input_base);
void
-evdev_input_create(struct wlsc_compositor *c, struct udev *udev,
+evdev_input_create(struct weston_compositor *c, struct udev *udev,
const char *seat);
void
-evdev_input_destroy(struct wlsc_input_device *input_base);
+evdev_input_destroy(struct weston_input_device *input_base);
struct screenshooter {
struct wl_object base;
- struct wlsc_compositor *ec;
+ struct weston_compositor *ec;
};
static void
struct wl_resource *output_resource,
struct wl_resource *buffer_resource)
{
- struct wlsc_output *output = output_resource->data;
+ struct weston_output *output = output_resource->data;
struct wl_buffer *buffer = buffer_resource->data;
if (!wl_buffer_is_shm(buffer))
}
void
-screenshooter_create(struct wlsc_compositor *ec)
+screenshooter_create(struct weston_compositor *ec)
{
struct screenshooter *shooter;
struct shell_surface;
struct wl_shell {
- struct wlsc_compositor *compositor;
- struct wlsc_shell shell;
+ struct weston_compositor *compositor;
+ struct weston_shell shell;
struct {
- struct wlsc_process process;
+ struct weston_process process;
struct wl_client *client;
struct wl_resource *desktop_shell;
} child;
int duration;
struct wl_resource *binding;
struct wl_list surfaces;
- struct wlsc_process process;
+ struct weston_process process;
} screensaver;
};
struct shell_surface {
struct wl_resource resource;
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
struct wl_listener surface_destroy_listener;
enum shell_surface_type type;
int32_t saved_x, saved_y;
- struct wlsc_output *output;
+ struct weston_output *output;
struct wl_list link;
};
-struct wlsc_move_grab {
+struct weston_move_grab {
struct wl_grab grab;
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
int32_t dx, dy;
};
move_grab_motion(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
- struct wlsc_move_grab *move = (struct wlsc_move_grab *) grab;
- struct wlsc_surface *es = move->surface;
+ struct weston_move_grab *move = (struct weston_move_grab *) grab;
+ struct weston_surface *es = move->surface;
- wlsc_surface_configure(es, x + move->dx, y + move->dy,
+ weston_surface_configure(es, x + move->dx, y + move->dy,
es->width, es->height);
}
};
static int
-wlsc_surface_move(struct wlsc_surface *es,
- struct wlsc_input_device *wd, uint32_t time)
+weston_surface_move(struct weston_surface *es,
+ struct weston_input_device *wd, uint32_t time)
{
- struct wlsc_move_grab *move;
+ struct weston_move_grab *move;
move = malloc(sizeof *move);
if (!move)
shell_surface_move(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *input_resource, uint32_t time)
{
- struct wlsc_input_device *wd = input_resource->data;
+ struct weston_input_device *wd = input_resource->data;
struct shell_surface *shsurf = resource->data;
- if (wlsc_surface_move(shsurf->surface, wd, time) < 0)
+ if (weston_surface_move(shsurf->surface, wd, time) < 0)
wl_resource_post_no_memory(resource);
}
-struct wlsc_resize_grab {
+struct weston_resize_grab {
struct wl_grab grab;
uint32_t edges;
int32_t dx, dy, width, height;
resize_grab_motion(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
- struct wlsc_resize_grab *resize = (struct wlsc_resize_grab *) grab;
+ struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct wl_input_device *device = grab->input_device;
int32_t width, height;
};
static int
-wlsc_surface_resize(struct shell_surface *shsurf,
- struct wlsc_input_device *wd,
+weston_surface_resize(struct shell_surface *shsurf,
+ struct weston_input_device *wd,
uint32_t time, uint32_t edges)
{
- struct wlsc_resize_grab *resize;
- struct wlsc_surface *es = shsurf->surface;
+ struct weston_resize_grab *resize;
+ struct weston_surface *es = shsurf->surface;
/* FIXME: Reject if fullscreen */
struct wl_resource *input_resource, uint32_t time,
uint32_t edges)
{
- struct wlsc_input_device *wd = input_resource->data;
+ struct weston_input_device *wd = input_resource->data;
struct shell_surface *shsurf = resource->data;
/* FIXME: Reject if fullscreen */
- if (wlsc_surface_resize(shsurf, wd, time, edges) < 0)
+ if (weston_surface_resize(shsurf, wd, time, edges) < 0)
wl_resource_post_no_memory(resource);
}
if (reset_shell_surface_type(surface))
return;
- wlsc_surface_damage(surface->surface);
+ weston_surface_damage(surface->surface);
surface->type = SHELL_SURFACE_TOPLEVEL;
}
int x, int y, uint32_t flags)
{
struct shell_surface *shsurf = resource->data;
- struct wlsc_surface *es = shsurf->surface;
+ struct weston_surface *es = shsurf->surface;
struct shell_surface *pshsurf = parent_resource->data;
- struct wlsc_surface *pes = pshsurf->surface;
+ struct weston_surface *pes = pshsurf->surface;
if (reset_shell_surface_type(shsurf))
return;
es->x = pes->x + x;
es->y = pes->y + y;
- wlsc_surface_damage(es);
+ weston_surface_damage(es);
shsurf->type = SHELL_SURFACE_TRANSIENT;
}
-static struct wlsc_output *
-get_default_output(struct wlsc_compositor *compositor)
+static struct weston_output *
+get_default_output(struct weston_compositor *compositor)
{
return container_of(compositor->output_list.next,
- struct wlsc_output, link);
+ struct weston_output, link);
}
static void
{
struct shell_surface *shsurf = resource->data;
- struct wlsc_surface *es = shsurf->surface;
- struct wlsc_output *output;
+ struct weston_surface *es = shsurf->surface;
+ struct weston_output *output;
if (reset_shell_surface_type(shsurf))
return;
es->x = (output->current->width - es->width) / 2;
es->y = (output->current->height - es->height) / 2;
es->fullscreen_output = output;
- wlsc_surface_damage(es);
+ weston_surface_damage(es);
shsurf->type = SHELL_SURFACE_FULLSCREEN;
}
}
static struct shell_surface *
-get_shell_surface(struct wlsc_surface *surface)
+get_shell_surface(struct weston_surface *surface)
{
struct wl_list *lst = &surface->surface.resource.destroy_listener_list;
struct wl_listener *listener;
uint32_t id,
struct wl_resource *surface_resource)
{
- struct wlsc_surface *surface = surface_resource->data;
+ struct weston_surface *surface = surface_resource->data;
struct shell_surface *shsurf;
if (get_shell_surface(surface)) {
};
static void
-handle_screensaver_sigchld(struct wlsc_process *proc, int status)
+handle_screensaver_sigchld(struct weston_process *proc, int status)
{
proc->pid = 0;
}
if (!shell->screensaver.path)
return;
- wlsc_client_launch(shell->compositor,
+ weston_client_launch(shell->compositor,
&shell->screensaver.process,
shell->screensaver.path,
handle_screensaver_sigchld);
wl_list_remove(&surface->surface->link);
wl_list_insert(list, &surface->surface->link);
- wlsc_surface_configure(surface->surface,
+ weston_surface_configure(surface->surface,
surface->surface->x,
surface->surface->y,
surface->surface->width,
{
struct wl_shell *shell = resource->data;
struct shell_surface *shsurf = surface_resource->data;
- struct wlsc_surface *surface = shsurf->surface;
+ struct weston_surface *surface = shsurf->surface;
struct shell_surface *priv;
if (reset_shell_surface_type(shsurf))
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
- wlsc_compositor_get_time(), 0, surface_resource,
+ weston_compositor_get_time(), 0, surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
}
{
struct wl_shell *shell = resource->data;
struct shell_surface *shsurf = surface_resource->data;
- struct wlsc_surface *surface = shsurf->surface;
+ struct weston_surface *surface = shsurf->surface;
struct shell_surface *priv;
if (reset_shell_surface_type(shsurf))
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
- wlsc_compositor_get_time(), 0, surface_resource,
+ weston_compositor_get_time(), 0, surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
}
static void
resume_desktop(struct wl_shell *shell)
{
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
struct wl_list *list;
struct shell_surface *tmp;
terminate_screensaver(shell);
wl_list_for_each(surface, &shell->hidden_surface_list, link)
- wlsc_surface_configure(surface, surface->x, surface->y,
+ weston_surface_configure(surface, surface->x, surface->y,
surface->width, surface->height);
if (wl_list_empty(&shell->backgrounds)) {
wl_list_init(&shell->hidden_surface_list);
shell->locked = false;
- wlsc_compositor_repick(shell->compositor);
+ weston_compositor_repick(shell->compositor);
shell->compositor->idle_time = shell->compositor->option_idle_time;
- wlsc_compositor_wake(shell->compositor);
+ weston_compositor_wake(shell->compositor);
}
static void
};
static enum shell_surface_type
-get_shell_surface_type(struct wlsc_surface *surface)
+get_shell_surface_type(struct weston_surface *surface)
{
struct shell_surface *shsurf;
move_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data)
{
- struct wlsc_surface *surface =
- (struct wlsc_surface *) device->pointer_focus;
+ struct weston_surface *surface =
+ (struct weston_surface *) device->pointer_focus;
if (surface == NULL)
return;
break;
}
- wlsc_surface_move(surface, (struct wlsc_input_device *) device, time);
+ weston_surface_move(surface, (struct weston_input_device *) device, time);
}
static void
resize_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data)
{
- struct wlsc_surface *surface =
- (struct wlsc_surface *) device->pointer_focus;
+ struct weston_surface *surface =
+ (struct weston_surface *) device->pointer_focus;
uint32_t edges = 0;
int32_t x, y;
struct shell_surface *shsurf;
else
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
- wlsc_surface_resize(shsurf, (struct wlsc_input_device *) device,
+ weston_surface_resize(shsurf, (struct weston_input_device *) device,
time, edges);
}
terminate_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data)
{
- struct wlsc_compositor *compositor = data;
+ struct weston_compositor *compositor = data;
if (state)
wl_display_terminate(compositor->wl_display);
}
static void
-activate(struct wlsc_shell *base, struct wlsc_surface *es,
- struct wlsc_input_device *device, uint32_t time)
+activate(struct weston_shell *base, struct weston_surface *es,
+ struct weston_input_device *device, uint32_t time)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
- struct wlsc_compositor *compositor = shell->compositor;
+ struct weston_compositor *compositor = shell->compositor;
- wlsc_surface_activate(es, device, time);
+ weston_surface_activate(es, device, time);
if (compositor->wxs)
- wlsc_xserver_surface_activate(es);
+ weston_xserver_surface_activate(es);
switch (get_shell_surface_type(es)) {
case SHELL_SURFACE_BACKGROUND:
uint32_t time, uint32_t key,
uint32_t button, uint32_t state, void *data)
{
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
- struct wlsc_compositor *compositor = data;
- struct wlsc_surface *focus;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
+ struct weston_compositor *compositor = data;
+ struct weston_surface *focus;
- focus = (struct wlsc_surface *) device->pointer_focus;
+ focus = (struct weston_surface *) device->pointer_focus;
if (state && focus && device->grab == NULL)
activate(compositor->shell, focus, wd, time);
}
static void
-lock(struct wlsc_shell *base)
+lock(struct weston_shell *base)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
struct wl_list *surface_list = &shell->compositor->surface_list;
- struct wlsc_surface *cur;
- struct wlsc_surface *tmp;
- struct wlsc_input_device *device;
+ struct weston_surface *cur;
+ struct weston_surface *tmp;
+ struct weston_input_device *device;
struct shell_surface *shsurf;
uint32_t time;
if (!wl_list_empty(&shell->screensaver.surfaces)) {
shell->compositor->idle_time = shell->screensaver.duration;
- wlsc_compositor_wake(shell->compositor);
- shell->compositor->state = WLSC_COMPOSITOR_IDLE;
+ weston_compositor_wake(shell->compositor);
+ shell->compositor->state = WESTON_COMPOSITOR_IDLE;
}
/* reset pointer foci */
- wlsc_compositor_repick(shell->compositor);
+ weston_compositor_repick(shell->compositor);
/* reset keyboard foci */
- time = wlsc_compositor_get_time();
+ time = weston_compositor_get_time();
wl_list_for_each(device, &shell->compositor->input_device_list, link) {
wl_input_device_set_keyboard_focus(&device->input_device,
NULL, time);
}
static void
-unlock(struct wlsc_shell *base)
+unlock(struct weston_shell *base)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
if (!shell->locked || shell->lock_surface) {
- wlsc_compositor_wake(shell->compositor);
+ weston_compositor_wake(shell->compositor);
return;
}
}
static void
-center_on_output(struct wlsc_surface *surface, struct wlsc_output *output)
+center_on_output(struct weston_surface *surface, struct weston_output *output)
{
- struct wlsc_mode *mode = output->current;
+ struct weston_mode *mode = output->current;
surface->x = output->x + (mode->width - surface->width) / 2;
surface->y = output->y + (mode->height - surface->height) / 2;
}
static void
-map(struct wlsc_shell *base,
- struct wlsc_surface *surface, int32_t width, int32_t height)
+map(struct weston_shell *base,
+ struct weston_surface *surface, int32_t width, int32_t height)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
- struct wlsc_compositor *compositor = shell->compositor;
+ struct weston_compositor *compositor = shell->compositor;
struct wl_list *list;
struct shell_surface *shsurf;
enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
/* lock surface always visible, on top */
wl_list_insert(&compositor->surface_list, &surface->link);
- wlsc_compositor_repick(compositor);
- wlsc_compositor_wake(compositor);
+ weston_compositor_repick(compositor);
+ weston_compositor_wake(compositor);
do_configure = 1;
break;
case SHELL_SURFACE_SCREENSAVER:
if (shell->locked) {
show_screensaver(shell, shsurf);
compositor->idle_time = shell->screensaver.duration;
- wlsc_compositor_wake(compositor);
+ weston_compositor_wake(compositor);
if (!shell->lock_surface)
- compositor->state = WLSC_COMPOSITOR_IDLE;
+ compositor->state = WESTON_COMPOSITOR_IDLE;
}
do_configure = 0;
break;
}
if (do_configure)
- wlsc_surface_configure(surface,
+ weston_surface_configure(surface,
surface->x, surface->y, width, height);
switch (surface_type) {
case SHELL_SURFACE_FULLSCREEN:
if (!shell->locked)
activate(base, surface,
- (struct wlsc_input_device *)
+ (struct weston_input_device *)
compositor->input_device,
- wlsc_compositor_get_time());
+ weston_compositor_get_time());
break;
default:
break;
}
if (surface_type == SHELL_SURFACE_TOPLEVEL)
- wlsc_zoom_run(surface, 0.8, 1.0, NULL, NULL);
+ weston_zoom_run(surface, 0.8, 1.0, NULL, NULL);
}
static void
-configure(struct wlsc_shell *base, struct wlsc_surface *surface,
+configure(struct weston_shell *base, struct weston_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
}
/*
- * wlsc_surface_configure() will assign an output, which means
+ * weston_surface_configure() will assign an output, which means
* the surface is supposed to be in compositor->surface_list.
* Be careful with that, and make sure we stay on the right output.
* XXX: would a fullscreen surface need the same handling?
*/
if (do_configure) {
- wlsc_surface_configure(surface, x, y, width, height);
+ weston_surface_configure(surface, x, y, width, height);
if (surface_type == SHELL_SURFACE_SCREENSAVER)
surface->output = shsurf->output;
}
static void
-desktop_shell_sigchld(struct wlsc_process *process, int status)
+desktop_shell_sigchld(struct weston_process *process, int status)
{
struct wl_shell *shell =
container_of(process, struct wl_shell, child.process);
{
const char *shell_exe = LIBEXECDIR "/wayland-desktop-shell";
- shell->child.client = wlsc_client_launch(shell->compositor,
+ shell->child.client = weston_client_launch(shell->compositor,
&shell->child.process,
shell_exe,
desktop_shell_sigchld);
{
struct wl_shell *shell = resource->data;
struct shell_surface *surface = shell_surface_resource->data;
- struct wlsc_output *output = output_resource->data;
+ struct weston_output *output = output_resource->data;
if (reset_shell_surface_type(surface))
return;
}
int
-shell_init(struct wlsc_compositor *ec);
+shell_init(struct weston_compositor *ec);
WL_EXPORT int
-shell_init(struct wlsc_compositor *ec)
+shell_init(struct weston_compositor *ec)
{
struct wl_shell *shell;
if (launch_desktop_shell_process(shell) != 0)
return -1;
- wlsc_compositor_add_binding(ec, 0, BTN_LEFT, MODIFIER_SUPER,
+ weston_compositor_add_binding(ec, 0, BTN_LEFT, MODIFIER_SUPER,
move_binding, shell);
- wlsc_compositor_add_binding(ec, 0, BTN_MIDDLE, MODIFIER_SUPER,
+ weston_compositor_add_binding(ec, 0, BTN_MIDDLE, MODIFIER_SUPER,
resize_binding, shell);
- wlsc_compositor_add_binding(ec, KEY_BACKSPACE, 0,
+ weston_compositor_add_binding(ec, KEY_BACKSPACE, 0,
MODIFIER_CTRL | MODIFIER_ALT,
terminate_binding, ec);
- wlsc_compositor_add_binding(ec, 0, BTN_LEFT, 0,
+ weston_compositor_add_binding(ec, 0, BTN_LEFT, 0,
click_to_activate_binding, ec);
#include "compositor.h"
-struct wlsc_switcher {
- struct wlsc_compositor *compositor;
- struct wlsc_surface *current;
+struct weston_switcher {
+ struct weston_compositor *compositor;
+ struct weston_surface *current;
struct wl_listener listener;
};
static void
-wlsc_switcher_next(struct wlsc_switcher *switcher)
+weston_switcher_next(struct weston_switcher *switcher)
{
struct wl_list *l;
struct wl_surface *current;
- wlsc_surface_damage(switcher->current);
+ weston_surface_damage(switcher->current);
l = switcher->current->link.next;
if (l == &switcher->compositor->surface_list)
l = switcher->compositor->surface_list.next;
- switcher->current = container_of(l, struct wlsc_surface, link);
+ switcher->current = container_of(l, struct weston_surface, link);
wl_list_remove(&switcher->listener.link);
current = &switcher->current->surface;
wl_list_insert(current->resource.destroy_listener_list.prev,
&switcher->listener.link);
switcher->compositor->overlay = switcher->current;
- wlsc_surface_damage(switcher->current);
+ weston_surface_damage(switcher->current);
}
static void
switcher_handle_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_switcher *switcher =
- container_of(listener, struct wlsc_switcher, listener);
+ struct weston_switcher *switcher =
+ container_of(listener, struct weston_switcher, listener);
- wlsc_switcher_next(switcher);
+ weston_switcher_next(switcher);
}
-static struct wlsc_switcher *
-wlsc_switcher_create(struct wlsc_compositor *compositor)
+static struct weston_switcher *
+weston_switcher_create(struct weston_compositor *compositor)
{
- struct wlsc_switcher *switcher;
+ struct weston_switcher *switcher;
switcher = malloc(sizeof *switcher);
switcher->compositor = compositor;
switcher->current = container_of(compositor->surface_list.next,
- struct wlsc_surface, link);
+ struct weston_surface, link);
switcher->listener.func = switcher_handle_surface_destroy;
wl_list_init(&switcher->listener.link);
}
static void
-wlsc_switcher_destroy(struct wlsc_switcher *switcher)
+weston_switcher_destroy(struct weston_switcher *switcher)
{
wl_list_remove(&switcher->listener.link);
free(switcher);
uint32_t key, uint32_t button,
uint32_t state, void *data)
{
- struct wlsc_compositor *compositor = data;
+ struct weston_compositor *compositor = data;
if (!state)
return;
if (wl_list_empty(&compositor->surface_list))
return;
if (compositor->switcher == NULL)
- compositor->switcher = wlsc_switcher_create(compositor);
+ compositor->switcher = weston_switcher_create(compositor);
- wlsc_switcher_next(compositor->switcher);
+ weston_switcher_next(compositor->switcher);
}
static void
uint32_t time, uint32_t key, uint32_t button,
uint32_t state, void *data)
{
- struct wlsc_compositor *compositor = data;
- struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
+ struct weston_compositor *compositor = data;
+ struct weston_input_device *wd = (struct weston_input_device *) device;
if (compositor->switcher && !state) {
- wlsc_surface_activate(compositor->switcher->current, wd, time);
- wlsc_switcher_destroy(compositor->switcher);
+ weston_surface_activate(compositor->switcher->current, wd, time);
+ weston_switcher_destroy(compositor->switcher);
compositor->switcher = NULL;
compositor->overlay = NULL;
}
}
void
-wlsc_switcher_init(struct wlsc_compositor *compositor)
+weston_switcher_init(struct weston_compositor *compositor)
{
- wlsc_compositor_add_binding(compositor,
+ weston_compositor_add_binding(compositor,
KEY_TAB, 0, MODIFIER_SUPER,
switcher_next_binding, compositor);
- wlsc_compositor_add_binding(compositor,
+ weston_compositor_add_binding(compositor,
KEY_LEFTMETA, 0, MODIFIER_SUPER,
switcher_terminate_binding, compositor);
- wlsc_compositor_add_binding(compositor,
+ weston_compositor_add_binding(compositor,
KEY_RIGHTMETA, 0, MODIFIER_SUPER,
switcher_terminate_binding, compositor);
}
struct tablet_shell {
struct wl_resource resource;
- struct wlsc_shell shell;
+ struct weston_shell shell;
- struct wlsc_compositor *compositor;
- struct wlsc_process process;
- struct wlsc_input_device *device;
+ struct weston_compositor *compositor;
+ struct weston_process process;
+ struct weston_input_device *device;
struct wl_client *client;
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
- struct wlsc_surface *lockscreen_surface;
+ struct weston_surface *lockscreen_surface;
struct wl_listener lockscreen_listener;
- struct wlsc_surface *home_surface;
+ struct weston_surface *home_surface;
- struct wlsc_surface *switcher_surface;
+ struct weston_surface *switcher_surface;
struct wl_listener switcher_listener;
struct tablet_client *current_client;
struct wl_resource resource;
struct tablet_shell *shell;
struct wl_client *client;
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
char *name;
};
static void
-tablet_shell_sigchld(struct wlsc_process *process, int status)
+tablet_shell_sigchld(struct weston_process *process, int status)
{
struct tablet_shell *shell =
container_of(process, struct tablet_shell, process);
}
static void
-tablet_shell_map(struct wlsc_shell *base, struct wlsc_surface *surface,
+tablet_shell_map(struct weston_shell *base, struct weston_surface *surface,
int32_t width, int32_t height)
{
struct tablet_shell *shell =
shell->current_client->client == surface->surface.resource.client) {
tablet_shell_set_state(shell, STATE_TASK);
shell->current_client->surface = surface;
- wlsc_zoom_run(surface, 0.3, 1.0, NULL, NULL);
+ weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
}
wl_list_insert(&shell->compositor->surface_list, &surface->link);
- wlsc_surface_configure(surface, surface->x, surface->y, width, height);
+ weston_surface_configure(surface, surface->x, surface->y, width, height);
}
static void
-tablet_shell_configure(struct wlsc_shell *base,
- struct wlsc_surface *surface,
+tablet_shell_configure(struct weston_shell *base,
+ struct weston_surface *surface,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
- wlsc_surface_configure(surface, x, y, width, height);
+ weston_surface_configure(surface, x, y, width, height);
}
static void
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
- struct wlsc_surface *es = surface_resource->data;
+ struct weston_surface *es = surface_resource->data;
es->x = 0;
es->y = 0;
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
- struct wlsc_surface *es = surface_resource->data;
+ struct weston_surface *es = surface_resource->data;
/* FIXME: Switcher should be centered and the compositor
* should do the tinting of the background. With the cache
}
static void
-minimize_zoom_done(struct wlsc_zoom *zoom, void *data)
+minimize_zoom_done(struct weston_zoom *zoom, void *data)
{
struct tablet_shell *shell = data;
- struct wlsc_compositor *compositor = shell->compositor;
- struct wlsc_input_device *device =
- (struct wlsc_input_device *) compositor->input_device;
+ struct weston_compositor *compositor = shell->compositor;
+ struct weston_input_device *device =
+ (struct weston_input_device *) compositor->input_device;
- wlsc_surface_activate(shell->home_surface,
- device, wlsc_compositor_get_time());
+ weston_surface_activate(shell->home_surface,
+ device, weston_compositor_get_time());
}
static void
tablet_shell_switch_to(struct tablet_shell *shell,
- struct wlsc_surface *surface)
+ struct weston_surface *surface)
{
- struct wlsc_compositor *compositor = shell->compositor;
- struct wlsc_input_device *device =
- (struct wlsc_input_device *) compositor->input_device;
- struct wlsc_surface *current;
+ struct weston_compositor *compositor = shell->compositor;
+ struct weston_input_device *device =
+ (struct weston_input_device *) compositor->input_device;
+ struct weston_surface *current;
if (shell->state == STATE_SWITCHER) {
wl_list_remove(&shell->switcher_listener.link);
if (shell->current_client && shell->current_client->surface) {
current = shell->current_client->surface;
- wlsc_zoom_run(current, 1.0, 0.3,
+ weston_zoom_run(current, 1.0, 0.3,
minimize_zoom_done, shell);
}
} else {
fprintf(stderr, "switch to %p\n", surface);
- wlsc_surface_activate(surface, device,
- wlsc_compositor_get_time());
+ weston_surface_activate(surface, device,
+ weston_compositor_get_time());
tablet_shell_set_state(shell, STATE_TASK);
- wlsc_zoom_run(surface, 0.3, 1.0, NULL, NULL);
+ weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
}
}
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
- struct wlsc_surface *es = surface_resource->data;
+ struct weston_surface *es = surface_resource->data;
tablet_shell_switch_to(shell, es);
}
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
- struct wlsc_surface *es = surface_resource->data;
+ struct weston_surface *es = surface_resource->data;
tablet_shell_switch_to(shell, es);
}
tablet_client_destroy(struct wl_client *client,
struct wl_resource *resource)
{
- wl_resource_destroy(resource, wlsc_compositor_get_time());
+ wl_resource_destroy(resource, weston_compositor_get_time());
}
static void
uint32_t id, const char *name, int fd)
{
struct tablet_shell *shell = resource->data;
- struct wlsc_compositor *compositor = shell->compositor;
+ struct weston_compositor *compositor = shell->compositor;
struct tablet_client *tablet_client;
tablet_client = malloc(sizeof *tablet_client);
{
const char *shell_exe = LIBEXECDIR "/wayland-tablet-shell";
- shell->client = wlsc_client_launch(shell->compositor,
+ shell->client = weston_client_launch(shell->compositor,
&shell->process,
shell_exe, tablet_shell_sigchld);
}
}
static void
-tablet_shell_lock(struct wlsc_shell *base)
+tablet_shell_lock(struct weston_shell *base)
{
struct tablet_shell *shell =
container_of(base, struct tablet_shell, shell);
}
static void
-tablet_shell_unlock(struct wlsc_shell *base)
+tablet_shell_unlock(struct weston_shell *base)
{
struct tablet_shell *shell =
container_of(base, struct tablet_shell, shell);
- wlsc_compositor_wake(shell->compositor);
+ weston_compositor_wake(shell->compositor);
}
static void
go_home(struct tablet_shell *shell)
{
- struct wlsc_input_device *device =
- (struct wlsc_input_device *) shell->compositor->input_device;
+ struct weston_input_device *device =
+ (struct weston_input_device *) shell->compositor->input_device;
if (shell->state == STATE_SWITCHER)
wl_resource_post_event(&shell->resource,
TABLET_SHELL_HIDE_SWITCHER);
- wlsc_surface_activate(shell->home_surface, device,
- wlsc_compositor_get_time());
+ weston_surface_activate(shell->home_surface, device,
+ weston_compositor_get_time());
tablet_shell_set_state(shell, STATE_HOME);
}
if (shell->state == STATE_LOCKED)
return;
- shell->device = (struct wlsc_input_device *) device;
+ shell->device = (struct weston_input_device *) device;
if (state) {
wl_event_source_timer_update(shell->long_press_source, 500);
}
void
-shell_init(struct wlsc_compositor *compositor);
+shell_init(struct weston_compositor *compositor);
WL_EXPORT void
-shell_init(struct wlsc_compositor *compositor)
+shell_init(struct weston_compositor *compositor)
{
struct tablet_shell *shell;
struct wl_event_loop *loop;
shell->long_press_source =
wl_event_loop_add_timer(loop, long_press_handler, shell);
- wlsc_compositor_add_binding(compositor, KEY_LEFTMETA, 0, 0,
+ weston_compositor_add_binding(compositor, KEY_LEFTMETA, 0, 0,
home_key_binding, shell);
- wlsc_compositor_add_binding(compositor, KEY_RIGHTMETA, 0, 0,
+ weston_compositor_add_binding(compositor, KEY_RIGHTMETA, 0, 0,
home_key_binding, shell);
- wlsc_compositor_add_binding(compositor, KEY_LEFTMETA, 0,
+ weston_compositor_add_binding(compositor, KEY_LEFTMETA, 0,
MODIFIER_SUPER, home_key_binding, shell);
- wlsc_compositor_add_binding(compositor, KEY_RIGHTMETA, 0,
+ weston_compositor_add_binding(compositor, KEY_RIGHTMETA, 0,
MODIFIER_SUPER, home_key_binding, shell);
- wlsc_compositor_add_binding(compositor, KEY_COMPOSE, 0, 0,
+ weston_compositor_add_binding(compositor, KEY_COMPOSE, 0, 0,
menu_key_binding, shell);
compositor->shell = &shell->shell;
#include "compositor.h"
struct tty {
- struct wlsc_compositor *compositor;
+ struct weston_compositor *compositor;
int fd;
struct termios terminal_attributes;
}
struct tty *
-tty_create(struct wlsc_compositor *compositor, tty_vt_func_t vt_func,
+tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
int tty_nr)
{
struct termios raw_attributes;
#include "compositor.h"
WL_EXPORT void
-wlsc_matrix_init(struct wlsc_matrix *matrix)
+weston_matrix_init(struct weston_matrix *matrix)
{
- static const struct wlsc_matrix identity = {
+ static const struct weston_matrix identity = {
{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }
};
}
static void
-wlsc_matrix_multiply(struct wlsc_matrix *m, const struct wlsc_matrix *n)
+weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n)
{
- struct wlsc_matrix tmp;
+ struct weston_matrix tmp;
const GLfloat *row, *column;
div_t d;
int i, j;
}
WL_EXPORT void
-wlsc_matrix_translate(struct wlsc_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
+weston_matrix_translate(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
{
- struct wlsc_matrix translate = {
+ struct weston_matrix translate = {
{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 }
};
- wlsc_matrix_multiply(matrix, &translate);
+ weston_matrix_multiply(matrix, &translate);
}
WL_EXPORT void
-wlsc_matrix_scale(struct wlsc_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
+weston_matrix_scale(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
{
- struct wlsc_matrix scale = {
+ struct weston_matrix scale = {
{ x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1 }
};
- wlsc_matrix_multiply(matrix, &scale);
+ weston_matrix_multiply(matrix, &scale);
}
WL_EXPORT void
-wlsc_matrix_transform(struct wlsc_matrix *matrix, struct wlsc_vector *v)
+weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v)
{
int i, j;
- struct wlsc_vector t;
+ struct weston_vector t;
for (i = 0; i < 4; i++) {
t.f[i] = 0;
}
WL_EXPORT void
-wlsc_spring_init(struct wlsc_spring *spring,
+weston_spring_init(struct weston_spring *spring,
double k, double current, double target)
{
spring->k = k;
}
WL_EXPORT void
-wlsc_spring_update(struct wlsc_spring *spring, uint32_t msec)
+weston_spring_update(struct weston_spring *spring, uint32_t msec)
{
double force, v, current, step;
}
WL_EXPORT int
-wlsc_spring_done(struct wlsc_spring *spring)
+weston_spring_done(struct weston_spring *spring)
{
return fabs(spring->previous - spring->target) < 0.0002 &&
fabs(spring->current - spring->target) < 0.0002;
}
-struct wlsc_zoom {
- struct wlsc_surface *surface;
- struct wlsc_animation animation;
- struct wlsc_spring spring;
- struct wlsc_transform transform;
+struct weston_zoom {
+ struct weston_surface *surface;
+ struct weston_animation animation;
+ struct weston_spring spring;
+ struct weston_transform transform;
struct wl_listener listener;
GLfloat start, stop;
- void (*done)(struct wlsc_zoom *zoom, void *data);
+ void (*done)(struct weston_zoom *zoom, void *data);
void *data;
};
static void
-wlsc_zoom_destroy(struct wlsc_zoom *zoom)
+weston_zoom_destroy(struct weston_zoom *zoom)
{
wl_list_remove(&zoom->animation.link);
wl_list_remove(&zoom->listener.link);
handle_zoom_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_zoom *zoom =
- container_of(listener, struct wlsc_zoom, listener);
+ struct weston_zoom *zoom =
+ container_of(listener, struct weston_zoom, listener);
- wlsc_zoom_destroy(zoom);
+ weston_zoom_destroy(zoom);
}
static void
-wlsc_zoom_frame(struct wlsc_animation *animation,
- struct wlsc_output *output, uint32_t msecs)
+weston_zoom_frame(struct weston_animation *animation,
+ struct weston_output *output, uint32_t msecs)
{
- struct wlsc_zoom *zoom =
- container_of(animation, struct wlsc_zoom, animation);
- struct wlsc_surface *es = zoom->surface;
+ struct weston_zoom *zoom =
+ container_of(animation, struct weston_zoom, animation);
+ struct weston_surface *es = zoom->surface;
GLfloat scale;
- wlsc_spring_update(&zoom->spring, msecs);
+ weston_spring_update(&zoom->spring, msecs);
- if (wlsc_spring_done(&zoom->spring))
- wlsc_zoom_destroy(zoom);
+ if (weston_spring_done(&zoom->spring))
+ weston_zoom_destroy(zoom);
scale = zoom->start +
(zoom->stop - zoom->start) * zoom->spring.current;
- wlsc_matrix_init(&zoom->transform.matrix);
- wlsc_matrix_translate(&zoom->transform.matrix,
+ weston_matrix_init(&zoom->transform.matrix);
+ weston_matrix_translate(&zoom->transform.matrix,
-(es->x + es->width / 2.0),
-(es->y + es->height / 2.0), 0);
- wlsc_matrix_scale(&zoom->transform.matrix, scale, scale, scale);
- wlsc_matrix_translate(&zoom->transform.matrix,
+ weston_matrix_scale(&zoom->transform.matrix, scale, scale, scale);
+ weston_matrix_translate(&zoom->transform.matrix,
es->x + es->width / 2.0,
es->y + es->height / 2.0, 0);
if (es->alpha > 255)
es->alpha = 255;
scale = 1.0 / zoom->spring.current;
- wlsc_matrix_init(&zoom->transform.inverse);
- wlsc_matrix_scale(&zoom->transform.inverse, scale, scale, scale);
+ weston_matrix_init(&zoom->transform.inverse);
+ weston_matrix_scale(&zoom->transform.inverse, scale, scale, scale);
- wlsc_compositor_damage_all(es->compositor);
+ weston_compositor_damage_all(es->compositor);
}
-WL_EXPORT struct wlsc_zoom *
-wlsc_zoom_run(struct wlsc_surface *surface, GLfloat start, GLfloat stop,
- wlsc_zoom_done_func_t done, void *data)
+WL_EXPORT struct weston_zoom *
+weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
+ weston_zoom_done_func_t done, void *data)
{
- struct wlsc_zoom *zoom;
+ struct weston_zoom *zoom;
zoom = malloc(sizeof *zoom);
if (!zoom)
zoom->start = start;
zoom->stop = stop;
surface->transform = &zoom->transform;
- wlsc_spring_init(&zoom->spring, 200.0, 0.0, 1.0);
+ weston_spring_init(&zoom->spring, 200.0, 0.0, 1.0);
zoom->spring.friction = 700;
- zoom->spring.timestamp = wlsc_compositor_get_time();
- zoom->animation.frame = wlsc_zoom_frame;
- wlsc_zoom_frame(&zoom->animation, NULL, zoom->spring.timestamp);
+ zoom->spring.timestamp = weston_compositor_get_time();
+ zoom->animation.frame = weston_zoom_frame;
+ weston_zoom_frame(&zoom->animation, NULL, zoom->spring.timestamp);
zoom->listener.func = handle_zoom_surface_destroy;
wl_list_insert(surface->surface.resource.destroy_listener_list.prev,
return zoom;
}
-struct wlsc_binding {
+struct weston_binding {
uint32_t key;
uint32_t button;
uint32_t modifier;
- wlsc_binding_handler_t handler;
+ weston_binding_handler_t handler;
void *data;
struct wl_list link;
};
-WL_EXPORT struct wlsc_binding *
-wlsc_compositor_add_binding(struct wlsc_compositor *compositor,
+WL_EXPORT struct weston_binding *
+weston_compositor_add_binding(struct weston_compositor *compositor,
uint32_t key, uint32_t button, uint32_t modifier,
- wlsc_binding_handler_t handler, void *data)
+ weston_binding_handler_t handler, void *data)
{
- struct wlsc_binding *binding;
+ struct weston_binding *binding;
binding = malloc(sizeof *binding);
if (binding == NULL)
}
WL_EXPORT void
-wlsc_binding_destroy(struct wlsc_binding *binding)
+weston_binding_destroy(struct weston_binding *binding)
{
wl_list_remove(&binding->link);
free(binding);
}
WL_EXPORT void
-wlsc_compositor_run_binding(struct wlsc_compositor *compositor,
- struct wlsc_input_device *device,
+weston_compositor_run_binding(struct weston_compositor *compositor,
+ struct weston_input_device *device,
uint32_t time,
uint32_t key, uint32_t button, int32_t state)
{
- struct wlsc_binding *b;
+ struct weston_binding *b;
wl_list_for_each(b, &compositor->binding_list, link) {
if (b->key == key && b->button == button &&
struct wl_resource resource;
};
-struct wlsc_xserver {
+struct weston_xserver {
struct wl_display *wl_display;
struct wl_event_loop *loop;
struct wl_event_source *sigchld_source;
int unix_fd;
struct wl_event_source *unix_source;
int display;
- struct wlsc_process process;
+ struct weston_process process;
struct wl_resource *resource;
struct wl_client *client;
- struct wlsc_compositor *compositor;
- struct wlsc_wm *wm;
+ struct weston_compositor *compositor;
+ struct weston_wm *wm;
};
-struct wlsc_wm {
+struct weston_wm {
xcb_connection_t *conn;
const xcb_query_extension_reply_t *xfixes;
struct wl_event_source *source;
xcb_screen_t *screen;
struct hash_table *window_hash;
- struct wlsc_xserver *server;
+ struct weston_xserver *server;
xcb_window_t selection_window;
int incr;
} atom;
};
-struct wlsc_wm_window {
+struct weston_wm_window {
xcb_window_t id;
- struct wlsc_surface *surface;
+ struct weston_surface *surface;
struct wl_listener surface_destroy_listener;
char *class;
char *name;
- struct wlsc_wm_window *transient_for;
+ struct weston_wm_window *transient_for;
uint32_t protocols;
xcb_atom_t type;
};
-static struct wlsc_wm_window *
-get_wm_window(struct wlsc_surface *surface);
+static struct weston_wm_window *
+get_wm_window(struct weston_surface *surface);
static const char *
get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
}
static void
-dump_property(struct wlsc_wm *wm, xcb_atom_t property,
+dump_property(struct weston_wm *wm, xcb_atom_t property,
xcb_get_property_reply_t *reply)
{
int32_t *incr_value;
}
static void
-dump_window_properties(struct wlsc_wm *wm, xcb_window_t window)
+dump_window_properties(struct weston_wm *wm, xcb_window_t window)
{
xcb_list_properties_cookie_t list_cookie;
xcb_list_properties_reply_t *list_reply;
data_offer_accept(struct wl_client *client, struct wl_resource *resource,
uint32_t time, const char *mime_type)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
wl_resource_post_event(&source->resource,
WL_DATA_SOURCE_TARGET, mime_type);
data_offer_receive(struct wl_client *client, struct wl_resource *resource,
const char *mime_type, int32_t fd)
{
- struct wlsc_data_source *source = resource->data;
- struct wlsc_wm *wm = source->data;
+ struct weston_data_source *source = resource->data;
+ struct weston_wm *wm = source->data;
if (strcmp(mime_type, "text/plain;charset=utf-8") == 0) {
/* Get data for the utf8_string target */
static void
data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, wlsc_compositor_get_time());
+ wl_resource_destroy(resource, weston_compositor_get_time());
}
static void
destroy_data_offer(struct wl_resource *resource)
{
- struct wlsc_data_source *source = resource->data;
+ struct weston_data_source *source = resource->data;
- wlsc_data_source_unref(source);
+ weston_data_source_unref(source);
free(resource);
}
};
static struct wl_resource *
-data_source_create_offer(struct wlsc_data_source *source,
+data_source_create_offer(struct weston_data_source *source,
struct wl_resource *target)
{
struct wl_resource *resource;
}
static void
-data_source_cancel(struct wlsc_data_source *source)
+data_source_cancel(struct weston_data_source *source)
{
}
static void
-wlsc_wm_get_selection_targets(struct wlsc_wm *wm)
+weston_wm_get_selection_targets(struct weston_wm *wm)
{
- struct wlsc_data_source *source;
- struct wlsc_input_device *device;
+ struct weston_data_source *source;
+ struct weston_input_device *device;
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
xcb_atom_t *value;
}
}
- device = (struct wlsc_input_device *)
+ device = (struct weston_input_device *)
wm->server->compositor->input_device;
- wlsc_input_device_set_selection(device, source,
- wlsc_compositor_get_time());
+ weston_input_device_set_selection(device, source,
+ weston_compositor_get_time());
- wlsc_data_source_unref(source);
+ weston_data_source_unref(source);
free(reply);
}
static int
-wlsc_wm_write_property(int fd, uint32_t mask, void *data)
+weston_wm_write_property(int fd, uint32_t mask, void *data)
{
- struct wlsc_wm *wm = data;
+ struct weston_wm *wm = data;
unsigned char *property;
int len, remainder;
}
static void
-wlsc_wm_get_selection_data(struct wlsc_wm *wm)
+weston_wm_get_selection_data(struct weston_wm *wm)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
wl_event_loop_add_fd(wm->server->loop,
wm->data_source_fd,
WL_EVENT_WRITABLE,
- wlsc_wm_write_property,
+ weston_wm_write_property,
wm);
wm->property_reply = reply;
}
}
static void
-wlsc_wm_get_incr_chunk(struct wlsc_wm *wm)
+weston_wm_get_incr_chunk(struct weston_wm *wm)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
wl_event_loop_add_fd(wm->server->loop,
wm->data_source_fd,
WL_EVENT_WRITABLE,
- wlsc_wm_write_property,
+ weston_wm_write_property,
wm);
wm->property_reply = reply;
} else {
}
void
-wlsc_xserver_set_selection(struct wlsc_input_device *device)
+weston_xserver_set_selection(struct weston_input_device *device)
{
- struct wlsc_xserver *wxs = device->compositor->wxs;
- struct wlsc_wm *wm = wxs->wm;
- struct wlsc_data_source *source;
+ struct weston_xserver *wxs = device->compositor->wxs;
+ struct weston_wm *wm = wxs->wm;
+ struct weston_data_source *source;
const char **p, **end;
int has_text_plain = 0;
}
static void
-wlsc_wm_handle_configure_request(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_configure_request_event_t *configure_request =
(xcb_configure_request_event_t *) event;
}
static void
-wlsc_wm_handle_configure_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_configure_notify_event_t *configure_notify =
(xcb_configure_notify_event_t *) event;
}
static void
-wlsc_wm_activate(struct wlsc_wm *wm,
- struct wlsc_wm_window *window, xcb_timestamp_t time)
+weston_wm_activate(struct weston_wm *wm,
+ struct weston_wm_window *window, xcb_timestamp_t time)
{
xcb_client_message_event_t client_message;
}
WL_EXPORT void
-wlsc_xserver_surface_activate(struct wlsc_surface *surface)
+weston_xserver_surface_activate(struct weston_surface *surface)
{
- struct wlsc_wm_window *window = get_wm_window(surface);
- struct wlsc_xserver *wxs = surface->compositor->wxs;
+ struct weston_wm_window *window = get_wm_window(surface);
+ struct weston_xserver *wxs = surface->compositor->wxs;
if (window)
- wlsc_wm_activate(wxs->wm, window, XCB_TIME_CURRENT_TIME);
+ weston_wm_activate(wxs->wm, window, XCB_TIME_CURRENT_TIME);
else if (wxs && wxs->wm)
xcb_set_input_focus (wxs->wm->conn,
XCB_INPUT_FOCUS_POINTER_ROOT,
}
static void
-wlsc_wm_handle_map_request(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_map_request_event_t *map_request =
(xcb_map_request_event_t *) event;
#define TYPE_WM_PROTOCOLS XCB_ATOM_CUT_BUFFER0
static void
-wlsc_wm_handle_map_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_map_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
-#define F(field) offsetof(struct wlsc_wm_window, field)
+#define F(field) offsetof(struct weston_wm_window, field)
const struct {
xcb_atom_t atom;
xcb_map_notify_event_t *map_notify = (xcb_map_notify_event_t *) event;
xcb_get_property_cookie_t cookie[ARRAY_LENGTH(props)];
xcb_get_property_reply_t *reply;
- struct wlsc_wm_window *window;
+ struct weston_wm_window *window;
void *p;
uint32_t *xid;
xcb_atom_t *atom;
break;
case XCB_ATOM_WINDOW:
xid = xcb_get_property_value(reply);
- *(struct wlsc_wm_window **) p =
+ *(struct weston_wm_window **) p =
hash_table_lookup(wm->window_hash, *xid);
break;
case XCB_ATOM_ATOM:
fprintf(stderr, "window %d: name %s, class %s, transient_for %d\n",
window->id, window->name, window->class,
window->transient_for ? window->transient_for->id : 0);
- wlsc_wm_activate(wm, window, XCB_TIME_CURRENT_TIME);
+ weston_wm_activate(wm, window, XCB_TIME_CURRENT_TIME);
}
static const int incr_chunk_size = 64 * 1024;
static void
-wlsc_wm_send_selection_notify(struct wlsc_wm *wm, xcb_atom_t property)
+weston_wm_send_selection_notify(struct weston_wm *wm, xcb_atom_t property)
{
xcb_selection_notify_event_t selection_notify;
}
static void
-wlsc_wm_send_targets(struct wlsc_wm *wm)
+weston_wm_send_targets(struct weston_wm *wm)
{
xcb_atom_t targets[] = {
wm->atom.timestamp,
32, /* format */
ARRAY_LENGTH(targets), targets);
- wlsc_wm_send_selection_notify(wm, wm->selection_request.property);
+ weston_wm_send_selection_notify(wm, wm->selection_request.property);
}
static void
-wlsc_wm_send_timestamp(struct wlsc_wm *wm)
+weston_wm_send_timestamp(struct weston_wm *wm)
{
xcb_change_property(wm->conn,
XCB_PROP_MODE_REPLACE,
32, /* format */
1, &wm->selection_timestamp);
- wlsc_wm_send_selection_notify(wm, wm->selection_request.property);
+ weston_wm_send_selection_notify(wm, wm->selection_request.property);
}
static int
-wlsc_wm_flush_source_data(struct wlsc_wm *wm)
+weston_wm_flush_source_data(struct weston_wm *wm)
{
int length;
}
static int
-wlsc_wm_read_data_source(int fd, uint32_t mask, void *data)
+weston_wm_read_data_source(int fd, uint32_t mask, void *data)
{
- struct wlsc_wm *wm = data;
+ struct weston_wm *wm = data;
int len, current, available;
void *p;
len = read(fd, p, available);
if (len == -1) {
fprintf(stderr, "read error from data source: %m\n");
- wlsc_wm_send_selection_notify(wm, XCB_ATOM_NONE);
+ weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
wl_event_source_remove(wm->property_source);
close(fd);
wl_array_release(&wm->source_data);
wm->selection_property_set = 1;
wm->flush_property_on_delete = 1;
wl_event_source_remove(wm->property_source);
- wlsc_wm_send_selection_notify(wm, wm->selection_request.property);
+ weston_wm_send_selection_notify(wm, wm->selection_request.property);
} else if (wm->selection_property_set) {
fprintf(stderr, "got %d bytes, waiting for "
"property delete\n", wm->source_data.size);
fprintf(stderr, "got %d bytes, "
"property deleted, seting new property\n",
wm->source_data.size);
- wlsc_wm_flush_source_data(wm);
+ weston_wm_flush_source_data(wm);
}
} else if (len == 0 && !wm->incr) {
fprintf(stderr, "non-incr transfer complete\n");
/* Non-incr transfer all done. */
- wlsc_wm_flush_source_data(wm);
- wlsc_wm_send_selection_notify(wm, wm->selection_request.property);
+ weston_wm_flush_source_data(wm);
+ weston_wm_send_selection_notify(wm, wm->selection_request.property);
xcb_flush(wm->conn);
wl_event_source_remove(wm->property_source);
close(fd);
fprintf(stderr, "got %d bytes, "
"property deleted, seting new property\n",
wm->source_data.size);
- wlsc_wm_flush_source_data(wm);
+ weston_wm_flush_source_data(wm);
}
xcb_flush(wm->conn);
wl_event_source_remove(wm->property_source);
}
static void
-wlsc_wm_send_data(struct wlsc_wm *wm, xcb_atom_t target, const char *mime_type)
+weston_wm_send_data(struct weston_wm *wm, xcb_atom_t target, const char *mime_type)
{
- struct wlsc_input_device *device = (struct wlsc_input_device *)
+ struct weston_input_device *device = (struct weston_input_device *)
wm->server->compositor->input_device;
int p[2];
if (pipe2(p, O_CLOEXEC | O_NONBLOCK) == -1) {
fprintf(stderr, "pipe2 failed: %m\n");
- wlsc_wm_send_selection_notify(wm, XCB_ATOM_NONE);
+ weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
return;
}
wm->property_source = wl_event_loop_add_fd(wm->server->loop,
wm->data_source_fd,
WL_EVENT_READABLE,
- wlsc_wm_read_data_source,
+ weston_wm_read_data_source,
wm);
wl_resource_post_event(&device->selection_data_source->resource,
}
static void
-wlsc_wm_send_incr_chunk(struct wlsc_wm *wm)
+weston_wm_send_incr_chunk(struct weston_wm *wm)
{
fprintf(stderr, "property deleted\n");
int length;
fprintf(stderr, "setting new property, %d bytes\n",
wm->source_data.size);
wm->flush_property_on_delete = 0;
- length = wlsc_wm_flush_source_data(wm);
+ length = weston_wm_flush_source_data(wm);
if (wm->data_source_fd >= 0) {
wm->property_source =
wl_event_loop_add_fd(wm->server->loop,
wm->data_source_fd,
WL_EVENT_READABLE,
- wlsc_wm_read_data_source,
+ weston_wm_read_data_source,
wm);
} else if (length > 0) {
/* Transfer is all done, but queue a flush for
}
static void
-wlsc_wm_handle_selection_request(struct wlsc_wm *wm,
+weston_wm_handle_selection_request(struct weston_wm *wm,
xcb_generic_event_t *event)
{
xcb_selection_request_event_t *selection_request =
wm->flush_property_on_delete = 0;
if (selection_request->target == wm->atom.targets) {
- wlsc_wm_send_targets(wm);
+ weston_wm_send_targets(wm);
} else if (selection_request->target == wm->atom.timestamp) {
- wlsc_wm_send_timestamp(wm);
+ weston_wm_send_timestamp(wm);
} else if (selection_request->target == wm->atom.utf8_string ||
selection_request->target == wm->atom.text) {
- wlsc_wm_send_data(wm, wm->atom.utf8_string,
+ weston_wm_send_data(wm, wm->atom.utf8_string,
"text/plain;charset=utf-8");
} else {
fprintf(stderr, "can only handle UTF8_STRING targets...\n");
- wlsc_wm_send_selection_notify(wm, XCB_ATOM_NONE);
+ weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
}
}
static void
-wlsc_wm_handle_property_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_property_notify_event_t *property_notify =
(xcb_property_notify_event_t *) event;
if (property_notify->state == XCB_PROPERTY_NEW_VALUE &&
property_notify->atom == wm->atom.wl_selection &&
wm->incr)
- wlsc_wm_get_incr_chunk(wm);
+ weston_wm_get_incr_chunk(wm);
} else if (property_notify->window == wm->selection_request.requestor) {
if (property_notify->state == XCB_PROPERTY_DELETE &&
property_notify->atom == wm->selection_request.property &&
wm->incr)
- wlsc_wm_send_incr_chunk(wm);
+ weston_wm_send_incr_chunk(wm);
} else if (property_notify->atom == XCB_ATOM_WM_CLASS) {
fprintf(stderr, "wm_class changed\n");
} else if (property_notify->atom == XCB_ATOM_WM_TRANSIENT_FOR) {
}
static void
-wlsc_wm_handle_create_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_create_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_create_notify_event_t *create_notify =
(xcb_create_notify_event_t *) event;
- struct wlsc_wm_window *window;
+ struct weston_wm_window *window;
uint32_t values[1];
fprintf(stderr, "XCB_CREATE_NOTIFY (window %d)\n",
}
static void
-wlsc_wm_handle_destroy_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
+weston_wm_handle_destroy_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_destroy_notify_event_t *destroy_notify =
(xcb_destroy_notify_event_t *) event;
- struct wlsc_wm_window *window;
+ struct weston_wm_window *window;
fprintf(stderr, "XCB_DESTROY_NOTIFY, win %d\n",
destroy_notify->window);
}
static void
-wlsc_wm_handle_selection_notify(struct wlsc_wm *wm,
+weston_wm_handle_selection_notify(struct weston_wm *wm,
xcb_generic_event_t *event)
{
xcb_selection_notify_event_t *selection_notify =
if (selection_notify->property == XCB_ATOM_NONE) {
/* convert selection failed */
} else if (selection_notify->target == wm->atom.targets) {
- wlsc_wm_get_selection_targets(wm);
+ weston_wm_get_selection_targets(wm);
} else {
- wlsc_wm_get_selection_data(wm);
+ weston_wm_get_selection_data(wm);
}
}
static void
-wlsc_wm_handle_xfixes_selection_notify(struct wlsc_wm *wm,
+weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
xcb_generic_event_t *event)
{
xcb_xfixes_selection_notify_event_t *xfixes_selection_notify =
}
static int
-wlsc_wm_handle_event(int fd, uint32_t mask, void *data)
+weston_wm_handle_event(int fd, uint32_t mask, void *data)
{
- struct wlsc_wm *wm = data;
+ struct weston_wm *wm = data;
xcb_generic_event_t *event;
int count = 0;
while (event = xcb_poll_for_event(wm->conn), event != NULL) {
switch (event->response_type & ~0x80) {
case XCB_CREATE_NOTIFY:
- wlsc_wm_handle_create_notify(wm, event);
+ weston_wm_handle_create_notify(wm, event);
break;
case XCB_MAP_REQUEST:
- wlsc_wm_handle_map_request(wm, event);
+ weston_wm_handle_map_request(wm, event);
break;
case XCB_MAP_NOTIFY:
- wlsc_wm_handle_map_notify(wm, event);
+ weston_wm_handle_map_notify(wm, event);
break;
case XCB_UNMAP_NOTIFY:
fprintf(stderr, "XCB_UNMAP_NOTIFY\n");
break;
case XCB_CONFIGURE_REQUEST:
- wlsc_wm_handle_configure_request(wm, event);
+ weston_wm_handle_configure_request(wm, event);
break;
case XCB_CONFIGURE_NOTIFY:
- wlsc_wm_handle_configure_notify(wm, event);
+ weston_wm_handle_configure_notify(wm, event);
break;
case XCB_DESTROY_NOTIFY:
- wlsc_wm_handle_destroy_notify(wm, event);
+ weston_wm_handle_destroy_notify(wm, event);
break;
case XCB_MAPPING_NOTIFY:
fprintf(stderr, "XCB_MAPPING_NOTIFY\n");
break;
case XCB_PROPERTY_NOTIFY:
- wlsc_wm_handle_property_notify(wm, event);
+ weston_wm_handle_property_notify(wm, event);
break;
case XCB_SELECTION_NOTIFY:
- wlsc_wm_handle_selection_notify(wm, event);
+ weston_wm_handle_selection_notify(wm, event);
break;
case XCB_SELECTION_REQUEST:
- wlsc_wm_handle_selection_request(wm, event);
+ weston_wm_handle_selection_request(wm, event);
break;
}
switch (event->response_type - wm->xfixes->first_event) {
case XCB_XFIXES_SELECTION_NOTIFY:
- wlsc_wm_handle_xfixes_selection_notify(wm, event);
+ weston_wm_handle_xfixes_selection_notify(wm, event);
break;
}
}
static void
-wxs_wm_get_resources(struct wlsc_wm *wm)
+wxs_wm_get_resources(struct weston_wm *wm)
{
-#define F(field) offsetof(struct wlsc_wm, field)
+#define F(field) offsetof(struct weston_wm, field)
static const struct { const char *name; int offset; } atoms[] = {
{ "WM_PROTOCOLS", F(atom.wm_protocols) },
free(xfixes_reply);
}
-static struct wlsc_wm *
-wlsc_wm_create(struct wlsc_xserver *wxs)
+static struct weston_wm *
+weston_wm_create(struct weston_xserver *wxs)
{
- struct wlsc_wm *wm;
+ struct weston_wm *wm;
struct wl_event_loop *loop;
xcb_screen_iterator_t s;
uint32_t values[1], mask;
wm->source =
wl_event_loop_add_fd(loop, sv[0],
WL_EVENT_READABLE,
- wlsc_wm_handle_event, wm);
+ weston_wm_handle_event, wm);
wl_event_source_check(wm->source);
wxs_wm_get_resources(wm);
}
static void
-wlsc_wm_destroy(struct wlsc_wm *wm)
+weston_wm_destroy(struct weston_wm *wm)
{
/* FIXME: Free windows in hash. */
hash_table_destroy(wm->window_hash);
}
static int
-wlsc_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
+weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
{
- struct wlsc_xserver *mxs = data;
+ struct weston_xserver *mxs = data;
char display[8], s[8], logfile[32];
int sv[2], flags;
close(sv[1]);
mxs->client = wl_client_create(mxs->wl_display, sv[0]);
- wlsc_watch_process(&mxs->process);
+ weston_watch_process(&mxs->process);
wl_event_source_remove(mxs->abstract_source);
wl_event_source_remove(mxs->unix_source);
}
static void
-wlsc_xserver_shutdown(struct wlsc_xserver *wxs)
+weston_xserver_shutdown(struct weston_xserver *wxs)
{
char path[256];
close(wxs->abstract_fd);
close(wxs->unix_fd);
if (wxs->wm)
- wlsc_wm_destroy(wxs->wm);
+ weston_wm_destroy(wxs->wm);
wxs->loop = NULL;
}
static void
-wlsc_xserver_cleanup(struct wlsc_process *process, int status)
+weston_xserver_cleanup(struct weston_process *process, int status)
{
- struct wlsc_xserver *mxs =
- container_of(process, struct wlsc_xserver, process);
+ struct weston_xserver *mxs =
+ container_of(process, struct weston_xserver, process);
mxs->process.pid = 0;
mxs->client = NULL;
mxs->abstract_source =
wl_event_loop_add_fd(mxs->loop, mxs->abstract_fd,
WL_EVENT_READABLE,
- wlsc_xserver_handle_event, mxs);
+ weston_xserver_handle_event, mxs);
mxs->unix_source =
wl_event_loop_add_fd(mxs->loop, mxs->unix_fd,
WL_EVENT_READABLE,
- wlsc_xserver_handle_event, mxs);
+ weston_xserver_handle_event, mxs);
if (mxs->wm) {
fprintf(stderr, "xserver exited, code %d\n", status);
- wlsc_wm_destroy(mxs->wm);
+ weston_wm_destroy(mxs->wm);
mxs->wm = NULL;
} else {
/* If the X server crashes before it binds to the
* xserver interface, shut down and don't try
* again. */
fprintf(stderr, "xserver crashing too fast: %d\n", status);
- wlsc_xserver_shutdown(mxs);
+ weston_xserver_shutdown(mxs);
}
}
surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
- struct wlsc_wm_window *window =
+ struct weston_wm_window *window =
container_of(listener,
- struct wlsc_wm_window, surface_destroy_listener);
+ struct weston_wm_window, surface_destroy_listener);
fprintf(stderr, "surface for xid %d destroyed\n", window->id);
}
-static struct wlsc_wm_window *
-get_wm_window(struct wlsc_surface *surface)
+static struct weston_wm_window *
+get_wm_window(struct weston_surface *surface)
{
struct wl_resource *resource = &surface->surface.resource;
struct wl_listener *listener;
wl_list_for_each(listener, &resource->destroy_listener_list, link) {
if (listener->func == surface_destroy)
return container_of(listener,
- struct wlsc_wm_window,
+ struct weston_wm_window,
surface_destroy_listener);
}
xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *surface_resource, uint32_t id)
{
- struct wlsc_xserver *wxs = resource->data;
- struct wlsc_wm *wm = wxs->wm;
+ struct weston_xserver *wxs = resource->data;
+ struct weston_wm *wm = wxs->wm;
struct wl_surface *surface = surface_resource->data;
- struct wlsc_wm_window *window;
+ struct weston_wm_window *window;
if (client != wxs->client)
return;
fprintf(stderr, "set_window_id %d for surface %p\n", id, surface);
- window->surface = (struct wlsc_surface *) surface;
+ window->surface = (struct weston_surface *) surface;
window->surface_destroy_listener.func = surface_destroy;
wl_list_insert(surface->resource.destroy_listener_list.prev,
&window->surface_destroy_listener.link);
bind_xserver(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- struct wlsc_xserver *wxs = data;
+ struct weston_xserver *wxs = data;
/* If it's a different client than the xserver we launched,
* don't start the wm. */
wl_client_add_object(client, &xserver_interface,
&xserver_implementation, id, wxs);
- wxs->wm = wlsc_wm_create(wxs);
+ wxs->wm = weston_wm_create(wxs);
if (wxs->wm == NULL) {
fprintf(stderr, "failed to create wm\n");
}
}
int
-wlsc_xserver_init(struct wlsc_compositor *compositor)
+weston_xserver_init(struct weston_compositor *compositor)
{
struct wl_display *display = compositor->wl_display;
- struct wlsc_xserver *mxs;
+ struct weston_xserver *mxs;
char lockfile[256];
mxs = malloc(sizeof *mxs);
memset(mxs, 0, sizeof *mxs);
- mxs->process.cleanup = wlsc_xserver_cleanup;
+ mxs->process.cleanup = weston_xserver_cleanup;
mxs->wl_display = display;
mxs->compositor = compositor;
mxs->abstract_source =
wl_event_loop_add_fd(mxs->loop, mxs->abstract_fd,
WL_EVENT_READABLE,
- wlsc_xserver_handle_event, mxs);
+ weston_xserver_handle_event, mxs);
mxs->unix_source =
wl_event_loop_add_fd(mxs->loop, mxs->unix_fd,
WL_EVENT_READABLE,
- wlsc_xserver_handle_event, mxs);
+ weston_xserver_handle_event, mxs);
wl_display_add_global(display, &xserver_interface, mxs, bind_xserver);
}
void
-wlsc_xserver_destroy(struct wlsc_compositor *compositor)
+weston_xserver_destroy(struct weston_compositor *compositor)
{
- struct wlsc_xserver *wxs = compositor->wxs;
+ struct weston_xserver *wxs = compositor->wxs;
if (!wxs)
return;
if (wxs->loop)
- wlsc_xserver_shutdown(wxs);
+ weston_xserver_shutdown(wxs);
free(wxs);
}