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:
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowCocoa.mm')
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm96
1 files changed, 56 insertions, 40 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index d082fa99ad8..0c3b3062126 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -284,10 +284,10 @@
GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const char *title,
- GHOST_TInt32 left,
- GHOST_TInt32 bottom,
- GHOST_TUns32 width,
- GHOST_TUns32 height,
+ int32_t left,
+ int32_t bottom,
+ uint32_t width,
+ uint32_t height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
@@ -570,13 +570,13 @@ void GHOST_WindowCocoa::getClientBounds(GHOST_Rect &bounds) const
[pool drain];
}
-GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
+GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(uint32_t width)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
- if (((GHOST_TUns32)cBnds.getWidth()) != width) {
+ if (((uint32_t)cBnds.getWidth()) != width) {
NSSize size;
size.width = width;
size.height = cBnds.getHeight();
@@ -586,13 +586,13 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
return GHOST_kSuccess;
}
-GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
+GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(uint32_t height)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
- if (((GHOST_TUns32)cBnds.getHeight()) != height) {
+ if (((uint32_t)cBnds.getHeight()) != height) {
NSSize size;
size.width = cBnds.getWidth();
size.height = height;
@@ -602,14 +602,13 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
return GHOST_kSuccess;
}
-GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
+GHOST_TSuccess GHOST_WindowCocoa::setClientSize(uint32_t width, uint32_t height)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
- if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
- (((GHOST_TUns32)cBnds.getHeight()) != height)) {
+ if ((((uint32_t)cBnds.getWidth()) != width) || (((uint32_t)cBnds.getHeight()) != height)) {
NSSize size;
size.width = width;
size.height = height;
@@ -654,10 +653,10 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const
return state;
}
-void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX,
- GHOST_TInt32 inY,
- GHOST_TInt32 &outX,
- GHOST_TInt32 &outY) const
+void GHOST_WindowCocoa::screenToClient(int32_t inX,
+ int32_t inY,
+ int32_t &outX,
+ int32_t &outY) const
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid");
@@ -669,10 +668,10 @@ void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX,
outY = (cBnds.getHeight() - 1) - outY;
}
-void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX,
- GHOST_TInt32 inY,
- GHOST_TInt32 &outX,
- GHOST_TInt32 &outY) const
+void GHOST_WindowCocoa::clientToScreen(int32_t inX,
+ int32_t inY,
+ int32_t &outX,
+ int32_t &outY) const
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid");
@@ -684,10 +683,10 @@ void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX,
clientToScreenIntern(inX, inY, outX, outY);
}
-void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX,
- GHOST_TInt32 inY,
- GHOST_TInt32 &outX,
- GHOST_TInt32 &outY) const
+void GHOST_WindowCocoa::screenToClientIntern(int32_t inX,
+ int32_t inY,
+ int32_t &outX,
+ int32_t &outY) const
{
NSRect screenCoord;
NSRect baseCoord;
@@ -701,10 +700,10 @@ void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX,
outY = baseCoord.origin.y;
}
-void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX,
- GHOST_TInt32 inY,
- GHOST_TInt32 &outX,
- GHOST_TInt32 &outY) const
+void GHOST_WindowCocoa::clientToScreenIntern(int32_t inX,
+ int32_t inY,
+ int32_t &outX,
+ int32_t &outY) const
{
NSRect screenCoord;
NSRect baseCoord;
@@ -1127,9 +1126,9 @@ GHOST_TSuccess GHOST_WindowCocoa::hasCursorShape(GHOST_TStandardCursor shape)
return success;
}
-/* Reverse the bits in a GHOST_TUns8 */
+/* Reverse the bits in a uint8_t */
#if 0
-static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
+static uint8_t uns8ReverseBits(uint8_t ch)
{
ch= ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
ch= ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
@@ -1138,8 +1137,8 @@ static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
}
#endif
-/** Reverse the bits in a GHOST_TUns16 */
-static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
+/** Reverse the bits in a uint16_t */
+static uint16_t uns16ReverseBits(uint16_t shrt)
{
shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
@@ -1148,20 +1147,15 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
return shrt;
}
-GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
- GHOST_TUns8 *mask,
- int sizex,
- int sizey,
- int hotX,
- int hotY,
- bool canInvertColor)
+GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(
+ uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
{
int y, nbUns16;
NSPoint hotSpotPoint;
NSBitmapImageRep *cursorImageRep;
NSImage *cursorImage;
NSSize imSize;
- GHOST_TUns16 *cursorBitmap;
+ uint16_t *cursorBitmap;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -1182,7 +1176,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
bytesPerRow:(sizex / 8 + (sizex % 8 > 0 ? 1 : 0))
bitsPerPixel:1];
- cursorBitmap = (GHOST_TUns16 *)[cursorImageRep bitmapData];
+ cursorBitmap = (uint16_t *)[cursorImageRep bitmapData];
nbUns16 = [cursorImageRep bytesPerPlane] / 2;
for (y = 0; y < nbUns16; y++) {
@@ -1221,3 +1215,25 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
[pool drain];
return GHOST_kSuccess;
}
+
+#ifdef WITH_INPUT_IME
+void GHOST_WindowCocoa::beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed)
+{
+ if (m_openGLView) {
+ [m_openGLView beginIME:x y:y w:w h:h completed:completed];
+ }
+ else {
+ [m_metalView beginIME:x y:y w:w h:h completed:completed];
+ }
+}
+
+void GHOST_WindowCocoa::endIME()
+{
+ if (m_openGLView) {
+ [m_openGLView endIME];
+ }
+ else {
+ [m_metalView endIME];
+ }
+}
+#endif /* WITH_INPUT_IME */