Commit: 4d782110701ec0585bf5a928dc62df27e6260814
Author: Campbell Barton
Date:   Tue Nov 1 11:10:25 2022 +1100
Branches: master
https://developer.blender.org/rB4d782110701ec0585bf5a928dc62df27e6260814

Cleanup: disambiguate naming for Wayland surfaces

Name surfaces for their use.

===================================================================

M       intern/ghost/intern/GHOST_SystemWayland.cpp
M       intern/ghost/intern/GHOST_WindowWayland.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index f713ddced27..3073a8fe80d 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -312,7 +312,7 @@ struct GWL_Cursor {
   bool is_hardware = true;
   /** When true, a custom image is used to display the cursor (stored in 
`wl_image`). */
   bool is_custom = false;
-  struct wl_surface *wl_surface = nullptr;
+  struct wl_surface *wl_surface_cursor = nullptr;
   struct wl_buffer *wl_buffer = nullptr;
   struct wl_cursor_image wl_image = {0};
   struct wl_cursor_theme *wl_theme = nullptr;
@@ -456,7 +456,7 @@ struct GWL_SeatStatePointer {
    * The wl_surface last used with this pointing device
    * (events with this pointing device will be sent here).
    */
-  struct wl_surface *wl_surface = nullptr;
+  struct wl_surface *wl_surface_window = nullptr;
 
   GHOST_Buttons buttons = GHOST_Buttons();
 };
@@ -518,7 +518,7 @@ struct GWL_SeatStateKeyboard {
    * The wl_surface last used with this pointing device
    * (events with this pointing device will be sent here).
    */
-  struct wl_surface *wl_surface = nullptr;
+  struct wl_surface *wl_surface_window = nullptr;
 };
 
 /**
@@ -697,7 +697,7 @@ struct GWL_Seat {
     GHOST_ITimerTask *timer = nullptr;
   } key_repeat;
 
-  struct wl_surface *wl_surface_focus_dnd = nullptr;
+  struct wl_surface *wl_surface_window_focus_dnd = nullptr;
 
   struct wl_data_device *wl_data_device = nullptr;
   /** Drag & Drop. */
@@ -1499,7 +1499,7 @@ static void keyboard_depressed_state_key_event(GWL_Seat 
*seat,
 static void keyboard_depressed_state_push_events_from_change(
     GWL_Seat *seat, const GWL_KeyboardDepressedState &key_depressed_prev)
 {
-  GHOST_IWindow *win = ghost_wl_surface_user_data(seat->keyboard.wl_surface);
+  GHOST_IWindow *win = 
ghost_wl_surface_user_data(seat->keyboard.wl_surface_window);
   GHOST_SystemWayland *system = seat->system;
 
   /* Separate key up and down into separate passes so key down events always 
come after key up.
@@ -1586,7 +1586,7 @@ static void relative_pointer_handle_relative_motion(
     const wl_fixed_t /*dy_unaccel*/)
 {
   GWL_Seat *seat = static_cast<GWL_Seat *>(data);
-  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
     CLOG_INFO(LOG, 2, "relative_motion");
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
     const wl_fixed_t scale = win->scale();
@@ -1619,7 +1619,7 @@ static CLG_LogRef LOG_WL_DATA_SOURCE = 
{"ghost.wl.handle.data_source"};
 static void dnd_events(const GWL_Seat *const seat, const GHOST_TEventType 
event)
 {
   /* NOTE: `seat->data_offer_dnd_mutex` must already be locked. */
-  if (wl_surface *wl_surface_focus = seat->wl_surface_focus_dnd) {
+  if (wl_surface *wl_surface_focus = seat->wl_surface_window_focus_dnd) {
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
     const wl_fixed_t scale = win->scale();
     const int event_xy[2] = {
@@ -1967,7 +1967,7 @@ static void data_device_handle_enter(void *data,
     wl_data_offer_accept(id, serial, type);
   }
 
-  seat->wl_surface_focus_dnd = wl_surface;
+  seat->wl_surface_window_focus_dnd = wl_surface;
 
   seat->system->seat_active_set(seat);
 
@@ -1982,7 +1982,7 @@ static void data_device_handle_leave(void *data, struct 
wl_data_device * /*wl_da
   CLOG_INFO(LOG, 2, "leave");
 
   dnd_events(seat, GHOST_kEventDraggingExited);
-  seat->wl_surface_focus_dnd = nullptr;
+  seat->wl_surface_window_focus_dnd = nullptr;
 
   if (seat->data_offer_dnd && !seat->data_offer_dnd->dnd.in_use) {
     wl_data_offer_destroy(seat->data_offer_dnd->id);
@@ -2033,7 +2033,7 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 
   auto read_uris_fn = [](GWL_Seat *const seat,
                          GWL_DataOffer *data_offer,
-                         wl_surface *wl_surface,
+                         wl_surface *wl_surface_window,
                          const char *mime_receive) {
     const wl_fixed_t xy[2] = {UNPACK2(data_offer->dnd.xy)};
 
@@ -2062,7 +2062,7 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
        * So support both, once `\n` is found, strip the preceding `\r` if 
found. */
       static constexpr const char *lf = "\n";
 
-      GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface);
+      GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_window);
       std::vector<std::string> uris;
 
       size_t pos = 0;
@@ -2109,10 +2109,10 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
     wl_display_roundtrip(system->wl_display());
   };
 
-  /* Pass in `seat->wl_surface_focus_dnd` instead of accessing it from `seat` 
since the leave
-   * callback (#data_device_handle_leave) will clear the value once this 
function starts. */
+  /* Pass in `seat->wl_surface_window_focus_dnd` instead of accessing it from 
`seat` since the
+   * leave callback (#data_device_handle_leave) will clear the value once this 
function starts. */
   std::thread read_thread(
-      read_uris_fn, seat, data_offer, seat->wl_surface_focus_dnd, 
mime_receive);
+      read_uris_fn, seat, data_offer, seat->wl_surface_window_focus_dnd, 
mime_receive);
   read_thread.detach();
 }
 
@@ -2195,7 +2195,7 @@ static CLG_LogRef LOG_WL_CURSOR_SURFACE = 
{"ghost.wl.handle.cursor_surface"};
 static bool update_cursor_scale(GWL_Cursor &cursor,
                                 wl_shm *shm,
                                 GWL_SeatStatePointer *seat_state_pointer,
-                                wl_surface *wl_cursor_surface)
+                                wl_surface *wl_surface_cursor)
 {
   int scale = 0;
   for (const GWL_Output *output : seat_state_pointer->outputs) {
@@ -2207,7 +2207,7 @@ static bool update_cursor_scale(GWL_Cursor &cursor,
   if (scale > 0 && seat_state_pointer->theme_scale != scale) {
     seat_state_pointer->theme_scale = scale;
     if (!cursor.is_custom) {
-      wl_surface_set_buffer_scale(wl_cursor_surface, scale);
+      wl_surface_set_buffer_scale(wl_surface_cursor, scale);
     }
     wl_cursor_theme_destroy(cursor.wl_theme);
     cursor.wl_theme = wl_cursor_theme_load(
@@ -2300,7 +2300,7 @@ static void pointer_handle_enter(void *data,
   seat->pointer_scroll.discrete_xy[1] = 0;
   seat->pointer_scroll.axis_source = WL_POINTER_AXIS_SOURCE_WHEEL;
 
-  seat->pointer.wl_surface = wl_surface;
+  seat->pointer.wl_surface_window = wl_surface;
 
   seat->system->seat_active_set(seat);
 
@@ -2321,7 +2321,7 @@ static void pointer_handle_leave(void *data,
                                  struct wl_surface *wl_surface)
 {
   /* First clear the `pointer.wl_surface`, since the window won't exist when 
closing the window. */
-  static_cast<GWL_Seat *>(data)->pointer.wl_surface = nullptr;
+  static_cast<GWL_Seat *>(data)->pointer.wl_surface_window = nullptr;
   if (wl_surface && ghost_wl_surface_own(wl_surface)) {
     CLOG_INFO(LOG, 2, "leave");
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface);
@@ -2342,7 +2342,7 @@ static void pointer_handle_motion(void *data,
   seat->pointer.xy[0] = surface_x;
   seat->pointer.xy[1] = surface_y;
 
-  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
     CLOG_INFO(LOG, 2, "motion");
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
     const wl_fixed_t scale = win->scale();
@@ -2406,7 +2406,7 @@ static void pointer_handle_button(void *data,
   seat->data_source_serial = serial;
   seat->pointer.buttons.set(ebutton, state == WL_POINTER_BUTTON_STATE_PRESSED);
 
-  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
     seat->system->pushEvent(new GHOST_EventButton(
         seat->system->getMilliSeconds(), etype, win, ebutton, 
GHOST_TABLET_DATA_NONE));
@@ -2457,7 +2457,7 @@ static void pointer_handle_frame(void *data, struct 
wl_pointer * /*wl_pointer*/)
 
   /* Discrete X axis currently unsupported. */
   if (seat->pointer_scroll.discrete_xy[1]) {
-    if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+    if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
       GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
       const int32_t discrete = seat->pointer_scroll.discrete_xy[1];
       seat->system->pushEvent(new GHOST_EventWheel(
@@ -2468,7 +2468,7 @@ static void pointer_handle_frame(void *data, struct 
wl_pointer * /*wl_pointer*/)
   }
 
   if (seat->pointer_scroll.smooth_xy[0] || seat->pointer_scroll.smooth_xy[1]) {
-    if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+    if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
       GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
       const wl_fixed_t scale = win->scale();
       seat->system->pushEvent(new GHOST_EventTrackpad(
@@ -2599,7 +2599,7 @@ static void gesture_pinch_handle_begin(void *data,
   seat->pointer_gesture_pinch = GWL_SeatStatePointerGesture_Pinch{};
 
   GHOST_WindowWayland *win = nullptr;
-  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
     win = ghost_wl_surface_user_data(wl_surface_focus);
   }
   /* NOTE(@campbellbarton): Blender's use of track-pad coordinates is 
inconsistent and needs work.
@@ -2655,7 +2655,7 @@ static void gesture_pinch_handle_update(void *data,
 
   GHOST_WindowWayland *win = nullptr;
 
-  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+  if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
     win = ghost_wl_surface_user_data(wl_surface_focus);
   }
 
@@ -2943,7 +2943,7 @@ static void tablet_tool_handle_proximity_in(void *data,
 
   GWL_Seat *seat = tablet_tool->seat;
   seat->cursor_source_serial = serial;
-  seat->tablet.wl_surface = wl_surface;
+  

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to