[Bf-blender-cvs] [7931ae0df3f] blender-v3.4-release: Cleanup: use snake-case for WAYLAND utility functions

Campbell Barton noreply at git.blender.org
Sat Nov 12 05:27:14 CET 2022


Commit: 7931ae0df3f2541316871c7b2ce7be3bd114e848
Author: Campbell Barton
Date:   Sat Nov 12 15:23:19 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB7931ae0df3f2541316871c7b2ce7be3bd114e848

Cleanup: use snake-case for WAYLAND utility functions

It wasn't so obvious which functions were part of the GHOST API
and which system functions were utilities.

This convention was already in place but not always followed.

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

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

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

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 7948112c53c..057c049792d 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -5990,7 +5990,7 @@ static bool cursor_is_software(const GHOST_TGrabCursorMode mode, const bool use_
   return false;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::setCursorShape(const GHOST_TStandardCursor shape)
+GHOST_TSuccess GHOST_SystemWayland::cursor_shape_set(const GHOST_TStandardCursor shape)
 {
   GWL_Seat *seat = gwl_display_seat_active_get(display_);
   if (UNLIKELY(!seat)) {
@@ -6032,7 +6032,7 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorShape(const GHOST_TStandardCursor s
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::hasCursorShape(const GHOST_TStandardCursor cursorShape)
+GHOST_TSuccess GHOST_SystemWayland::cursor_shape_check(const GHOST_TStandardCursor cursorShape)
 {
   auto cursor_find = ghost_wl_cursors.find(cursorShape);
   if (cursor_find == ghost_wl_cursors.end()) {
@@ -6045,13 +6045,13 @@ GHOST_TSuccess GHOST_SystemWayland::hasCursorShape(const GHOST_TStandardCursor c
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
-                                                         uint8_t *mask,
-                                                         const int sizex,
-                                                         const int sizey,
-                                                         const int hotX,
-                                                         const int hotY,
-                                                         const bool /*canInvertColor*/)
+GHOST_TSuccess GHOST_SystemWayland::cursor_shape_custom_set(uint8_t *bitmap,
+                                                            uint8_t *mask,
+                                                            const int sizex,
+                                                            const int sizey,
+                                                            const int hotX,
+                                                            const int hotY,
+                                                            const bool /*canInvertColor*/)
 {
   GWL_Seat *seat = gwl_display_seat_active_get(display_);
   if (UNLIKELY(!seat)) {
@@ -6121,7 +6121,7 @@ GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
+GHOST_TSuccess GHOST_SystemWayland::cursor_bitmap_get(GHOST_CursorBitmapRef *bitmap)
 {
   GWL_Seat *seat = gwl_display_seat_active_get(display_);
   if (UNLIKELY(!seat)) {
@@ -6147,7 +6147,7 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitma
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::setCursorVisibility(const bool visible)
+GHOST_TSuccess GHOST_SystemWayland::cursor_visibility_set(const bool visible)
 {
   GWL_Seat *seat = gwl_display_seat_active_get(display_);
   if (UNLIKELY(!seat)) {
@@ -6171,7 +6171,7 @@ bool GHOST_SystemWayland::supportsWindowPosition()
   return false;
 }
 
-bool GHOST_SystemWayland::getCursorGrabUseSoftwareDisplay(const GHOST_TGrabCursorMode mode)
+bool GHOST_SystemWayland::cursor_grab_use_software_display_get(const GHOST_TGrabCursorMode mode)
 {
   GWL_Seat *seat = gwl_display_seat_active_get(display_);
   if (UNLIKELY(!seat)) {
diff --git a/intern/ghost/intern/GHOST_SystemWayland.h b/intern/ghost/intern/GHOST_SystemWayland.h
index a8e8d8ddc45..45eb1d9d3e3 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.h
+++ b/intern/ghost/intern/GHOST_SystemWayland.h
@@ -137,26 +137,28 @@ class GHOST_SystemWayland : public GHOST_System {
                               const bool is_dialog,
                               const GHOST_IWindow *parentWindow) override;
 
-  GHOST_TSuccess setCursorShape(GHOST_TStandardCursor shape);
+  bool supportsCursorWarp() override;
+  bool supportsWindowPosition() override;
 
-  GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursorShape);
+  /* WAYLAND utility functions (share window/system logic). */
 
-  GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
-                                      uint8_t *mask,
-                                      int sizex,
-                                      int sizey,
-                                      int hotX,
-                                      int hotY,
-                                      bool canInvertColor);
+  GHOST_TSuccess cursor_shape_set(GHOST_TStandardCursor shape);
 
-  GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap);
+  GHOST_TSuccess cursor_shape_check(GHOST_TStandardCursor cursorShape);
 
-  GHOST_TSuccess setCursorVisibility(bool visible);
+  GHOST_TSuccess cursor_shape_custom_set(uint8_t *bitmap,
+                                         uint8_t *mask,
+                                         int sizex,
+                                         int sizey,
+                                         int hotX,
+                                         int hotY,
+                                         bool canInvertColor);
 
-  bool supportsCursorWarp() override;
-  bool supportsWindowPosition() override;
+  GHOST_TSuccess cursor_bitmap_get(GHOST_CursorBitmapRef *bitmap);
+
+  GHOST_TSuccess cursor_visibility_set(bool visible);
 
-  bool getCursorGrabUseSoftwareDisplay(const GHOST_TGrabCursorMode mode);
+  bool cursor_grab_use_software_display_get(const GHOST_TGrabCursorMode mode);
 
   /* WAYLAND direct-data access. */
 
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 9d62c69edef..0541c79bf78 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -435,7 +435,7 @@ static const struct wl_surface_listener wl_surface_listener = {
 
 GHOST_TSuccess GHOST_WindowWayland::hasCursorShape(GHOST_TStandardCursor cursorShape)
 {
-  return system_->hasCursorShape(cursorShape);
+  return system_->cursor_shape_check(cursorShape);
 }
 
 GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
@@ -618,25 +618,25 @@ GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mo
 
 GHOST_TSuccess GHOST_WindowWayland::setWindowCursorShape(GHOST_TStandardCursor shape)
 {
-  const GHOST_TSuccess ok = system_->setCursorShape(shape);
+  const GHOST_TSuccess ok = system_->cursor_shape_set(shape);
   m_cursorShape = (ok == GHOST_kSuccess) ? shape : GHOST_kStandardCursorDefault;
   return ok;
 }
 
 bool GHOST_WindowWayland::getCursorGrabUseSoftwareDisplay()
 {
-  return system_->getCursorGrabUseSoftwareDisplay(m_cursorGrab);
+  return system_->cursor_grab_use_software_display_get(m_cursorGrab);
 }
 
 GHOST_TSuccess GHOST_WindowWayland::setWindowCustomCursorShape(
     uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
 {
-  return system_->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
+  return system_->cursor_shape_custom_set(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
 }
 
 GHOST_TSuccess GHOST_WindowWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
 {
-  return system_->getCursorBitmap(bitmap);
+  return system_->cursor_bitmap_get(bitmap);
 }
 
 void GHOST_WindowWayland::setTitle(const char *title)
@@ -754,7 +754,7 @@ uint16_t GHOST_WindowWayland::getDPIHint()
 
 GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility(bool visible)
 {
-  return system_->setCursorVisibility(visible);
+  return system_->cursor_visibility_set(visible);
 }
 
 GHOST_TSuccess GHOST_WindowWayland::setState(GHOST_TWindowState state)



More information about the Bf-blender-cvs mailing list