[digesting_libdecor] eliminate touch support (for now)

main
Allen Webster 2026-03-02 10:44:27 -08:00
parent bea30ea7de
commit 1d47997186
2 changed files with 226 additions and 372 deletions

View File

@ -95,229 +95,42 @@ static void
pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y){
struct seat *seat = data;
seat->pointer_x = wl_fixed_to_int(x);
seat->pointer_y = wl_fixed_to_int(y);
seat->serial = serial;
seat->pointer_focus = surface;
ctx.active = component_slot_from_wl_surface(surface);
if (own_proxy(surface)){
if (ctx.active != 0){
draw_decoration();
wl_surface_commit(ctx.wl_surface);
}
seat->current_cursor = wl_cursor_from_pos(seat->pointer_x, seat->pointer_y);
if (seat->current_cursor != 0){
struct wl_cursor_image *image = seat->current_cursor->images[0];
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
wl_surface_set_buffer_scale(seat->cursor_surface, 1);
wl_surface_attach(seat->cursor_surface, buffer, 0, 0);
wl_surface_damage_buffer(seat->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(seat->cursor_surface);
wl_pointer_set_cursor(seat->wl_pointer, seat->serial, seat->cursor_surface, image->hotspot_x, image->hotspot_y);
}
}
ctx.pointer_enter = 1;
}
static void
pointer_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface){
pointer_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
struct wl_surface *surface){
struct seat *seat = data;
seat->pointer_focus = 0;
if (surface != 0 && own_proxy(surface)){
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
ctx.titlebar_gesture.first_pressed_button = 0;
seat->serial = serial;
ctx.active = 0;
ctx.hdr_focus.widget = 0;
ctx.hdr_focus.type = HEADER_NONE;
draw_decoration();
wl_surface_commit(ctx.wl_surface);
seat->current_cursor = wl_cursor_from_pos(seat->pointer_x, seat->pointer_y);
}
ctx.pointer_leave = 1;
}
static void
pointer_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time,
wl_fixed_t surface_x, wl_fixed_t surface_y){
struct seat *seat = data;
struct header_element_data new_focus;
if (own_proxy(seat->pointer_focus)){
seat->pointer_x = wl_fixed_to_int(surface_x);
seat->pointer_y = wl_fixed_to_int(surface_y);
seat->current_cursor = wl_cursor_from_pos(seat->pointer_x, seat->pointer_y);
if (seat->current_cursor != 0){
struct wl_cursor_image *image = seat->current_cursor->images[0];
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
wl_surface_attach(seat->cursor_surface, buffer, 0, 0);
wl_surface_set_buffer_scale(seat->cursor_surface, 1);
wl_surface_damage_buffer(seat->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(seat->cursor_surface);
wl_pointer_set_cursor(seat->wl_pointer, seat->serial, seat->cursor_surface, image->hotspot_x, image->hotspot_y);
}
if (!GTK_IS_WIDGET(ctx.header) || ctx.active != COMPONENT_SLOT_HEADER){
ctx.hdr_focus.type = HEADER_NONE;
}
new_focus = get_header_focus(GTK_HEADER_BAR(ctx.header), seat->pointer_x, seat->pointer_y);
/* only update if widget change so that we keep the state */
if (ctx.hdr_focus.widget != new_focus.widget){
ctx.hdr_focus = new_focus;
ctx.hdr_state = 0;
}
ctx.hdr_state |= GTK_STATE_FLAG_PRELIGHT;
/* redraw with updated button visuals */
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
if (ctx.titlebar_gesture.state == TITLEBAR_GESTURE_STATE_BUTTON_PRESSED){
if (ctx.titlebar_gesture.first_pressed_button == BTN_LEFT){
int xd = ABS(seat->pointer_x - ctx.titlebar_gesture.pressed_x);
int yd = ABS(seat->pointer_y - ctx.titlebar_gesture.pressed_y);
if (xd > ctx.drag_threshold || yd > ctx.drag_threshold){
xdg_toplevel_move(ctx.xdg_toplevel, seat->wl_seat, ctx.titlebar_gesture.serial);
}
}
}
}
ctx.pointer_motion = 1;
}
static void
pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state){
struct seat *seat = data;
if (own_proxy(seat->pointer_focus)){
switch (ctx.active){
case COMPONENT_SLOT_SHADOW: {
enum libdecor_resize_edge edge = edge_from_pos(seat->pointer_x, seat->pointer_y);
if (edge != LIBDECOR_RESIZE_EDGE_NONE &&
(ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
xdg_toplevel_resize(ctx.xdg_toplevel, seat->wl_seat, serial, xdg_edge_from_edge(edge));
}
}break;
case COMPONENT_SLOT_HEADER: {
switch (ctx.titlebar_gesture.state){
case TITLEBAR_GESTURE_STATE_INIT: {
if (state == WL_POINTER_BUTTON_STATE_PRESSED){
if (button == BTN_RIGHT){
const int title_height = gtk_widget_get_allocated_height(ctx.header);
xdg_toplevel_show_window_menu(ctx.xdg_toplevel, seat->wl_seat, serial, seat->pointer_x, -title_height);
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_CONSUMED;
}
else{
if (button == BTN_LEFT &&
ctx.titlebar_gesture.first_pressed_button == BTN_LEFT &&
time - ctx.titlebar_gesture.first_pressed_time < (uint32_t)ctx.double_click_time_ms){
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_CONSUMED;
}
else{
ctx.titlebar_gesture.first_pressed_button = button;
ctx.titlebar_gesture.first_pressed_time = time;
ctx.titlebar_gesture.pressed_x = seat->pointer_x;
ctx.titlebar_gesture.pressed_y = seat->pointer_y;
ctx.titlebar_gesture.serial = serial;
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_BUTTON_PRESSED;
}
}
ctx.titlebar_gesture.button_pressed_count = 1;
switch (ctx.hdr_focus.type){
case HEADER_MIN:
case HEADER_MAX:
case HEADER_CLOSE: {
ctx.hdr_state |= GTK_STATE_FLAG_ACTIVE;
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}break;
default: break;
}
}
}break;
case TITLEBAR_GESTURE_STATE_BUTTON_PRESSED: {
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_DISCARDED;
ctx.titlebar_gesture.button_pressed_count += 1;
}
else{
ctx.titlebar_gesture.button_pressed_count -= 1;
if (ctx.titlebar_gesture.button_pressed_count == 0) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
if (ctx.titlebar_gesture.first_pressed_button == button &&
button == BTN_LEFT) {
switch (ctx.hdr_focus.type) {
case HEADER_MIN: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_MINIMIZE){
xdg_toplevel_set_minimized(ctx.xdg_toplevel);
}
}break;
case HEADER_MAX: {
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
}break;
case HEADER_CLOSE: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_CLOSE){
ctx.close_signal = 1;
seat->pointer_focus = 0;
}
}break;
default: break;
}
ctx.hdr_state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(ctx.header)){
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
}
}
else{
ctx.hdr_state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(ctx.header)) {
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
}
}
}break;
case TITLEBAR_GESTURE_STATE_CONSUMED:
case TITLEBAR_GESTURE_STATE_DISCARDED: {
if (state == WL_POINTER_BUTTON_STATE_PRESSED){
ctx.titlebar_gesture.button_pressed_count++;
}
else{
ctx.titlebar_gesture.button_pressed_count--;
if (ctx.titlebar_gesture.button_pressed_count == 0) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
ctx.titlebar_gesture.first_pressed_button = 0;
}
}
}break;
}
}break;
default: break;
}
}
seat->serial = serial;
ctx.pointer_button = 1;
ctx.pointer_button_time = time;
ctx.pointer_button_button = button;
ctx.pointer_button_state = state;
}
static void
@ -332,137 +145,6 @@ const struct wl_pointer_listener pointer_listener = {
pointer_axis
};
static void
touch_down(void *data, struct wl_touch *wl_touch, uint32_t serial,
uint32_t time, struct wl_surface *surface, int32_t id,
wl_fixed_t x, wl_fixed_t y){
struct seat *seat = data;
if (surface != 0 && own_proxy(surface)){
seat->touch_focus = surface;
ctx.touch_active = component_slot_from_wl_surface(surface);
if (ctx.touch_active){
update_touch_focus(seat, x, y);
/* update decorations */
draw_decoration();
wl_surface_commit(ctx.wl_surface);
switch (ctx.touch_active){
case COMPONENT_SLOT_SHADOW: {
enum libdecor_resize_edge edge = edge_from_pos(wl_fixed_to_int(x), wl_fixed_to_int(y));
if (edge != LIBDECOR_RESIZE_EDGE_NONE &&
(ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
xdg_toplevel_resize(ctx.xdg_toplevel, seat->wl_seat, serial, xdg_edge_from_edge(edge));
}
}break;
case COMPONENT_SLOT_HEADER: {
switch (ctx.hdr_focus.type){
case HEADER_MIN:
case HEADER_MAX:
case HEADER_CLOSE: {
ctx.hdr_state |= GTK_STATE_FLAG_ACTIVE;
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}break;
default: {
if (time - seat->touch_down_time_stamp < (uint32_t)ctx.double_click_time_ms) {
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
}
else{
if (ctx.frame_capabilities & LIBDECOR_ACTION_MOVE){
seat->touch_down_time_stamp = time;
xdg_toplevel_move(ctx.xdg_toplevel, seat->wl_seat, serial);
}
}
}break;
}
}break;
default: break;
}
}
}
}
static void
touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id){
struct seat *seat = data;
if (seat->touch_focus && own_proxy(seat->touch_focus)){
if (ctx.touch_active != 0){
if (ctx.touch_active == COMPONENT_SLOT_HEADER){
switch (ctx.hdr_focus.type){
case HEADER_MIN: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_MINIMIZE){
xdg_toplevel_set_minimized(ctx.xdg_toplevel);
}
}break;
case HEADER_MAX: {
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
}break;
case HEADER_CLOSE: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_CLOSE){
ctx.close_signal = 1;
seat->touch_focus = 0;
}
}break;
default: break;
}
/* unset active/clicked state once released */
ctx.hdr_state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(ctx.header)) {
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
}
else{
seat->touch_focus = 0;
ctx.touch_active = 0;
ctx.hdr_focus.widget = 0;
ctx.hdr_focus.type = HEADER_NONE;
draw_decoration();
wl_surface_commit(ctx.wl_surface);
}
}
}
}
static void
touch_motion(void *data, struct wl_touch *wl_touch, uint32_t time,
int32_t id, wl_fixed_t x, wl_fixed_t y){
struct seat *seat = data;
if (seat->touch_focus != 0 && own_proxy(seat->touch_focus)){
update_touch_focus(seat, x, y);
}
}
static void
touch_frame(void *data, struct wl_touch *wl_touch){}
static void
touch_cancel(void *data, struct wl_touch *wl_touch){}
const struct wl_touch_listener touch_listener = {
touch_down,
touch_up,
touch_motion,
touch_frame,
touch_cancel
};
static void
seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities){
struct seat *seat = data;
@ -475,15 +157,6 @@ seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities){
wl_pointer_release(seat->wl_pointer);
seat->wl_pointer = 0;
}
if ((capabilities & WL_SEAT_CAPABILITY_TOUCH) && seat->wl_touch == 0){
seat->wl_touch = wl_seat_get_touch(wl_seat);
wl_touch_add_listener(seat->wl_touch, &touch_listener, seat);
}
else if (!(capabilities & WL_SEAT_CAPABILITY_TOUCH) && seat->wl_touch != 0){
wl_touch_release(seat->wl_touch);
seat->wl_touch = 0;
}
}
static void
@ -543,6 +216,7 @@ wl_registry_global(void *data, struct wl_registry *wl_registry,
seat = calloc(1, sizeof *seat);
wl_list_insert(&ctx.seat_list, &seat->link);
ctx.seat = seat;
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
@ -1069,6 +743,207 @@ int main(){
}
}
/* re-render cursor */
if (ctx.pointer_leave){
ctx.pointer_leave = 0;
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
ctx.titlebar_gesture.first_pressed_button = 0;
ctx.hdr_focus.widget = 0;
ctx.hdr_focus.type = HEADER_NONE;
draw_decoration();
wl_surface_commit(ctx.wl_surface);
ctx.seat->current_cursor = wl_cursor_from_pos(ctx.seat->pointer_x, ctx.seat->pointer_y);
}
if (ctx.pointer_enter){
ctx.pointer_enter = 0;
if (ctx.active != 0){
draw_decoration();
wl_surface_commit(ctx.wl_surface);
}
ctx.seat->current_cursor = wl_cursor_from_pos(ctx.seat->pointer_x, ctx.seat->pointer_y);
if (ctx.seat->current_cursor != 0){
struct wl_cursor_image *image = ctx.seat->current_cursor->images[0];
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
wl_surface_set_buffer_scale(ctx.seat->cursor_surface, 1);
wl_surface_attach(ctx.seat->cursor_surface, buffer, 0, 0);
wl_surface_damage_buffer(ctx.seat->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(ctx.seat->cursor_surface);
wl_pointer_set_cursor(ctx.seat->wl_pointer, ctx.seat->serial, ctx.seat->cursor_surface, image->hotspot_x, image->hotspot_y);
}
}
if (ctx.pointer_motion){
ctx.pointer_motion = 0;
ctx.seat->current_cursor = wl_cursor_from_pos(ctx.seat->pointer_x, ctx.seat->pointer_y);
if (ctx.seat->current_cursor != 0){
struct wl_cursor_image *image = ctx.seat->current_cursor->images[0];
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
wl_surface_attach(ctx.seat->cursor_surface, buffer, 0, 0);
wl_surface_set_buffer_scale(ctx.seat->cursor_surface, 1);
wl_surface_damage_buffer(ctx.seat->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(ctx.seat->cursor_surface);
wl_pointer_set_cursor(ctx.seat->wl_pointer, ctx.seat->serial, ctx.seat->cursor_surface,
image->hotspot_x, image->hotspot_y);
}
if (!GTK_IS_WIDGET(ctx.header) || ctx.active != COMPONENT_SLOT_HEADER){
ctx.hdr_focus.type = HEADER_NONE;
}
struct header_element_data new_focus =
get_header_focus(GTK_HEADER_BAR(ctx.header), ctx.seat->pointer_x, ctx.seat->pointer_y);
if (ctx.hdr_focus.widget != new_focus.widget){
ctx.hdr_focus = new_focus;
ctx.hdr_state = 0;
}
ctx.hdr_state |= GTK_STATE_FLAG_PRELIGHT;
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
if (ctx.titlebar_gesture.state == TITLEBAR_GESTURE_STATE_BUTTON_PRESSED){
if (ctx.titlebar_gesture.first_pressed_button == BTN_LEFT){
int xd = ABS(ctx.seat->pointer_x - ctx.titlebar_gesture.pressed_x);
int yd = ABS(ctx.seat->pointer_y - ctx.titlebar_gesture.pressed_y);
if (xd > ctx.drag_threshold || yd > ctx.drag_threshold){
xdg_toplevel_move(ctx.xdg_toplevel, ctx.seat->wl_seat, ctx.titlebar_gesture.serial);
}
}
}
}
if (ctx.pointer_button){
ctx.pointer_button = 0;
switch (ctx.active){
case COMPONENT_SLOT_SHADOW: {
enum libdecor_resize_edge edge = edge_from_pos(ctx.seat->pointer_x, ctx.seat->pointer_y);
if (edge != LIBDECOR_RESIZE_EDGE_NONE &&
(ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
xdg_toplevel_resize(ctx.xdg_toplevel, ctx.seat->wl_seat, ctx.seat->serial, xdg_edge_from_edge(edge));
}
}break;
case COMPONENT_SLOT_HEADER: {
switch (ctx.titlebar_gesture.state){
case TITLEBAR_GESTURE_STATE_INIT: {
if (ctx.pointer_button_state == WL_POINTER_BUTTON_STATE_PRESSED){
if (ctx.pointer_button_button == BTN_RIGHT){
const int title_height = gtk_widget_get_allocated_height(ctx.header);
xdg_toplevel_show_window_menu(ctx.xdg_toplevel, ctx.seat->wl_seat, ctx.seat->serial, ctx.seat->pointer_x, -title_height);
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_CONSUMED;
}
else{
if (ctx.pointer_button_button == BTN_LEFT &&
ctx.titlebar_gesture.first_pressed_button == BTN_LEFT &&
ctx.pointer_button_time - ctx.titlebar_gesture.first_pressed_time < (uint32_t)ctx.double_click_time_ms){
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_CONSUMED;
}
else{
ctx.titlebar_gesture.first_pressed_button = ctx.pointer_button_button;
ctx.titlebar_gesture.first_pressed_time = ctx.pointer_button_time;
ctx.titlebar_gesture.pressed_x = ctx.seat->pointer_x;
ctx.titlebar_gesture.pressed_y = ctx.seat->pointer_y;
ctx.titlebar_gesture.serial = ctx.seat->serial;
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_BUTTON_PRESSED;
}
}
ctx.titlebar_gesture.button_pressed_count = 1;
switch (ctx.hdr_focus.type){
case HEADER_MIN:
case HEADER_MAX:
case HEADER_CLOSE: {
ctx.hdr_state |= GTK_STATE_FLAG_ACTIVE;
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}break;
default: break;
}
}
}break;
case TITLEBAR_GESTURE_STATE_BUTTON_PRESSED: {
if (ctx.pointer_button_state == WL_POINTER_BUTTON_STATE_PRESSED) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_DISCARDED;
ctx.titlebar_gesture.button_pressed_count += 1;
}
else{
ctx.titlebar_gesture.button_pressed_count -= 1;
if (ctx.titlebar_gesture.button_pressed_count == 0) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
if (ctx.titlebar_gesture.first_pressed_button == ctx.pointer_button_button &&
ctx.pointer_button_button == BTN_LEFT){
switch (ctx.hdr_focus.type){
case HEADER_MIN: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_MINIMIZE){
xdg_toplevel_set_minimized(ctx.xdg_toplevel);
}
}break;
case HEADER_MAX: {
if ((ctx.frame_capabilities & LIBDECOR_ACTION_RESIZE)){
toggle_maximized();
}
}break;
case HEADER_CLOSE: {
if (ctx.frame_capabilities & LIBDECOR_ACTION_CLOSE){
ctx.close_signal = 1;
ctx.seat->pointer_focus = 0;
}
}break;
default: break;
}
ctx.hdr_state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(ctx.header)){
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
}
}
else{
ctx.hdr_state &= ~GTK_STATE_FLAG_ACTIVE;
if (GTK_IS_WIDGET(ctx.header)) {
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
}
}
}break;
case TITLEBAR_GESTURE_STATE_CONSUMED:
case TITLEBAR_GESTURE_STATE_DISCARDED: {
if (ctx.pointer_button_state == WL_POINTER_BUTTON_STATE_PRESSED){
ctx.titlebar_gesture.button_pressed_count += 1;
}
else{
ctx.titlebar_gesture.button_pressed_count -= 1;
if (ctx.titlebar_gesture.button_pressed_count == 0) {
ctx.titlebar_gesture.state = TITLEBAR_GESTURE_STATE_INIT;
ctx.titlebar_gesture.first_pressed_button = 0;
}
}
}break;
}
}break;
default: break;
}
}
/* apply new surface config */
if (ctx.has_cached_config){
ctx.has_cached_config = 0;
@ -1081,10 +956,8 @@ int main(){
xdg_surface_ack_configure(ctx.xdg_surface, ctx.cached_config.serial);
}
/* (nodocs-wl_egl) */
wl_egl_window_resize(ctx.wl_egl_window, ctx.w, ctx.h, 0, 0);
/*~ NOTE: render */
{
glDrawBuffer(GL_BACK);
glViewport(0, 0, 640, 480);
@ -1096,19 +969,12 @@ int main(){
exit_loop = 1;
}
/* (egl) eglSwapBuffers
** " back-buffered window surface, then the color buffer is copied
** (posted) to the native window associated with that surface "
*/
EGLBoolean swap_success = eglSwapBuffers(ctx.egl_display, ctx.egl_surface);
if (!swap_success){
printf("eglSwapBuffers failed\n");
}
}
/* (1) #Client-classwl__display_1a9150a7e3213a58b469a6966e60a9f108
** " Close the connection to display "
*/
if (ctx.wl_display != 0){
wl_display_disconnect(ctx.wl_display);
}
@ -1291,9 +1157,6 @@ cleanup(void){
if (seat->wl_pointer){
wl_pointer_destroy(seat->wl_pointer);
}
if (seat->wl_touch){
wl_touch_destroy(seat->wl_touch);
}
wl_surface_destroy(seat->cursor_surface);
wl_seat_destroy(seat->wl_seat);
if (ctx.cursor_theme != 0){
@ -2259,24 +2122,6 @@ wl_cursor_from_pos(int x, int y){
return(result);
}
static void
update_touch_focus(struct seat *seat, wl_fixed_t x, wl_fixed_t y){
if (GTK_IS_WIDGET(ctx.header) && ctx.touch_active == COMPONENT_SLOT_HEADER){
struct header_element_data new_focus = get_header_focus(GTK_HEADER_BAR(ctx.header), wl_fixed_to_int(x), wl_fixed_to_int(y));
if (ctx.hdr_focus.widget != new_focus.widget){
ctx.hdr_focus = new_focus;
ctx.hdr_state = 0;
}
ctx.hdr_state |= GTK_STATE_FLAG_PRELIGHT;
draw_title_bar();
wl_surface_commit(ctx.wl_surface);
}
else{
ctx.hdr_focus.type = HEADER_NONE;
}
}
//#include "desktop-settings.c"
static bool

View File

@ -341,6 +341,16 @@ typedef struct Ctx{
int has_pending_config;
struct libdecor_configuration pending_config;
/* uncategorized experiments */
struct seat *seat;
bool pointer_enter;
bool pointer_leave;
bool pointer_motion;
bool pointer_button;
uint32_t pointer_button_time;
uint32_t pointer_button_button;
uint32_t pointer_button_state;
//struct libdecor_frame_private;
char *title;
Sides2D size_bounds;
@ -371,7 +381,6 @@ typedef struct Ctx{
enum libdecor_capabilities gtk_capabilities;
enum component_slot active;
enum component_slot touch_active;
enum component_slot focus;
enum component_slot grab;
struct border_component component_slot[COMPONENT_SLOT_COUNT];