[digesting_libdecor] remove wl_surface listeners
parent
8b66e63249
commit
79cc95b501
|
|
@ -91,32 +91,6 @@ shm_format(void *user_data, struct wl_shm *wl_shm, uint32_t format){
|
||||||
|
|
||||||
const struct wl_shm_listener shm_listener = { shm_format };
|
const struct wl_shm_listener shm_listener = { shm_format };
|
||||||
|
|
||||||
static void
|
|
||||||
cursor_surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){
|
|
||||||
struct seat *seat = data;
|
|
||||||
if (own_proxy(wl_output)) {
|
|
||||||
if (update_local_cursor(seat)){
|
|
||||||
send_cursor(seat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cursor_surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){
|
|
||||||
struct seat *seat = data;
|
|
||||||
|
|
||||||
if (own_proxy(wl_output)){
|
|
||||||
if (update_local_cursor(seat)){
|
|
||||||
send_cursor(seat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct wl_surface_listener cursor_surface_listener = {
|
|
||||||
cursor_surface_enter,
|
|
||||||
cursor_surface_leave,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
||||||
struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y){
|
struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y){
|
||||||
|
|
@ -127,7 +101,6 @@ pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
||||||
if (is_own_surface || ctx.handle_cursor){
|
if (is_own_surface || ctx.handle_cursor){
|
||||||
if (seat->cursor_surface == 0){
|
if (seat->cursor_surface == 0){
|
||||||
seat->cursor_surface = wl_compositor_create_surface(ctx.wl_compositor);
|
seat->cursor_surface = wl_compositor_create_surface(ctx.wl_compositor);
|
||||||
wl_surface_add_listener(seat->cursor_surface, &cursor_surface_listener, seat);
|
|
||||||
}
|
}
|
||||||
seat->pointer_x = wl_fixed_to_int(surface_x);
|
seat->pointer_x = wl_fixed_to_int(surface_x);
|
||||||
seat->pointer_y = wl_fixed_to_int(surface_y);
|
seat->pointer_y = wl_fixed_to_int(surface_y);
|
||||||
|
|
@ -522,6 +495,7 @@ const struct wl_seat_listener seat_listener = {
|
||||||
seat_name
|
seat_name
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
output_geometry(void *data, struct wl_output *wl_output,
|
output_geometry(void *data, struct wl_output *wl_output,
|
||||||
int32_t x, int32_t y,
|
int32_t x, int32_t y,
|
||||||
|
|
@ -561,6 +535,7 @@ const struct wl_output_listener output_listener = {
|
||||||
output_done,
|
output_done,
|
||||||
output_scale
|
output_scale
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wl_registry_global(void *data, struct wl_registry *wl_registry,
|
wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
|
|
@ -612,6 +587,7 @@ wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
|
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
|
||||||
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
|
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
else if (strcmp(interface, "wl_output") == 0){
|
else if (strcmp(interface, "wl_output") == 0){
|
||||||
struct output *output;
|
struct output *output;
|
||||||
if (version < 2){
|
if (version < 2){
|
||||||
|
|
@ -625,11 +601,13 @@ wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
wl_proxy_set_tag((struct wl_proxy*)output->wl_output, &libdecor_gtk_proxy_tag);
|
wl_proxy_set_tag((struct wl_proxy*)output->wl_output, &libdecor_gtk_proxy_tag);
|
||||||
wl_output_add_listener(output->wl_output, &output_listener, output);
|
wl_output_add_listener(output->wl_output, &output_listener, output);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wl_registry_global_remove(void *data, struct wl_registry *registry,
|
wl_registry_global_remove(void *data, struct wl_registry *registry,
|
||||||
uint32_t name){
|
uint32_t name){
|
||||||
|
#if 0
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &ctx.output_list, link){
|
wl_list_for_each(output, &ctx.output_list, link){
|
||||||
if (output->id == name){
|
if (output->id == name){
|
||||||
|
|
@ -653,6 +631,7 @@ wl_registry_global_remove(void *data, struct wl_registry *registry,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct wl_registry_listener wl_registry_listener = {
|
const struct wl_registry_listener wl_registry_listener = {
|
||||||
|
|
@ -847,7 +826,9 @@ int main(){
|
||||||
ctx.w = 640;
|
ctx.w = 640;
|
||||||
ctx.h = 480;
|
ctx.h = 480;
|
||||||
wl_list_init(&ctx.seat_list);
|
wl_list_init(&ctx.seat_list);
|
||||||
|
#if 0
|
||||||
wl_list_init(&ctx.output_list);
|
wl_list_init(&ctx.output_list);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_init_success){
|
if (gtk_init_success){
|
||||||
|
|
@ -1558,19 +1539,6 @@ cleanup(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
struct output *output, *output_tmp;
|
|
||||||
wl_list_for_each_safe(output, output_tmp,
|
|
||||||
&ctx.output_list, link) {
|
|
||||||
if (wl_output_get_version (output->wl_output) >=
|
|
||||||
WL_OUTPUT_RELEASE_SINCE_VERSION)
|
|
||||||
wl_output_release(output->wl_output);
|
|
||||||
else
|
|
||||||
wl_output_destroy(output->wl_output);
|
|
||||||
free(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx.wl_shm){
|
if (ctx.wl_shm){
|
||||||
wl_shm_destroy(ctx.wl_shm);
|
wl_shm_destroy(ctx.wl_shm);
|
||||||
}
|
}
|
||||||
|
|
@ -2076,14 +2044,6 @@ free_border_component(struct border_component *border_component){
|
||||||
buffer_free(border_component->buffer);
|
buffer_free(border_component->buffer);
|
||||||
border_component->buffer = NULL;
|
border_component->buffer = NULL;
|
||||||
}
|
}
|
||||||
if (border_component->output_list.next != NULL) {
|
|
||||||
struct surface_output *surface_output, *surface_output_tmp;
|
|
||||||
wl_list_for_each_safe(surface_output, surface_output_tmp,
|
|
||||||
&border_component->output_list, link) {
|
|
||||||
wl_list_remove(&surface_output->link);
|
|
||||||
free(surface_output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -2128,9 +2088,6 @@ redraw_scale(struct border_component *cmpnt){
|
||||||
|
|
||||||
bool need_commit = false;
|
bool need_commit = false;
|
||||||
if (cmpnt->wl_surface != 0){
|
if (cmpnt->wl_surface != 0){
|
||||||
wl_list_for_each(surface_output, &cmpnt->output_list, link){
|
|
||||||
scale = MAX(scale, surface_output->output->scale);
|
|
||||||
}
|
|
||||||
if (scale != cmpnt->scale){
|
if (scale != cmpnt->scale){
|
||||||
cmpnt->scale = scale;
|
cmpnt->scale = scale;
|
||||||
if ((ctx.decoration_type != DECORATION_TYPE_NONE) &&
|
if ((ctx.decoration_type != DECORATION_TYPE_NONE) &&
|
||||||
|
|
@ -2146,70 +2103,13 @@ redraw_scale(struct border_component *cmpnt){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){
|
|
||||||
if (own_proxy(wl_surface) && own_proxy(wl_output)){
|
|
||||||
struct border_component *cmpnt = border_component_from_wl_surface(wl_surface);
|
|
||||||
if (cmpnt != 0){
|
|
||||||
bool new_surface_output = false;
|
|
||||||
if (own_proxy(wl_output)){
|
|
||||||
struct output *output = wl_output_get_user_data(wl_output);
|
|
||||||
if (output != 0){
|
|
||||||
struct wl_list *list = &cmpnt->output_list;
|
|
||||||
struct surface_output *surface_output = calloc(1, sizeof *surface_output);
|
|
||||||
surface_output->output = output;
|
|
||||||
wl_list_insert(list, &surface_output->link);
|
|
||||||
new_surface_output = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_surface_output){
|
|
||||||
redraw_scale(cmpnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){
|
|
||||||
if (own_proxy(wl_surface) && own_proxy(wl_output)){
|
|
||||||
struct border_component *cmpnt = border_component_from_wl_surface(wl_surface);
|
|
||||||
if (cmpnt != 0){
|
|
||||||
bool removed_surface_output = false;
|
|
||||||
{
|
|
||||||
struct wl_list *list = &cmpnt->output_list;
|
|
||||||
struct surface_output *surface_output;
|
|
||||||
wl_list_for_each(surface_output, list, link){
|
|
||||||
if (surface_output->output->wl_output == wl_output){
|
|
||||||
wl_list_remove(&surface_output->link);
|
|
||||||
free(surface_output);
|
|
||||||
removed_surface_output = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removed_surface_output){
|
|
||||||
redraw_scale(cmpnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct wl_surface_listener surface_listener = {
|
|
||||||
surface_enter,
|
|
||||||
surface_leave,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensure_component(struct border_component *cmpnt){
|
ensure_component(struct border_component *cmpnt){
|
||||||
if (cmpnt->wl_surface == 0){
|
if (cmpnt->wl_surface == 0){
|
||||||
wl_list_init(&cmpnt->output_list);
|
|
||||||
cmpnt->scale = 1;
|
cmpnt->scale = 1;
|
||||||
cmpnt->wl_surface = wl_compositor_create_surface(ctx.wl_compositor);
|
cmpnt->wl_surface = wl_compositor_create_surface(ctx.wl_compositor);
|
||||||
wl_proxy_set_tag((struct wl_proxy *)cmpnt->wl_surface, &libdecor_gtk_proxy_tag);
|
wl_proxy_set_tag((struct wl_proxy *)cmpnt->wl_surface, &libdecor_gtk_proxy_tag);
|
||||||
cmpnt->wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor, cmpnt->wl_surface, ctx.wl_surface);
|
cmpnt->wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor, cmpnt->wl_surface, ctx.wl_surface);
|
||||||
wl_surface_add_listener(cmpnt->wl_surface, &surface_listener, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,6 @@ struct border_component {
|
||||||
struct wl_subsurface *wl_subsurface;
|
struct wl_subsurface *wl_subsurface;
|
||||||
struct buffer *buffer;
|
struct buffer *buffer;
|
||||||
bool opaque;
|
bool opaque;
|
||||||
struct wl_list output_list;
|
|
||||||
int scale;
|
int scale;
|
||||||
|
|
||||||
struct wl_list child_components; /* border_component::link */
|
struct wl_list child_components; /* border_component::link */
|
||||||
|
|
@ -232,7 +231,8 @@ struct seat {
|
||||||
struct wl_surface *pointer_focus;
|
struct wl_surface *pointer_focus;
|
||||||
struct wl_surface *touch_focus;
|
struct wl_surface *touch_focus;
|
||||||
|
|
||||||
int pointer_x, pointer_y;
|
int pointer_x;
|
||||||
|
int pointer_y;
|
||||||
|
|
||||||
uint32_t touch_down_time_stamp;
|
uint32_t touch_down_time_stamp;
|
||||||
|
|
||||||
|
|
@ -243,14 +243,6 @@ struct seat {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct output {
|
|
||||||
struct wl_output *wl_output;
|
|
||||||
uint32_t id;
|
|
||||||
int scale;
|
|
||||||
|
|
||||||
struct wl_list link;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct buffer {
|
struct buffer {
|
||||||
struct wl_buffer *wl_buffer;
|
struct wl_buffer *wl_buffer;
|
||||||
bool in_use;
|
bool in_use;
|
||||||
|
|
@ -265,11 +257,6 @@ struct buffer {
|
||||||
int buffer_height;
|
int buffer_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct surface_output {
|
|
||||||
struct output *output;
|
|
||||||
struct wl_list link;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum titlebar_gesture {
|
enum titlebar_gesture {
|
||||||
TITLEBAR_GESTURE_DOUBLE_CLICK,
|
TITLEBAR_GESTURE_DOUBLE_CLICK,
|
||||||
TITLEBAR_GESTURE_MIDDLE_CLICK,
|
TITLEBAR_GESTURE_MIDDLE_CLICK,
|
||||||
|
|
@ -357,7 +344,6 @@ typedef struct Ctx{
|
||||||
struct zxdg_decoration_manager_v1 *decoration_manager;
|
struct zxdg_decoration_manager_v1 *decoration_manager;
|
||||||
|
|
||||||
struct wl_list seat_list;
|
struct wl_list seat_list;
|
||||||
struct wl_list output_list;
|
|
||||||
|
|
||||||
bool has_error;
|
bool has_error;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue