From c2c77956145e7cacb9a3c18ca019ff316f56fa03 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 5 Mar 2022 12:28:21 +0100 Subject: [PATCH] Rename Fl_wayland.cxx to fl_wayland_clipboard_dnd.cxx --- src/CMakeLists.txt | 2 +- src/Makefile | 2 +- .../Wayland/Fl_Wayland_Screen_Driver.H | 6 ++-- .../Wayland/Fl_Wayland_Screen_Driver.cxx | 17 +++++++++++ ...yland.cxx => fl_wayland_clipboard_dnd.cxx} | 28 ++----------------- 5 files changed, 24 insertions(+), 31 deletions(-) rename src/drivers/Wayland/{Fl_wayland.cxx => fl_wayland_clipboard_dnd.cxx} (97%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d3e05be4..7d3b9a59d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -254,7 +254,7 @@ elseif (OPTION_USE_WAYLAND) drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx - drivers/Wayland/Fl_wayland.cxx + drivers/Wayland/fl_wayland_clipboard_dnd.cxx drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx Fl_Native_File_Chooser_FLTK.cxx Fl_Native_File_Chooser_GTK.cxx diff --git a/src/Makefile b/src/Makefile index 457aa4b59..dab3f75bb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -289,7 +289,7 @@ WLCPPFILES = \ drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx \ drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx \ drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx \ - drivers/Wayland/Fl_wayland.cxx + drivers/Wayland/fl_wayland_clipboard_dnd.cxx # fl_dnd_x.cxx Fl_Native_File_Chooser_GTK.cxx diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H index ce10884c5..0ce25734f 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H @@ -150,11 +150,11 @@ public: virtual int has_marked_text() const; static int next_marked_length; // next length of marked text after current marked text will have been replaced // --- clipboard operations - // this one is in Fl_wayland.cxx + // this one is in fl_wayland_clipboard_dnd.cxx virtual void copy(const char *stuff, int len, int clipboard, const char *type); - // this one is in Fl_wayland.cxx + // this one is in fl_wayland_clipboard_dnd.cxx virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); - // this one is in Fl_wayland.cxx + // this one is in fl_wayland_clipboard_dnd.cxx virtual int clipboard_contains(const char *type); // --- Wayland-special void set_cursor(); diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 71a14ca22..84b2c8c91 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -1426,3 +1426,20 @@ char *Fl_Wayland_Screen_Driver::get_seat_name() { struct xkb_keymap *Fl_Wayland_Screen_Driver::get_xkb_keymap() { return seat->xkb_keymap; } + + +int Fl_Wayland_Screen_Driver::get_mouse_unscaled(int &mx, int &my) { + open_display(); + mx = Fl::e_x_root; my = Fl::e_y_root; + int screen = screen_num_unscaled(mx, my); + return screen >= 0 ? screen : 0; +} + + +int Fl_Wayland_Screen_Driver::get_mouse(int &xx, int &yy) { + int snum = get_mouse_unscaled(xx, yy); + float s = scale(snum); + xx = xx/s; + yy = yy/s; + return snum; +} diff --git a/src/drivers/Wayland/Fl_wayland.cxx b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx similarity index 97% rename from src/drivers/Wayland/Fl_wayland.cxx rename to src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx index f00a7d909..b6e921fc5 100644 --- a/src/drivers/Wayland/Fl_wayland.cxx +++ b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx @@ -1,7 +1,7 @@ // -// Wayland specific code for the Fast Light Tool Kit (FLTK). +// Wayland-specific code for clipboard and drag-n-drop support. // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -32,30 +32,6 @@ # include -//////////////////////////////////////////////////////////////// - -Window fl_message_window = 0; -int fl_screen; -Window fl_xim_win = 0; -char fl_is_over_the_spot = 0; - - -int Fl_Wayland_Screen_Driver::get_mouse_unscaled(int &mx, int &my) { - open_display(); - mx = Fl::e_x_root; my = Fl::e_y_root; - int screen = screen_num_unscaled(mx, my); - return screen >= 0 ? screen : 0; -} - - -int Fl_Wayland_Screen_Driver::get_mouse(int &xx, int &yy) { - int snum = get_mouse_unscaled(xx, yy); - float s = scale(snum); - xx = xx/s; - yy = yy/s; - return snum; -} - //////////////////////////////////////////////////////////////// // Code used for copy and paste and DnD into the program: //static Window fl_dnd_source_window;