Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-03-27 19:41:02 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-04-08 13:25:40 +0300
commitc43473e88415db1b62f9fa225baa23ca344cace8 (patch)
tree71ad6639c47840b981d0fa94847aa6449115aae2 /intern/ghost
parentd478cc71dd73691b8e482911df42c71aaa85de8c (diff)
Cleanup: remove GHOST API to query tablet state from Window
It's not used by Blender anymore and it's unreliable since this state really only makes sense associated with events in a particular order. Ref D6675
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h7
-rw-r--r--intern/ghost/GHOST_IWindow.h10
-rw-r--r--intern/ghost/GHOST_Types.h2
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp5
-rw-r--r--intern/ghost/intern/GHOST_EventButton.h10
-rw-r--r--intern/ghost/intern/GHOST_EventCursor.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm70
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp22
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp32
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp22
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.h5
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm2
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp2
14 files changed, 119 insertions, 80 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 5b45510a39f..75527d50c6a 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -762,13 +762,6 @@ extern unsigned int GHOST_GetDefaultOpenGLFramebuffer(GHOST_WindowHandle windwHa
extern void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api);
/**
- * Returns the status of the tablet
- * \param windowhandle The handle to the window
- * \return Status of tablet
- */
-extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle);
-
-/**
* Access to rectangle width.
* \param rectanglehandle The handle to the rectangle
* \return width of the rectangle
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index c456f2b1dba..daf07b81e01 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -243,16 +243,6 @@ class GHOST_IWindow {
virtual bool isDialog() const = 0;
- /**
- * Returns the tablet data (pressure etc).
- * \return The tablet data (pressure etc).
- */
- virtual const GHOST_TabletData &GetTabletData()
- {
- /* Default state when no tablet is used, for systems without tablet support. */
- return GHOST_TABLET_DATA_DEFAULT;
- }
-
/***************************************************************************************
* Progress bar functionality
***************************************************************************************/
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index eb844c9e574..8126c2299c6 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -117,7 +117,7 @@ typedef struct GHOST_TabletData {
float Ytilt; /* as above */
} GHOST_TabletData;
-static const GHOST_TabletData GHOST_TABLET_DATA_DEFAULT = {
+static const GHOST_TabletData GHOST_TABLET_DATA_NONE = {
GHOST_kTabletModeNone, /* No tablet connected. */
1.0f, /* Pressure */
0.0f, /* Xtilt */
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 6ee1557122d..db9fd2e3bf9 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -717,11 +717,6 @@ void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
system->setTabletAPI(api);
}
-const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
-{
- return &((GHOST_IWindow *)windowhandle)->GetTabletData();
-}
-
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect *)rectanglehandle)->getWidth();
diff --git a/intern/ghost/intern/GHOST_EventButton.h b/intern/ghost/intern/GHOST_EventButton.h
index e854bc23e5a..4247ae150a4 100644
--- a/intern/ghost/intern/GHOST_EventButton.h
+++ b/intern/ghost/intern/GHOST_EventButton.h
@@ -37,17 +37,19 @@ class GHOST_EventButton : public GHOST_Event {
* Constructor.
* \param time The time this event was generated.
* \param type The type of this event.
- * \param window: The window of this event.
- * \param button: The state of the buttons were at the time of the event.
+ * \param window The window of this event.
+ * \param button The state of the buttons were at the time of the event.
+ * \param tablet The tablet data associated with this event.
*/
GHOST_EventButton(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_IWindow *window,
- GHOST_TButtonMask button)
+ GHOST_TButtonMask button,
+ const GHOST_TabletData &tablet)
: GHOST_Event(time, type, window)
{
m_buttonEventData.button = button;
- m_buttonEventData.tablet = window->GetTabletData();
+ m_buttonEventData.tablet = tablet;
m_data = &m_buttonEventData;
}
diff --git a/intern/ghost/intern/GHOST_EventCursor.h b/intern/ghost/intern/GHOST_EventCursor.h
index 41597db216a..8ba657fd9fa 100644
--- a/intern/ghost/intern/GHOST_EventCursor.h
+++ b/intern/ghost/intern/GHOST_EventCursor.h
@@ -38,17 +38,19 @@ class GHOST_EventCursor : public GHOST_Event {
* \param type The type of this event.
* \param x The x-coordinate of the location the cursor was at the time of the event.
* \param y The y-coordinate of the location the cursor was at the time of the event.
+ * \param tablet The tablet data associated with this event.
*/
GHOST_EventCursor(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TInt32 x,
- GHOST_TInt32 y)
+ GHOST_TInt32 y,
+ const GHOST_TabletData &tablet)
: GHOST_Event(msec, type, window)
{
m_cursorEventData.x = x;
m_cursorEventData.y = y;
- m_cursorEventData.tablet = window->GetTabletData();
+ m_cursorEventData.tablet = tablet;
m_data = &m_cursorEventData;
}
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 9becff40995..3d6d187587c 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -817,7 +817,8 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
CGAssociateMouseAndMouseCursorPosition(true);
// Force mouse move event (not pushed by Cocoa)
- pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor(
+ getMilliSeconds(), GHOST_kEventCursorMove, window, x, y, window->GetCocoaTabletData()));
m_outsideLoopEventProcessed = true;
return GHOST_kSuccess;
@@ -1098,8 +1099,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
// Mouse up event is trapped by the resizing event loop,
// so send it anyway to the window manager.
- pushEvent(new GHOST_EventButton(
- getMilliSeconds(), GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
+ pushEvent(new GHOST_EventButton(getMilliSeconds(),
+ GHOST_kEventButtonUp,
+ window,
+ GHOST_kButtonMaskLeft,
+ GHOST_TABLET_DATA_NONE));
// m_ignoreWindowSizedMessages = true;
}
break;
@@ -1437,7 +1441,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
case NSEventTypeTabletProximity:
/* Reset tablet data when device enters proximity or leaves. */
- ct = GHOST_TABLET_DATA_DEFAULT;
+ ct = GHOST_TABLET_DATA_NONE;
if ([event isEnteringProximity]) {
/* Pointer is entering tablet area proximity. */
switch ([event pointingDeviceType]) {
@@ -1504,38 +1508,52 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
switch ([event type]) {
case NSEventTypeLeftMouseDown:
handleTabletEvent(event); // Update window tablet state to be included in event.
- pushEvent(new GHOST_EventButton(
- [event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000,
+ GHOST_kEventButtonDown,
+ window,
+ GHOST_kButtonMaskLeft,
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeRightMouseDown:
handleTabletEvent(event); // Update window tablet state to be included in event.
- pushEvent(new GHOST_EventButton(
- [event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskRight));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000,
+ GHOST_kEventButtonDown,
+ window,
+ GHOST_kButtonMaskRight,
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeOtherMouseDown:
handleTabletEvent(event); // Handle tablet events combined with mouse events
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
GHOST_kEventButtonDown,
window,
- convertButton([event buttonNumber])));
+ convertButton([event buttonNumber]),
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeLeftMouseUp:
handleTabletEvent(event); // Update window tablet state to be included in event.
- pushEvent(new GHOST_EventButton(
- [event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000,
+ GHOST_kEventButtonUp,
+ window,
+ GHOST_kButtonMaskLeft,
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeRightMouseUp:
handleTabletEvent(event); // Update window tablet state to be included in event.
- pushEvent(new GHOST_EventButton(
- [event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskRight));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000,
+ GHOST_kEventButtonUp,
+ window,
+ GHOST_kButtonMaskRight,
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeOtherMouseUp:
handleTabletEvent(event); // Update window tablet state to be included in event.
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
GHOST_kEventButtonUp,
window,
- convertButton([event buttonNumber])));
+ convertButton([event buttonNumber]),
+ window -> GetCocoaTabletData()));
break;
case NSEventTypeLeftMouseDragged:
@@ -1568,8 +1586,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
window->setCursorGrabAccum(x_accum, y_accum);
window->clientToScreenIntern(x_warp + x_accum, y_warp + y_accum, x, y);
- pushEvent(new GHOST_EventCursor(
- [event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
+ GHOST_kEventCursorMove,
+ window,
+ x,
+ y,
+ window -> GetCocoaTabletData()));
break;
}
case GHOST_kGrabWrap: // Wrap cursor at area/window boundaries
@@ -1614,8 +1636,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
// Generate event
GHOST_TInt32 x, y;
window->clientToScreenIntern(x_mouse + x_accum, y_mouse + y_accum, x, y);
- pushEvent(new GHOST_EventCursor(
- [event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
+ GHOST_kEventCursorMove,
+ window,
+ x,
+ y,
+ window -> GetCocoaTabletData()));
break;
}
default: {
@@ -1624,8 +1650,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
- pushEvent(new GHOST_EventCursor(
- [event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
+ GHOST_kEventCursorMove,
+ window,
+ x,
+ y,
+ window -> GetCocoaTabletData()));
break;
}
}
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 5dae0ce504b..97a75d7a0f5 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -390,22 +390,31 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
- g_event = new GHOST_EventCursor(
- getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
+ g_event = new GHOST_EventCursor(getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ x_new,
+ y_new,
+ GHOST_TABLET_DATA_NONE);
}
else {
g_event = new GHOST_EventCursor(getMilliSeconds(),
GHOST_kEventCursorMove,
window,
x_root + x_accum,
- y_root + y_accum);
+ y_root + y_accum,
+ GHOST_TABLET_DATA_NONE);
}
}
else
#endif
{
- g_event = new GHOST_EventCursor(
- getMilliSeconds(), GHOST_kEventCursorMove, window, x_root, y_root);
+ g_event = new GHOST_EventCursor(getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ x_root,
+ y_root,
+ GHOST_TABLET_DATA_NONE);
}
break;
}
@@ -435,7 +444,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
else
break;
- g_event = new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
+ g_event = new GHOST_EventButton(
+ getMilliSeconds(), type, window, gbmask, GHOST_TABLET_DATA_NONE);
break;
}
case SDL_MOUSEWHEEL: {
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 9149d81e32e..25a825dbb6a 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -911,7 +911,8 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
if (window->useTabletAPI(GHOST_kTabletNative)) {
window->setTabletData(NULL);
}
- return new GHOST_EventButton(system->getMilliSeconds(), type, window, mask);
+ return new GHOST_EventButton(
+ system->getMilliSeconds(), type, window, mask, window->getTabletData());
}
GHOST_Event *GHOST_SystemWin32::processPointerEvent(GHOST_TEventType type,
@@ -943,21 +944,27 @@ GHOST_Event *GHOST_SystemWin32::processPointerEvent(GHOST_TEventType type,
/* Update window tablet data to be included in event. */
window->setTabletData(&pointerInfo.tabletData);
eventHandled = true;
- return new GHOST_EventButton(
- system->getMilliSeconds(), GHOST_kEventButtonDown, window, pointerInfo.buttonMask);
+ return new GHOST_EventButton(system->getMilliSeconds(),
+ GHOST_kEventButtonDown,
+ window,
+ pointerInfo.buttonMask,
+ pointerInfo.tabletData);
case GHOST_kEventButtonUp:
eventHandled = true;
- return new GHOST_EventButton(
- system->getMilliSeconds(), GHOST_kEventButtonUp, window, pointerInfo.buttonMask);
+ return new GHOST_EventButton(system->getMilliSeconds(),
+ GHOST_kEventButtonUp,
+ window,
+ pointerInfo.buttonMask,
+ window->getTabletData());
case GHOST_kEventCursorMove:
/* Update window tablet data to be included in event. */
- window->setTabletData(&pointerInfo.tabletData);
eventHandled = true;
return new GHOST_EventCursor(system->getMilliSeconds(),
GHOST_kEventCursorMove,
window,
pointerInfo.pixelLocation.x,
- pointerInfo.pixelLocation.y);
+ pointerInfo.pixelLocation.y,
+ pointerInfo.tabletData);
default:
return NULL;
}
@@ -1001,12 +1008,17 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
GHOST_kEventCursorMove,
window,
x_screen + x_accum,
- y_screen + y_accum);
+ y_screen + y_accum,
+ window->getTabletData());
}
}
else {
- return new GHOST_EventCursor(
- system->getMilliSeconds(), GHOST_kEventCursorMove, window, x_screen, y_screen);
+ return new GHOST_EventCursor(system->getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ x_screen,
+ y_screen,
+ window->getTabletData());
}
return NULL;
}
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index f076fe4c94a..ca511073ea1 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1000,12 +1000,17 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
GHOST_kEventCursorMove,
window,
xme.x_root + x_accum,
- xme.y_root + y_accum);
+ xme.y_root + y_accum,
+ window->GetTabletData());
}
}
else {
- g_event = new GHOST_EventCursor(
- getMilliSeconds(), GHOST_kEventCursorMove, window, xme.x_root, xme.y_root);
+ g_event = new GHOST_EventCursor(getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ xme.x_root,
+ xme.y_root,
+ window->GetTabletData());
}
break;
}
@@ -1272,7 +1277,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
else
break;
- g_event = new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
+ g_event = new GHOST_EventButton(
+ getMilliSeconds(), type, window, gbmask, window->GetTabletData());
break;
}
@@ -1373,8 +1379,12 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
*/
XCrossingEvent &xce = xe->xcrossing;
if (xce.mode == NotifyNormal) {
- g_event = new GHOST_EventCursor(
- getMilliSeconds(), GHOST_kEventCursorMove, window, xce.x_root, xce.y_root);
+ g_event = new GHOST_EventCursor(getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ xce.x_root,
+ xce.y_root,
+ window->GetTabletData());
}
// printf("X: %s window %d\n",
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index a49949c2c8d..efa418deee2 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -222,11 +222,6 @@ class GHOST_WindowCocoa : public GHOST_Window {
bool isDialog() const;
- const GHOST_TabletData &GetTabletData()
- {
- return m_tablet;
- }
-
GHOST_TabletData &GetCocoaTabletData()
{
return m_tablet;
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index c90b49c27a5..10ab05a0de1 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -395,7 +395,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
setTitle(title);
- m_tablet = GHOST_TABLET_DATA_DEFAULT;
+ m_tablet = GHOST_TABLET_DATA_NONE;
CocoaWindowDelegate *windowDelegate = [[CocoaWindowDelegate alloc] init];
[windowDelegate setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 6570f27ac5a..f1a4110995e 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -90,7 +90,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
{
// Initialize tablet variables
memset(&m_wintab, 0, sizeof(m_wintab));
- m_tabletData = GHOST_TABLET_DATA_DEFAULT;
+ m_tabletData = GHOST_TABLET_DATA_NONE;
// Create window
if (state != GHOST_kWindowStateFullScreen) {
@@ -1101,7 +1101,7 @@ void GHOST_WindowWin32::setTabletData(GHOST_TabletData *pTabletData)
m_tabletData = *pTabletData;
}
else {
- m_tabletData = GHOST_TABLET_DATA_DEFAULT;
+ m_tabletData = GHOST_TABLET_DATA_NONE;
}
}
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 3bece605d45..363a8145c5a 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -499,7 +499,7 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
#ifdef WITH_X11_XINPUT
refreshXInputDevices();
- m_tabletData = GHOST_TABLET_DATA_DEFAULT;
+ m_tabletData = GHOST_TABLET_DATA_NONE;
#endif
/* now set up the rendering context. */