diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-13 19:08:30 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-13 19:08:30 +0200 |
| commit | 01038e832a305d0b2ad798f3d0dc25003d79e1ad (patch) | |
| tree | 5002041ca1d6849e4346797cde0b51d878633848 /src/drivers/Wayland | |
| parent | 6958e5d615c320efd61e9a8ced86d1acc32d78be (diff) | |
Fix trailing whitespace and dependencies
Diffstat (limited to 'src/drivers/Wayland')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx | 6 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 82 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 100 | ||||
| -rw-r--r-- | src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx | 38 |
9 files changed, 127 insertions, 127 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx index 4e145e594..4553c1a0e 100644 --- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx @@ -68,7 +68,7 @@ static EGLConfig wld_egl_conf = NULL; EGLDisplay Fl_Wayland_Gl_Window_Driver::egl_display = EGL_NO_DISPLAY; -Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : +Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) { if (egl_display == EGL_NO_DISPLAY) init(); egl_window = NULL; @@ -104,7 +104,7 @@ void Fl_Wayland_Gl_Window_Driver::init() { } -char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, +char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs) { // write str to a bitmap just big enough @@ -181,7 +181,7 @@ GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window, if (context_list && nContext) shared_ctx = context_list[0]; static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; - GLContext ctx = (GLContext)eglCreateContext(egl_display, + GLContext ctx = (GLContext)eglCreateContext(egl_display, ((Fl_Wayland_Gl_Choice*)g)->egl_conf, (shared_ctx ? (EGLContext)shared_ctx : EGL_NO_CONTEXT), context_attribs); @@ -211,7 +211,7 @@ void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context float s = Fl::screen_scale(w->screen_num()); Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); // the GL scene will be a transparent subsurface above the cairo-drawn surface - dr->gl_start_support_->surface = + dr->gl_start_support_->surface = wl_compositor_create_surface(scr_driver->wl_compositor); dr->gl_start_support_->subsurface = wl_subcompositor_get_subsurface( scr_driver->wl_subcompositor, dr->gl_start_support_->surface, win->wl_surface); @@ -225,7 +225,7 @@ void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context if (context != cached_context || w != cached_window) { cached_context = context; cached_window = w; - if (eglMakeCurrent(egl_display, target_egl_surface, target_egl_surface, + if (eglMakeCurrent(egl_display, target_egl_surface, target_egl_surface, (EGLContext)context)) { //fprintf(stderr, "EGLContext %p made current\n", context); } else { @@ -369,7 +369,7 @@ public: } } void destroy(struct gl_start_support *gl_start_support_) FL_OVERRIDE { - eglDestroySurface(Fl_Wayland_Gl_Window_Driver::egl_display, + eglDestroySurface(Fl_Wayland_Gl_Window_Driver::egl_display, gl_start_support_->egl_surface); wl_egl_window_destroy(gl_start_support_->egl_window); wl_subsurface_destroy(gl_start_support_->subsurface); diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H index 9d8334714..be344c081 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H @@ -53,13 +53,13 @@ public: struct wl_list buffers; // to list of fl_wld_buffer's from this pool }; static const uint32_t wld_format; - void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, + void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy) FL_OVERRIDE; static struct wld_buffer *create_wld_buffer(int width, int height, bool with_shm = true); static void create_shm_buffer(wld_buffer *buffer); static void buffer_release(struct wld_window *window); static void buffer_commit(struct wld_window *window, struct flCairoRegion *r = NULL); - static void cairo_init(struct draw_buffer *buffer, int width, int height, int stride, + static void cairo_init(struct draw_buffer *buffer, int width, int height, int stride, cairo_format_t format); static struct draw_buffer *offscreen_buffer(Fl_Offscreen); static const cairo_user_data_key_t key; diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx index 556137582..81c09776e 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx @@ -62,7 +62,7 @@ void Fl_Wayland_Graphics_Driver::create_shm_buffer(Fl_Wayland_Graphics_Driver::w if (pool && !wl_list_empty(&pool_data->buffers)) { // last wld_buffer created from current pool struct wld_buffer *record = wl_container_of(pool_data->buffers.next, record, link); - chunk_offset = ((char*)record->data - pool_data->pool_memory) + + chunk_offset = ((char*)record->data - pool_data->pool_memory) + record->draw_buffer.data_size; } if (!pool || chunk_offset + buffer->draw_buffer.data_size > pool_size) { @@ -168,7 +168,7 @@ void Fl_Wayland_Graphics_Driver::buffer_commit(struct wld_window *window, struct cairo_surface_flush(surf); if (r) copy_region(window, r); else { - memcpy(window->buffer->data, window->buffer->draw_buffer.buffer, + memcpy(window->buffer->data, window->buffer->draw_buffer.buffer, window->buffer->draw_buffer.data_size); wl_surface_damage_buffer(window->wl_surface, 0, 0, 1000000, 1000000); } @@ -249,7 +249,7 @@ void Fl_Wayland_Graphics_Driver::buffer_release(struct wld_window *window) const uint32_t Fl_Wayland_Graphics_Driver::wld_format = WL_SHM_FORMAT_ARGB8888; -void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, +void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen src, int srcx, int srcy) { // draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of // the graphics driver's surface diff --git a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx index 691749cbf..087c3c49c 100644 --- a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx @@ -20,7 +20,7 @@ #include "Fl_Wayland_Image_Surface_Driver.H" -Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, +Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) { float d = 1; if (!off) { @@ -90,7 +90,7 @@ void Fl_Wayland_Image_Surface_Driver::untranslate() { Fl_RGB_Image* Fl_Wayland_Image_Surface_Driver::image() { // Convert depth-4 image in draw_buffer to a depth-3 image while exchanging R and B colors - struct Fl_Wayland_Graphics_Driver::draw_buffer *off_buf = + struct Fl_Wayland_Graphics_Driver::draw_buffer *off_buf = Fl_Wayland_Graphics_Driver::offscreen_buffer(offscreen); int height = off_buf->data_size / off_buf->stride; uchar *rgb = new uchar[off_buf->width * height * 3]; diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H index 5e53e7813..29756befe 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H @@ -146,7 +146,7 @@ public: int dnd(int unused) FL_OVERRIDE; int compose(int &del) FL_OVERRIDE; void compose_reset() FL_OVERRIDE; - Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, + Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool may_capture_subwins, bool *did_capture_subwins) FL_OVERRIDE; int get_mouse(int &x, int &y) FL_OVERRIDE; void open_display_platform() FL_OVERRIDE; @@ -169,7 +169,7 @@ public: int get_key(int k) FL_OVERRIDE; void enable_im() FL_OVERRIDE; void disable_im() FL_OVERRIDE; - + // overridden functions from parent class Fl_Unix_Screen_Driver int poll_or_select_with_delay(double time_to_wait) FL_OVERRIDE; int poll_or_select() FL_OVERRIDE; diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index ccab87688..01c799fad 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -82,7 +82,7 @@ struct pointer_output { static Fl_Int_Vector key_vector; // used by Fl_Wayland_Screen_Driver::event_key() -Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor = +Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::unspecified; @@ -111,7 +111,7 @@ extern const char *fl_bg2; // end of extern additions workaround -static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *seat, +static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *seat, struct wl_cursor *wl_cursor = NULL) { struct wl_cursor_image *image; struct wl_buffer *buffer; @@ -195,9 +195,9 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se Fl_Window *win = event_coords_from_surface(surface, surface_x, surface_y); if (!win) return; // use custom cursor if present - struct wl_cursor *cursor = + struct wl_cursor *cursor = fl_wl_xid(win)->custom_cursor ? fl_wl_xid(win)->custom_cursor->wl_cursor : NULL; - struct Fl_Wayland_Screen_Driver::seat *seat = + struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; do_set_cursor(seat, cursor); seat->serial = serial; @@ -249,7 +249,7 @@ static void pointer_button(void *data, uint32_t button, uint32_t state) { - struct Fl_Wayland_Screen_Driver::seat *seat = + struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; seat->serial = serial; int event = 0; @@ -257,7 +257,7 @@ static void pointer_button(void *data, if (!win) return; win = win->top_window(); wld_event_time = time; - if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED && + if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED && seat->pointer_focus == NULL && (fl_wl_xid(win))->kind == Fl_Wayland_Window_Driver::DECORATED) { // click on titlebar @@ -367,7 +367,7 @@ static void output_scale(void *data, struct wl_output *wl_output, int32_t factor static void cursor_surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output) { // Runs when the seat's cursor_surface enters a display - struct Fl_Wayland_Screen_Driver::seat *seat = + struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; struct pointer_output *pointer_output; @@ -375,12 +375,12 @@ static void cursor_surface_enter(void *data, return; pointer_output = (struct pointer_output *)calloc(1, sizeof(struct pointer_output)); - pointer_output->output = + pointer_output->output = (Fl_Wayland_Screen_Driver::output *)wl_output_get_user_data(wl_output); //fprintf(stderr, "cursor_surface_enter: wl_output_get_user_data(%p)=%p\n", wl_output, pointer_output->output); wl_list_insert(&seat->pointer_outputs, &pointer_output->link); try_update_cursor(seat); - Fl_Wayland_Screen_Driver::output *output = + Fl_Wayland_Screen_Driver::output *output = (Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output); output_scale(output, wl_output, output->wld_scale); // rescale custom cursors // maintain custom or standard window cursor @@ -457,7 +457,7 @@ static void init_cursors(struct Fl_Wayland_Screen_Driver::seat *seat) { static void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, uint32_t format, int32_t fd, uint32_t size) { - struct Fl_Wayland_Screen_Driver::seat *seat = + struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; assert(format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1); @@ -552,10 +552,10 @@ struct key_repeat_data_t { static void key_repeat_timer_cb(key_repeat_data_t *key_repeat_data) { - if ((Fl::event() == FL_KEYDOWN || (Fl_Window_Driver::menu_parent() && + if ((Fl::event() == FL_KEYDOWN || (Fl_Window_Driver::menu_parent() && Fl::event() == FL_ENTER)) && wld_event_time == key_repeat_data->time) { Fl::handle(FL_KEYDOWN, key_repeat_data->window); - Fl::add_timeout(KEY_REPEAT_INTERVAL, (Fl_Timeout_Handler)key_repeat_timer_cb, + Fl::add_timeout(KEY_REPEAT_INTERVAL, (Fl_Timeout_Handler)key_repeat_timer_cb, key_repeat_data); } else delete key_repeat_data; @@ -596,7 +596,7 @@ void Fl_Wayland_Screen_Driver::insertion_point_location(int x, int y, int height insertion_point_width = s*5; insertion_point_height = s*height; if (zwp_text_input_v3_get_user_data(scr_driver->seat->text_input) ) { - zwp_text_input_v3_set_cursor_rectangle(scr_driver->seat->text_input, + zwp_text_input_v3_set_cursor_rectangle(scr_driver->seat->text_input, insertion_point_x, insertion_point_y, insertion_point_width, insertion_point_height); zwp_text_input_v3_commit(scr_driver->seat->text_input); @@ -606,7 +606,7 @@ void Fl_Wayland_Screen_Driver::insertion_point_location(int x, int y, int height // computes window coordinates & size of insertion point -bool Fl_Wayland_Screen_Driver::insertion_point_location(int *px, int *py, +bool Fl_Wayland_Screen_Driver::insertion_point_location(int *px, int *py, int *pwidth, int *pheight) { // return true if the current coordinates and size of the insertion point are available if ( ! insertion_point_location_is_valid ) return false; @@ -733,19 +733,19 @@ fprintf(stderr, "key %s: sym: %-12s(%d) code:%u fl_win=%p, ", action, buf, sym, int event = (state == WL_KEYBOARD_KEY_STATE_PRESSED ? FL_KEYDOWN : FL_KEYUP); // Send event to focus-containing top window as defined by FLTK, // otherwise send it to Wayland-defined focus window - Fl_Window *win = ( Fl::focus() ? Fl::focus()->top_window() : + Fl_Window *win = ( Fl::focus() ? Fl::focus()->top_window() : Fl_Wayland_Window_Driver::surface_to_window(seat->keyboard_surface) ); if (win) { set_event_xy(win); Fl::e_is_click = 0; Fl::handle(event, win); } - if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING && + if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING && !(sym >= FL_Shift_L && sym <= FL_Alt_R)) { key_repeat_data_t *key_repeat_data = new key_repeat_data_t; key_repeat_data->time = time; key_repeat_data->window = win; - Fl::add_timeout(KEY_REPEAT_DELAY, (Fl_Timeout_Handler)key_repeat_timer_cb, + Fl::add_timeout(KEY_REPEAT_DELAY, (Fl_Timeout_Handler)key_repeat_timer_cb, key_repeat_data); } } @@ -769,10 +769,10 @@ static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t group) { struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; - xkb_state_update_mask(seat->xkb_state, mods_depressed, mods_latched, mods_locked, + xkb_state_update_mask(seat->xkb_state, mods_depressed, mods_latched, mods_locked, 0, 0, group); Fl::e_state &= ~(FL_SHIFT+FL_CTRL+FL_ALT+FL_CAPS_LOCK+FL_NUM_LOCK); - if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_SHIFT, + if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_DEPRESSED)) Fl::e_state |= FL_SHIFT; if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_DEPRESSED)) Fl::e_state |= FL_CTRL; @@ -857,7 +857,7 @@ void text_input_commit_string(void *data, struct zwp_text_input_v3 *zwp_text_inp } -void text_input_delete_surrounding_text(void *data, +void text_input_delete_surrounding_text(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t before_length, uint32_t after_length) { fprintf(stderr, "delete_surrounding_text before=%d adfter=%d\n", @@ -883,7 +883,7 @@ static const struct zwp_text_input_v3_listener text_input_listener = { void Fl_Wayland_Screen_Driver::enable_im() { if (text_input_base && !seat->text_input) { - seat->text_input = zwp_text_input_manager_v3_get_text_input(text_input_base, + seat->text_input = zwp_text_input_manager_v3_get_text_input(text_input_base, seat->wl_seat); //printf("seat->text_input=%p\n",seat->text_input); zwp_text_input_v3_add_listener(seat->text_input, &text_input_listener, NULL); @@ -903,7 +903,7 @@ void Fl_Wayland_Screen_Driver::disable_im() { static void seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities) { - struct Fl_Wayland_Screen_Driver::seat *seat = + struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; if ((capabilities & WL_SEAT_CAPABILITY_POINTER) && !seat->wl_pointer) { seat->wl_pointer = wl_seat_get_pointer(wl_seat); @@ -1057,15 +1057,15 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis } else if (strcmp(interface, "wl_seat") == 0) { if (version < 2) { - Fl::fatal("%s version 2 required but only version %i is available\n", + Fl::fatal("%s version 2 required but only version %i is available\n", interface, version); } - if (!scr_driver->seat) scr_driver->seat = + if (!scr_driver->seat) scr_driver->seat = (struct Fl_Wayland_Screen_Driver::seat*)calloc(1, sizeof(struct Fl_Wayland_Screen_Driver::seat)); //fprintf(stderr, "registry_handle_global: seat=%p\n", scr_driver->seat); wl_list_init(&scr_driver->seat->pointer_outputs); - scr_driver->seat->wl_seat = (wl_seat*)wl_registry_bind(wl_registry, id, + scr_driver->seat->wl_seat = (wl_seat*)wl_registry_bind(wl_registry, id, &wl_seat_interface, 2); scr_driver->seat->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (scr_driver->seat->xkb_context) { @@ -1076,7 +1076,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis locale = getenv("LANG"); if (!locale || !*locale) locale = "C"; - struct xkb_compose_table *table = + struct xkb_compose_table *table = xkb_compose_table_new_from_locale(scr_driver->seat->xkb_context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); if (table) { @@ -1086,36 +1086,36 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis } wl_seat_add_listener(scr_driver->seat->wl_seat, &seat_listener, scr_driver->seat); if (scr_driver->seat->data_device_manager) { - scr_driver->seat->data_device = + scr_driver->seat->data_device = wl_data_device_manager_get_data_device(scr_driver->seat->data_device_manager, scr_driver->seat->wl_seat); - wl_data_device_add_listener(scr_driver->seat->data_device, + wl_data_device_add_listener(scr_driver->seat->data_device, Fl_Wayland_Screen_Driver::p_data_device_listener, NULL); } } else if (strcmp(interface, wl_data_device_manager_interface.name) == 0) { - if (!scr_driver->seat) scr_driver->seat = + if (!scr_driver->seat) scr_driver->seat = (struct Fl_Wayland_Screen_Driver::seat*)calloc(1, sizeof(struct Fl_Wayland_Screen_Driver::seat)); - scr_driver->seat->data_device_manager = + scr_driver->seat->data_device_manager = (struct wl_data_device_manager*)wl_registry_bind(wl_registry, id, &wl_data_device_manager_interface, fl_min(version, 3)); if (scr_driver->seat->wl_seat) { - scr_driver->seat->data_device = + scr_driver->seat->data_device = wl_data_device_manager_get_data_device(scr_driver->seat->data_device_manager, scr_driver->seat->wl_seat); - wl_data_device_add_listener(scr_driver->seat->data_device, + wl_data_device_add_listener(scr_driver->seat->data_device, Fl_Wayland_Screen_Driver::p_data_device_listener, NULL); } //fprintf(stderr, "registry_handle_global: %s\n", interface); } else if (strcmp(interface, "wl_output") == 0) { if (version < 2) { - Fl::fatal("%s version 2 required but only version %i is available\n", + Fl::fatal("%s version 2 required but only version %i is available\n", interface, version); } - Fl_Wayland_Screen_Driver::output *output = + Fl_Wayland_Screen_Driver::output *output = (Fl_Wayland_Screen_Driver::output*)calloc(1, sizeof *output); output->id = id; output->wld_scale = 1; @@ -1130,7 +1130,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis } else if (strcmp(interface, xdg_wm_base_interface.name) == 0) { //fprintf(stderr, "registry_handle_global interface=%s\n", interface); - scr_driver->xdg_wm_base = (struct xdg_wm_base *)wl_registry_bind(wl_registry, id, + scr_driver->xdg_wm_base = (struct xdg_wm_base *)wl_registry_bind(wl_registry, id, &xdg_wm_base_interface, 1); xdg_wm_base_add_listener(scr_driver->xdg_wm_base, &xdg_wm_base_listener, NULL); } else if (strcmp(interface, "gtk_shell1") == 0) { @@ -1146,7 +1146,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::OWL; //fprintf(stderr, "Running the Owl compositor\n"); if (wl_list_length(&scr_driver->outputs) == 0) { - Fl_Wayland_Screen_Driver::output *output = + Fl_Wayland_Screen_Driver::output *output = (Fl_Wayland_Screen_Driver::output*)calloc(1, sizeof *output); output->id = 1; output->wld_scale = 1; @@ -1157,7 +1157,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis scr_driver->screen_count_set(1); } } else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 0) { - scr_driver->text_input_base = (struct zwp_text_input_manager_v3 *) + scr_driver->text_input_base = (struct zwp_text_input_manager_v3 *) wl_registry_bind(wl_registry, id, &zwp_text_input_manager_v3_interface, 1); //printf("scr_driver->text_input_base=%p version=%d\n",scr_driver->text_input_base,version); } @@ -1322,7 +1322,7 @@ void Fl_Wayland_Screen_Driver::close_display() { seat->data_source = NULL; } wl_data_device_destroy(seat->data_device); seat->data_device = NULL; - wl_data_device_manager_destroy(seat->data_device_manager); + wl_data_device_manager_destroy(seat->data_device_manager); seat->data_device_manager = NULL; wl_seat_destroy(seat->wl_seat); seat->wl_seat = NULL; if (seat->name) free(seat->name); @@ -1503,7 +1503,7 @@ static void set_selection_color(uchar r, uchar g, uchar b) } -static void getsyscolor(const char *key1, const char* key2, const char *arg, +static void getsyscolor(const char *key1, const char* key2, const char *arg, const char *defarg, void (*func)(uchar,uchar,uchar)) { uchar r, g, b; if (!arg) arg = defarg; @@ -1530,7 +1530,7 @@ void Fl_Wayland_Screen_Driver::get_system_colors() } -Fl_RGB_Image *Fl_Wayland_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, +Fl_RGB_Image *Fl_Wayland_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool ignore, bool *p_ignore) { struct wld_window* xid = win ? fl_wl_xid(win) : NULL; @@ -1709,7 +1709,7 @@ void *Fl_Wayland_Screen_Driver::control_maximize_button(void *data) { Fl_Window *win = Fl::first_window(); while (win) { if (!win->parent() && win->border() && - !( ((struct wld_window*)Fl_X::flx(win)->xid)->state & + !( ((struct wld_window*)Fl_X::flx(win)->xid)->state & LIBDECOR_WINDOW_STATE_MAXIMIZED) ) { win_dims *dim = new win_dims; dim->tracker = new Fl_Widget_Tracker(win); diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H index 03c0a41d3..b758b658e 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H @@ -124,9 +124,9 @@ public: int set_cursor_4args(const Fl_RGB_Image*, int, int, bool); void shape(const Fl_Image* img) FL_OVERRIDE; - void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, + void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) FL_OVERRIDE; - int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, + int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data) FL_OVERRIDE; void wait_for_expose() FL_OVERRIDE; // menu-related stuff diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index a15fc4f80..757de2fb8 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -161,7 +161,7 @@ void Fl_Wayland_Window_Driver::take_focus() struct wld_window *first_xid = (old_first ? fl_wl_xid(old_first->top_window()) : NULL); if (first_xid && first_xid != w && xdg_toplevel()) { // this will move the target window to the front - Fl_Wayland_Window_Driver *top_dr = + Fl_Wayland_Window_Driver *top_dr = Fl_Wayland_Window_Driver::driver(old_first->top_window()); xdg_toplevel_set_parent(xdg_toplevel(), top_dr->xdg_toplevel()); // this will remove the parent-child relationship @@ -245,7 +245,7 @@ void Fl_Wayland_Window_Driver::shape_alpha_(Fl_Image* img, int offset) { alpha += d; // point to alpha value of next img pixel } } - cairo_surface_t *mask_surf = cairo_image_surface_create_for_data(bits, CAIRO_FORMAT_A1, + cairo_surface_t *mask_surf = cairo_image_surface_create_for_data(bits, CAIRO_FORMAT_A1, w, h, bytesperrow); shape_data_->mask_pattern_ = cairo_pattern_create_for_surface(mask_surf); cairo_surface_destroy(mask_surf); @@ -303,7 +303,7 @@ void Fl_Wayland_Window_Driver::draw_end() Returned images can be deleted after use. Their depth and size may be platform-dependent. The top and bottom images extend from left of the left border to right of the right border. */ -void Fl_Wayland_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, +void Fl_Wayland_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) { top = left = bottom = right = NULL; @@ -494,7 +494,7 @@ void Fl_Wayland_Window_Driver::map() { struct wld_window *parent = fl_wl_xid(pWindow->window()); if (parent) { Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); - wl_win->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor, + wl_win->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor, wl_win->wl_surface, parent->wl_surface); float f = Fl::screen_scale(pWindow->top_window()->screen_num()); wl_subsurface_set_position(wl_win->subsurface, pWindow->x() * f, pWindow->y() * f); @@ -566,7 +566,7 @@ void Fl_Wayland_Window_Driver::iconize() { } -void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom) +void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom) { struct wld_window *xid = (struct wld_window*)fl_xid(pWindow); if (xid && xid->kind == DECORATED) { @@ -579,7 +579,7 @@ void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right } -int Fl_Wayland_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, +int Fl_Wayland_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data) { @@ -678,7 +678,7 @@ static void surface_enter(void *data, struct wl_surface *wl_surface, if (!Fl_Wayland_Screen_Driver::own_output(wl_output)) return; - Fl_Wayland_Screen_Driver::output *output = + Fl_Wayland_Screen_Driver::output *output = (Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output); if (output == NULL) return; @@ -706,7 +706,7 @@ static void surface_leave(void *data, struct wl_surface *wl_surface, if (!Fl_Wayland_Screen_Driver::own_output(wl_output)) return; struct wld_window *window = (struct wld_window*)data; - Fl_Wayland_Screen_Driver::output *output = + Fl_Wayland_Screen_Driver::output *output = (Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output); Fl_Wayland_Window_Driver *win_driver = Fl_Wayland_Window_Driver::driver(window->fl_win); float pre_scale = Fl::screen_scale(win_driver->screen_num()) * win_driver->wld_scale(); @@ -832,13 +832,13 @@ static void handle_configure(struct libdecor_frame *frame, // true exactly for the 2nd run of handle_configure() for this window bool is_2nd_run = (window->xdg_surface != 0 && driver->wait_for_expose_value); float f = Fl::screen_scale(window->fl_win->screen_num()); - + if (!window->xdg_surface) window->xdg_surface = libdecor_frame_get_xdg_surface(frame); - + #ifdef LIBDECOR_MR131 if (is_1st_run) use_FLTK_toplevel_configure_cb(frame); #endif - + struct wl_output *wl_output = NULL; if (window->fl_win->fullscreen_active()) { if (!(window->state & LIBDECOR_WINDOW_STATE_FULLSCREEN)) { @@ -861,7 +861,7 @@ static void handle_configure(struct libdecor_frame *frame, window->fl_win->redraw(); } window->state = window_state; - + // Weston, KWin, and some versions of Mutter, on purpose, don't set the // window width x height when xdg_toplevel_configure runs twice // during resizable window creation @@ -885,7 +885,7 @@ static void handle_configure(struct libdecor_frame *frame, Fl::screen_xywh(X, Y, W, H, window->fl_win->screen_num()); width = W * f; height = H * f; } - + if (width == 0) { width = window->floating_width; height = window->floating_height; @@ -941,7 +941,7 @@ static void handle_configure(struct libdecor_frame *frame, if (Fl_Wayland_Screen_Driver::compositor != Fl_Wayland_Screen_Driver::WESTON || !is_1st_run) { window->fl_win->clear_damage(); } - + if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::OWL) { Fl_Window *sub = Fl::first_window(); while (sub) { // search still un-exposed sub-windows @@ -962,7 +962,7 @@ void Fl_Wayland_Window_Driver::wait_for_expose() if (!xid) return; if (pWindow->fullscreen_active()) { if (xid->kind == DECORATED) { - while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) || + while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) || !(xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) { wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display); } @@ -1027,7 +1027,7 @@ static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, u xdg_surface_ack_configure(xdg_surface, serial); //fprintf(stderr, "xdg_surface_configure: surface=%p\n", window->wl_surface); - if (window->fl_win->w() != window->configured_width || + if (window->fl_win->w() != window->configured_width || window->fl_win->h() != window->configured_height) { if (window->buffer) { Fl_Wayland_Graphics_Driver::buffer_release(window); @@ -1068,7 +1068,7 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel if (window->fl_win->fullscreen_active() && !parse_states_fullscreen(states)) { struct wl_output *wl_output = NULL; if (Fl_Window_Driver::driver(window->fl_win)->force_position()) { - struct Fl_Wayland_Screen_Driver::output *output = + struct Fl_Wayland_Screen_Driver::output *output = screen_num_to_output(window->fl_win->screen_num()); if (output) wl_output = output->wl_output; } @@ -1087,7 +1087,7 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel height = window->fl_win->h() * f; } window->fl_win->size(ceil(width / f), ceil(height / f)); - if (window->buffer && (ceil(width / f) != window->configured_width || + if (window->buffer && (ceil(width / f) != window->configured_width || ceil(height / f) != window->configured_height)) { Fl_Wayland_Graphics_Driver::buffer_release(window); } @@ -1114,7 +1114,7 @@ struct win_positioner { }; -static void popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x, int32_t y, +static void popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x, int32_t y, int32_t width, int32_t height) { struct win_positioner *win_pos = (struct win_positioner *)data; struct wld_window *window = win_pos->window; @@ -1263,14 +1263,14 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi previous_floatingtitle = pWindow; return true; } - new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, + new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, new_window->wl_surface); xdg_surface_add_listener(new_window->xdg_surface, &xdg_surface_listener, new_window); Fl_Wayland_Window_Driver::new_popup = true; Fl_Window *menu_origin = NULL; if (pWindow->menu_window()) { menu_origin = Fl_Window_Driver::menu_leftorigin(pWindow); - if (!menu_origin && !previous_floatingtitle) menu_origin = + if (!menu_origin && !previous_floatingtitle) menu_origin = Fl_Window_Driver::menu_title(pWindow); } Fl_Widget *target = (pWindow->tooltip_window() ? Fl_Tooltip::current() : NULL); @@ -1289,7 +1289,7 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi //xdg_positioner_get_version(positioner) <== gives 1 under Debian and Sway int popup_x, popup_y; if (Fl_Window_Driver::menu_title(pWindow) && Fl_Window_Driver::menu_bartitle(pWindow)) { - xdg_positioner_set_anchor_rect(positioner, 0, 0, + xdg_positioner_set_anchor_rect(positioner, 0, 0, Fl_Window_Driver::menu_title(pWindow)->w() * f, Fl_Window_Driver::menu_title(pWindow)->h() * f); popup_x = 0; @@ -1302,13 +1302,13 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi popup_y -= menu_origin->y() * f; } if (popup_x >= origin_win->w() * f) popup_x = origin_win->w() * f - 1; - if (!Fl_Window_Driver::menu_title(pWindow) && !Fl_Window_Driver::menu_bartitle(pWindow) && + if (!Fl_Window_Driver::menu_title(pWindow) && !Fl_Window_Driver::menu_bartitle(pWindow) && !Fl_Window_Driver::menu_leftorigin(pWindow)) { // prevent first popup from going above the permissible source window popup_y = fl_max(popup_y, - pWindow->h() * f); } if (parent_xid->kind == Fl_Wayland_Window_Driver::DECORATED) - libdecor_frame_translate_coordinate(parent_xid->frame, popup_x, popup_y, + libdecor_frame_translate_coordinate(parent_xid->frame, popup_x, popup_y, &popup_x, &popup_y); xdg_positioner_set_anchor_rect(positioner, popup_x, 0, 1, 1); popup_y++; @@ -1326,7 +1326,7 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi if (!(Fl_Window_Driver::menu_title(pWindow) && Fl_Window_Driver::menu_bartitle(pWindow))) { xdg_positioner_set_offset(positioner, 0, popup_y); } - new_window->xdg_popup = xdg_surface_get_popup(new_window->xdg_surface, + new_window->xdg_popup = xdg_surface_get_popup(new_window->xdg_surface, parent_xdg, positioner); struct win_positioner *win_pos = new struct win_positioner; win_pos->window = new_window; @@ -1365,7 +1365,7 @@ void Fl_Wayland_Window_Driver::makeWindow() new_window->wl_surface = wl_compositor_create_surface(scr_driver->wl_compositor); //Fl::warning("makeWindow:%p wayland-scale=%d user-scale=%.2f\n", pWindow, new_window->scale, Fl::screen_scale(0)); wl_surface_add_listener(new_window->wl_surface, &surface_listener, new_window); - + if (!shape()) { // rectangular FLTK windows are opaque struct wl_region *opaque = wl_compositor_create_region(scr_driver->wl_compositor); wl_region_add(opaque, 0, 0, 1000000, 1000000); @@ -1373,7 +1373,7 @@ void Fl_Wayland_Window_Driver::makeWindow() wl_region_destroy(opaque); } - if (pWindow->user_data() == &Fl_Screen_Driver::transient_scale_display && + if (pWindow->user_data() == &Fl_Screen_Driver::transient_scale_display && Fl::first_window()) { // put transient scale win at center of top window by making it a child of top int center_x, center_y; @@ -1390,7 +1390,7 @@ void Fl_Wayland_Window_Driver::makeWindow() } else if (pWindow->border() && !pWindow->parent() ) { // a decorated window new_window->kind = DECORATED; if (!scr_driver->libdecor_context) - scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, + scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, &libdecor_iface); new_window->frame = libdecor_decorate(scr_driver->libdecor_context, new_window->wl_surface, &libdecor_frame_iface, new_window); @@ -1409,7 +1409,7 @@ void Fl_Wayland_Window_Driver::makeWindow() } else if (pWindow->parent()) { // for subwindows (GL or non-GL) new_window->kind = SUBWINDOW; struct wld_window *parent = fl_wl_xid(pWindow->window()); - new_window->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor, + new_window->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor, new_window->wl_surface, parent->wl_surface); //fprintf(stderr, "makeWindow: subsurface=%p\n", new_window->subsurface); @@ -1417,7 +1417,7 @@ void Fl_Wayland_Window_Driver::makeWindow() wl_subsurface_set_position(new_window->subsurface, pWindow->x() * f, pWindow->y() * f); wl_subsurface_set_desync(new_window->subsurface); // important // next 3 statements ensure the subsurface will be mapped because: - // "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied + // "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied // and the parent surface is mapped." new_window->configured_width = pWindow->w(); new_window->configured_height = pWindow->h(); @@ -1431,7 +1431,7 @@ void Fl_Wayland_Window_Driver::makeWindow() } else { // a window without decoration new_window->kind = UNFRAMED; - new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, + new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, new_window->wl_surface); //fprintf(stderr, "makeWindow: xdg_wm_base_get_xdg_surface=%p\n", new_window->xdg_surface); xdg_surface_add_listener(new_window->xdg_surface, &xdg_surface_listener, new_window); @@ -1499,18 +1499,18 @@ void Fl_Wayland_Window_Driver::makeWindow() struct wld_window *xid = fl_wl_xid(previous_floatingtitle); xid->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, xid->wl_surface); xdg_surface_add_listener(xid->xdg_surface, &xdg_surface_listener, xid); - struct xdg_positioner *positioner = + struct xdg_positioner *positioner = xdg_wm_base_create_positioner(scr_driver->xdg_wm_base); xdg_positioner_set_anchor_rect(positioner, 0, 0, 1, 1); int snum = Fl_Window_Driver::menu_parent()->screen_num(); float f = Fl::screen_scale(snum); // put it on same screen as parent menu Fl_Window_Driver::driver(previous_floatingtitle)->screen_num(snum); - xdg_positioner_set_size(positioner, previous_floatingtitle->w() * f , + xdg_positioner_set_size(positioner, previous_floatingtitle->w() * f , previous_floatingtitle->h() * f ); xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT); xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_TOP_RIGHT); - xid->xdg_popup = xdg_surface_get_popup(xid->xdg_surface, new_window->xdg_surface, + xid->xdg_popup = xdg_surface_get_popup(xid->xdg_surface, new_window->xdg_surface, positioner); xdg_positioner_destroy(positioner); struct win_positioner *win_pos = new struct win_positioner; @@ -1553,7 +1553,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { scr_driver->default_cursor(scr_driver->xc_arrow); break; case FL_CURSOR_NS: - if (!scr_driver->xc_ns) scr_driver->xc_ns = + if (!scr_driver->xc_ns) scr_driver->xc_ns = scr_driver->cache_cursor("sb_v_double_arrow"); if (!scr_driver->xc_ns) return 0; scr_driver->default_cursor(scr_driver->xc_ns); @@ -1591,7 +1591,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { scr_driver->default_cursor(scr_driver->xc_move); break; case FL_CURSOR_WE: - if (!scr_driver->xc_we) scr_driver->xc_we = + if (!scr_driver->xc_we) scr_driver->xc_we = scr_driver->cache_cursor("sb_h_double_arrow"); if (!scr_driver->xc_we) return 0; scr_driver->default_cursor(scr_driver->xc_we); @@ -1612,31 +1612,31 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { scr_driver->default_cursor(scr_driver->xc_west); break; case FL_CURSOR_S: - if (!scr_driver->xc_south) scr_driver->xc_south = + if (!scr_driver->xc_south) scr_driver->xc_south = scr_driver->cache_cursor("bottom_side"); if (!scr_driver->xc_south) return 0; scr_driver->default_cursor(scr_driver->xc_south); break; case FL_CURSOR_NESW: - if (!scr_driver->xc_nesw) scr_driver->xc_nesw = + if (!scr_driver->xc_nesw) scr_driver->xc_nesw = scr_driver->cache_cursor("fd_double_arrow"); if (!scr_driver->xc_nesw) return 0; scr_driver->default_cursor(scr_driver->xc_nesw); break; case FL_CURSOR_NWSE: - if (!scr_driver->xc_nwse) scr_driver->xc_nwse = + if (!scr_driver->xc_nwse) scr_driver->xc_nwse = scr_driver->cache_cursor("bd_double_arrow"); if (!scr_driver->xc_nwse) return 0; scr_driver->default_cursor(scr_driver->xc_nwse); break; case FL_CURSOR_SW: - if (!scr_driver->xc_sw) scr_driver->xc_sw = + if (!scr_driver->xc_sw) scr_driver->xc_sw = scr_driver->cache_cursor("bottom_left_corner"); if (!scr_driver->xc_sw) return 0; scr_driver->default_cursor(scr_driver->xc_sw); break; case FL_CURSOR_SE: - if (!scr_driver->xc_se) scr_driver->xc_se = + if (!scr_driver->xc_se) scr_driver->xc_se = scr_driver->cache_cursor("bottom_right_corner"); if (!scr_driver->xc_se) return 0; scr_driver->default_cursor(scr_driver->xc_se); @@ -1740,7 +1740,7 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx // build a new wl_cursor and its image struct wld_window *xid = (struct wld_window *)Fl_Window_Driver::xid(pWindow); struct wl_cursor *new_cursor = (struct wl_cursor*)malloc(sizeof(struct wl_cursor)); - struct cursor_image *new_image = (struct cursor_image*)calloc(1, + struct cursor_image *new_image = (struct cursor_image*)calloc(1, sizeof(struct cursor_image)); int scale = wld_scale(); new_image->image.width = rgb->w() * scale; @@ -1767,7 +1767,7 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx Fl_Surface_Device::pop_current(); delete img_surf; memcpy(offscreen->data, offscreen->draw_buffer.buffer, offscreen->draw_buffer.data_size); - // delete the previous custom cursor, if there was one, + // delete the previous custom cursor, if there was one, // and keep its Fl_RGB_Image if appropriate delete_cursor_(xid, keep_copy); //have this new cursor used @@ -1828,7 +1828,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) { x(X); y(Y); //fprintf(stderr, "move menuwin=%p x()=%d\n", pWindow, X); } else { - //"a deliberate design trait of Wayland makes application windows ignorant of + //"a deliberate design trait of Wayland makes application windows ignorant of // their exact placement on screen" x(0); y(0); } @@ -1906,7 +1906,7 @@ static void crect_intersect(cairo_rectangle_int_t *to, cairo_rectangle_int_t *wi static bool crect_equal(cairo_rectangle_int_t *to, cairo_rectangle_int_t *with) { - return (to->x == with->x && to->y == with->y && to->width == with->width && + return (to->x == with->x && to->y == with->y && to->width == with->width && to->height == with->height); } @@ -1963,7 +1963,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) { *Fl_Window_Driver::menu_offset_y(pWindow) += (y - pWindow->y()); struct wld_window *xid = fl_wl_xid(pWindow); wl_surface_set_opaque_region(xid->wl_surface, NULL); - if (xid->buffer) memset(xid->buffer->draw_buffer.buffer, 0, + if (xid->buffer) memset(xid->buffer->draw_buffer.buffer, 0, xid->buffer->draw_buffer.data_size); //printf("offset_y=%d\n", *Fl_Window_Driver::menu_offset_y(pWindow)); this->y(y); @@ -1988,7 +1988,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) { Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); xid_menu->wl_surface = wl_compositor_create_surface(scr_driver->wl_compositor); wl_surface_add_listener(xid_menu->wl_surface, &surface_listener, xid_menu); - xid_menu->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, + xid_menu->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, xid_menu->wl_surface); xdg_surface_add_listener(xid_menu->xdg_surface, &xdg_surface_listener, xid_menu); struct xdg_positioner *positioner = xdg_wm_base_create_positioner(scr_driver->xdg_wm_base); @@ -2008,10 +2008,10 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) { xdg_positioner_set_size(positioner, pWindow->w() * f , pWindow->h() * f ); xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT); xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT); - xdg_positioner_set_constraint_adjustment(positioner, + xdg_positioner_set_constraint_adjustment(positioner, XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X); xdg_positioner_set_offset(positioner, 0, popup_y); - xid_menu->xdg_popup = xdg_surface_get_popup(xid_menu->xdg_surface, parent_xid->xdg_surface, + xid_menu->xdg_popup = xdg_surface_get_popup(xid_menu->xdg_surface, parent_xid->xdg_surface, positioner); xdg_positioner_destroy(positioner); struct win_positioner *win_pos = new struct win_positioner; @@ -2023,7 +2023,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) { wl_surface_commit(xid_menu->wl_surface); wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display); // necessary with sway // delete the previous popup - struct win_positioner *old_win_pos = + struct win_positioner *old_win_pos = (struct win_positioner*)xdg_popup_get_user_data(old_popup); xdg_popup_destroy(old_popup); delete old_win_pos; diff --git a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx index 3b432f800..beaacb908 100644 --- a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx +++ b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx @@ -75,7 +75,7 @@ void write_data_source_cb(FL_SOCKET fd, data_source_write_struct *data) { } -static void data_source_handle_send(void *data, struct wl_data_source *source, +static void data_source_handle_send(void *data, struct wl_data_source *source, const char *mime_type, int fd) { fl_intptr_t rank = (fl_intptr_t)data; //fprintf(stderr, "data_source_handle_send: %s fd=%d l=%d\n", mime_type, fd, fl_selection_length[1]); @@ -149,7 +149,7 @@ static void data_source_handle_target(void *data, struct wl_data_source *source, static uint32_t last_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; -static void data_source_handle_action(void *data, struct wl_data_source *source, +static void data_source_handle_action(void *data, struct wl_data_source *source, uint32_t dnd_action) { last_dnd_action = dnd_action; switch (dnd_action) { @@ -190,7 +190,7 @@ static const struct wl_data_source_listener data_source_listener = { }; -static struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen_from_text(const char *text, +static struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen_from_text(const char *text, int scale) { const char *p, *q; int width = 0, height, w2, ltext = strlen(text); @@ -260,7 +260,7 @@ int Fl_Wayland_Screen_Driver::dnd(int use_selection) { } else dnd_icon = NULL; doing_dnd = true; wl_data_device_start_drag(scr_driver->seat->data_device, source, - scr_driver->seat->pointer_focus, dnd_icon, + scr_driver->seat->pointer_focus, dnd_icon, scr_driver->seat->serial); if (use_selection) { wl_surface_attach(dnd_icon, off->wl_buffer, 0, 0); @@ -280,7 +280,7 @@ int Fl_Wayland_Screen_Driver::dnd(int use_selection) { } -static void data_offer_handle_offer(void *data, struct wl_data_offer *offer, +static void data_offer_handle_offer(void *data, struct wl_data_offer *offer, const char *mime_type) { // runs when app becomes active and lists possible clipboard types //fprintf(stderr, "Clipboard offer=%p supports MIME type: %s\n", offer, mime_type); @@ -301,7 +301,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer, } -static void data_offer_handle_source_actions(void *data, struct wl_data_offer *offer, +static void data_offer_handle_source_actions(void *data, struct wl_data_offer *offer, uint32_t actions) { if (actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) { //printf("Drag supports the copy action\n"); @@ -309,7 +309,7 @@ static void data_offer_handle_source_actions(void *data, struct wl_data_offer *o } -static void data_offer_handle_action(void *data, struct wl_data_offer *offer, +static void data_offer_handle_action(void *data, struct wl_data_offer *offer, uint32_t dnd_action) { switch (dnd_action) { case WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE: @@ -332,7 +332,7 @@ static const struct wl_data_offer_listener data_offer_listener = { }; -static void data_device_handle_data_offer(void *data, struct wl_data_device *data_device, +static void data_device_handle_data_offer(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer) { // An application has created a new data source //fprintf(stderr, "data_device_handle_data_offer offer=%p\n", offer); @@ -342,7 +342,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *dat } -static void data_device_handle_selection(void *data, struct wl_data_device *data_device, +static void data_device_handle_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer) { // An application has set the clipboard contents. W //fprintf(stderr, "data_device_handle_selection\n"); @@ -432,7 +432,7 @@ static struct wl_data_offer *current_drag_offer = NULL; static uint32_t fl_dnd_serial; -static void data_device_handle_enter(void *data, struct wl_data_device *data_device, +static void data_device_handle_enter(void *data, struct wl_data_device *data_device, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer) { @@ -461,7 +461,7 @@ static void data_device_handle_enter(void *data, struct wl_data_device *data_dev } -static void data_device_handle_motion(void *data, struct wl_data_device *data_device, +static void data_device_handle_motion(void *data, struct wl_data_device *data_device, uint32_t time, wl_fixed_t x, wl_fixed_t y) { if (!current_drag_offer) return; //printf("data_device_handle_motion fl_dnd_target_window=%p\n", fl_dnd_target_window); @@ -536,7 +536,7 @@ static const struct wl_data_device_listener data_device_listener = { }; -const struct wl_data_device_listener *Fl_Wayland_Screen_Driver::p_data_device_listener = +const struct wl_data_device_listener *Fl_Wayland_Screen_Driver::p_data_device_listener = &data_device_listener; @@ -570,7 +570,7 @@ static int get_clipboard_image() { int ld = shared->ld() ? shared->ld() : shared->w() * shared->d(); uchar *rgb = new uchar[shared->w() * shared->h() * shared->d()]; memcpy(rgb, shared->data()[0], ld * shared->h() ); - Fl_RGB_Image *image = new Fl_RGB_Image(rgb, shared->w(), shared->h(), shared->d(), + Fl_RGB_Image *image = new Fl_RGB_Image(rgb, shared->w(), shared->h(), shared->d(), shared->ld()); shared->release(); image->alloc_array = 1; @@ -650,7 +650,7 @@ void Fl_Wayland_Screen_Driver::paste(Fl_Widget &receiver, int clipboard, const c } -void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard, +void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard, const char *type) { if (!stuff || len < 0) return; @@ -669,13 +669,13 @@ void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard, fl_selection_type[clipboard] = Fl::clipboard_plain_text; if (clipboard == 1) { Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); - scr_driver->seat->data_source = + scr_driver->seat->data_source = wl_data_device_manager_create_data_source(scr_driver->seat->data_device_manager); // we transmit the adequate value of index in fl_selection_buffer[index] - wl_data_source_add_listener(scr_driver->seat->data_source, &data_source_listener, + wl_data_source_add_listener(scr_driver->seat->data_source, &data_source_listener, (void*)1); wl_data_source_offer(scr_driver->seat->data_source, wld_plain_text_clipboard); - wl_data_device_set_selection(scr_driver->seat->data_device, scr_driver->seat->data_source, + wl_data_device_set_selection(scr_driver->seat->data_device, scr_driver->seat->data_source, scr_driver->seat->keyboard_enter_serial); //fprintf(stderr, "wl_data_device_set_selection len=%d to %d\n", len, clipboard); } @@ -686,7 +686,7 @@ void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard, void Fl_Wayland_Screen_Driver::copy_image(const unsigned char *data, int W, int H){ if (!data || W <= 0 || H <= 0) return; delete[] fl_selection_buffer[1]; - fl_selection_buffer[1] = + fl_selection_buffer[1] = (char *)Fl_Unix_System_Driver::create_bmp(data,W,H,&fl_selection_length[1]); fl_selection_buffer_length[1] = fl_selection_length[1]; fl_i_own_selection[1] = 1; @@ -695,7 +695,7 @@ void Fl_Wayland_Screen_Driver::copy_image(const unsigned char *data, int W, int // we transmit the adequate value of index in fl_selection_buffer[index] wl_data_source_add_listener(seat->data_source, &data_source_listener, (void*)1); wl_data_source_offer(seat->data_source, "image/bmp"); - wl_data_device_set_selection(seat->data_device, seat->data_source, + wl_data_device_set_selection(seat->data_device, seat->data_source, seat->keyboard_enter_serial); //fprintf(stderr, "copy_image: len=%d\n", fl_selection_length[1]); } |
