Cleanup: comments (long lines) in ghost
This commit is contained in:
@@ -155,7 +155,8 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param systemhandle The handle to the system
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param title The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
@@ -684,8 +685,9 @@ extern GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int
|
||||
|
||||
/**
|
||||
* Gets the current swap interval for swapBuffers.
|
||||
* \param windowhandle The handle to the window
|
||||
* \param intervalOut pointer to location to return swap interval (left untouched if there is an error)
|
||||
* \param windowhandle: The handle to the window
|
||||
* \param intervalOut: pointer to location to return swap interval
|
||||
* (left untouched if there is an error)
|
||||
* \return A boolean success indicator of if swap interval was successfully read.
|
||||
*/
|
||||
extern GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *intervalOut);
|
||||
@@ -784,7 +786,8 @@ extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehand
|
||||
|
||||
/**
|
||||
* Returns whether this rectangle is valid.
|
||||
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
|
||||
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b.
|
||||
* Thus, empty rectangles are valid.
|
||||
* \param rectanglehandle The handle to the rectangle
|
||||
* \return Success value (true == valid rectangle)
|
||||
*/
|
||||
|
||||
@@ -226,17 +226,18 @@ class GHOST_ISystem {
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
* \param height The height the window.
|
||||
* \param state The state of the window when opened.
|
||||
* \param type The type of drawing context installed in this window.
|
||||
* \param title: The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left: The coordinate of the left edge of the window.
|
||||
* \param top: The coordinate of the top edge of the window.
|
||||
* \param width: The width the window.
|
||||
* \param height: The height the window.
|
||||
* \param state: The state of the window when opened.
|
||||
* \param type: The type of drawing context installed in this window.
|
||||
* \param glSettings: Misc OpenGL settings.
|
||||
* \param exclusive: Use to show the window ontop and ignore others (used fullscreen).
|
||||
* \param parentWindow Parent (embedder) window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
* \param parentWindow: Parent (embedder) window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
virtual GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_TInt32 left,
|
||||
|
||||
@@ -205,7 +205,8 @@ class GHOST_IWindow {
|
||||
|
||||
/**
|
||||
* Gets the current swap interval for swapBuffers.
|
||||
* \param intervalOut pointer to location to return swap interval (left untouched if there is an error)
|
||||
* \param intervalOut pointer to location to return swap interval
|
||||
* (left untouched if there is an error)
|
||||
* \return A boolean success indicator of if swap interval was successfully read.
|
||||
*/
|
||||
virtual GHOST_TSuccess getSwapInterval(int &intervalOut) = 0;
|
||||
|
||||
@@ -77,23 +77,24 @@ class GHOST_Rect {
|
||||
|
||||
/**
|
||||
* Sets all members of the rectangle.
|
||||
* \param l requested left coordinate of the rectangle
|
||||
* \param t requested top coordinate of the rectangle
|
||||
* \param r requested right coordinate of the rectangle
|
||||
* \param b requested bottom coordinate of the rectangle
|
||||
* \param l: requested left coordinate of the rectangle.
|
||||
* \param t: requested top coordinate of the rectangle.
|
||||
* \param r: requested right coordinate of the rectangle.
|
||||
* \param b: requested bottom coordinate of the rectangle.
|
||||
*/
|
||||
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
|
||||
|
||||
/**
|
||||
* Returns whether this rectangle is empty.
|
||||
* Empty rectangles are rectangles that have width==0 and/or height==0.
|
||||
* \return boolean value (true==empty rectangle)
|
||||
* \return boolean value (true==empty rectangle)
|
||||
*/
|
||||
virtual inline bool isEmpty() const;
|
||||
|
||||
/**
|
||||
* Returns whether this rectangle is valid.
|
||||
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
|
||||
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b.
|
||||
* Thus, empty rectangles are valid.
|
||||
* \return boolean value (true==valid rectangle)
|
||||
*/
|
||||
virtual inline bool isValid() const;
|
||||
@@ -101,28 +102,28 @@ class GHOST_Rect {
|
||||
/**
|
||||
* Grows (or shrinks the rectangle).
|
||||
* The method avoids negative insets making the rectangle invalid
|
||||
* \param i The amount of offset given to each extreme (negative values shrink the rectangle).
|
||||
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
|
||||
*/
|
||||
virtual void inset(GHOST_TInt32 i);
|
||||
|
||||
/**
|
||||
* Does a union of the rectangle given and this rectangle.
|
||||
* The result is stored in this rectangle.
|
||||
* \param r The rectangle that is input for the union operation.
|
||||
* \param r: The rectangle that is input for the union operation.
|
||||
*/
|
||||
virtual inline void unionRect(const GHOST_Rect &r);
|
||||
|
||||
/**
|
||||
* Grows the rectangle to included a point.
|
||||
* \param x The x-coordinate of the point.
|
||||
* \param y The y-coordinate of the point.
|
||||
* \param x: The x-coordinate of the point.
|
||||
* \param y: The y-coordinate of the point.
|
||||
*/
|
||||
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
/**
|
||||
* Grows the rectangle to included a point.
|
||||
* \param x The x-coordinate of the point.
|
||||
* \param y The y-coordinate of the point.
|
||||
* \param x The x-coordinate of the point.
|
||||
* \param y The y-coordinate of the point.
|
||||
*/
|
||||
virtual inline void wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs);
|
||||
|
||||
|
||||
@@ -367,10 +367,14 @@ typedef enum {
|
||||
} GHOST_TKey;
|
||||
|
||||
typedef enum {
|
||||
GHOST_kGrabDisable = 0, /* grab not set */
|
||||
GHOST_kGrabNormal, /* no cursor adjustments */
|
||||
GHOST_kGrabWrap, /* wrap the mouse location to prevent limiting screen bounds */
|
||||
GHOST_kGrabHide, /* hide the mouse while grabbing and restore the original location on release (numbuts) */
|
||||
/** Grab not set. */
|
||||
GHOST_kGrabDisable = 0,
|
||||
/** No cursor adjustments. */
|
||||
GHOST_kGrabNormal,
|
||||
/** Wrap the mouse location to prevent limiting screen bounds. */
|
||||
GHOST_kGrabWrap,
|
||||
/** Hide the mouse while grabbing and restore the original location on release (numbuts). */
|
||||
GHOST_kGrabHide,
|
||||
} GHOST_TGrabCursorMode;
|
||||
|
||||
typedef void *GHOST_TEventDataPtr;
|
||||
|
||||
@@ -291,7 +291,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
|
||||
}
|
||||
|
||||
#ifdef GHOST_MULTITHREADED_OPENGL
|
||||
//Switch openGL to multhreaded mode
|
||||
// Switch openGL to multhreaded mode
|
||||
if (CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine) == kCGLNoError)
|
||||
if (m_debug)
|
||||
fprintf(stderr, "\nSwitched OpenGL to multithreaded mode\n");
|
||||
|
||||
@@ -226,11 +226,11 @@ static int choose_pixel_format_legacy(HDC hDC, PIXELFORMATDESCRIPTOR &preferredP
|
||||
return iPixelFormat;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Clone a window for the purpose of creating a temporary context to initialize WGL extensions.
|
||||
* There is no generic way to clone the lpParam parameter, so the caller is responsible for cloning it themselves.
|
||||
* There is no generic way to clone the lpParam parameter,
|
||||
* so the caller is responsible for cloning it themselves.
|
||||
*/
|
||||
|
||||
static HWND clone_window(HWND hWnd, LPVOID lpParam)
|
||||
{
|
||||
int count;
|
||||
|
||||
@@ -87,11 +87,11 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
||||
const GHOST_DisplaySetting &setting);
|
||||
|
||||
protected:
|
||||
//Do not cache values as OS X supports screen hot plug
|
||||
// Do not cache values as OS X supports screen hot plug
|
||||
/** Cached number of displays. */
|
||||
//CGDisplayCount m_numDisplays;
|
||||
// CGDisplayCount m_numDisplays;
|
||||
/** Cached display id's for each display. */
|
||||
//CGDirectDisplayID* m_displayIDs;
|
||||
// CGDirectDisplayID* m_displayIDs;
|
||||
};
|
||||
|
||||
#endif // __GHOST_DISPLAYMANAGERCOCOA_H__
|
||||
|
||||
@@ -42,7 +42,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(GHOST_TUns8 &numDisplay
|
||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(GHOST_TUns8 display,
|
||||
GHOST_TInt32 &numSettings) const
|
||||
{
|
||||
numSettings = (GHOST_TInt32)3; //Width, Height, BitsPerPixel
|
||||
numSettings = (GHOST_TInt32)3; // Width, Height, BitsPerPixel
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (display == kMainDisplay) //Screen #0 may not be the main one
|
||||
if (display == kMainDisplay) // Screen #0 may not be the main one
|
||||
askedDisplay = [NSScreen mainScreen];
|
||||
else
|
||||
askedDisplay = [[NSScreen screens] objectAtIndex:display];
|
||||
@@ -71,7 +71,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
|
||||
|
||||
setting.bpp = NSBitsPerPixelFromDepth([askedDisplay depth]);
|
||||
|
||||
setting.frequency = 0; //No more CRT display...
|
||||
setting.frequency = 0; // No more CRT display...
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n",
|
||||
@@ -96,7 +96,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (display == kMainDisplay) //Screen #0 may not be the main one
|
||||
if (display == kMainDisplay) // Screen #0 may not be the main one
|
||||
askedDisplay = [NSScreen mainScreen];
|
||||
else
|
||||
askedDisplay = [[NSScreen screens] objectAtIndex:display];
|
||||
@@ -112,7 +112,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
|
||||
|
||||
setting.bpp = NSBitsPerPixelFromDepth([askedDisplay depth]);
|
||||
|
||||
setting.frequency = 0; //No more CRT display...
|
||||
setting.frequency = 0; // No more CRT display...
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
printf("current display mode: width=%d, height=%d, bpp=%d, frequency=%d\n",
|
||||
@@ -141,7 +141,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
|
||||
printf(" setting.frequency=%d\n", setting.frequency);
|
||||
#endif // GHOST_DEBUG
|
||||
|
||||
//Display configuration is no more available in 10.6
|
||||
// Display configuration is no more available in 10.6
|
||||
|
||||
/* CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
|
||||
m_displayIDs[display],
|
||||
@@ -159,7 +159,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
|
||||
printf(" setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate)); */
|
||||
#endif // GHOST_DEBUG
|
||||
|
||||
//CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
|
||||
// CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
|
||||
|
||||
return /*err == CGDisplayNoErr ?*/ GHOST_kSuccess /*: GHOST_kFailure*/;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,8 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt,
|
||||
}
|
||||
else {
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
// *pdwEffect = DROPEFFECT_COPY; // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
|
||||
// XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
|
||||
// *pdwEffect = DROPEFFECT_COPY;
|
||||
}
|
||||
m_system->pushDragDropEvent(
|
||||
GHOST_kEventDraggingUpdated, m_draggedObjectType, m_window, pt.x, pt.y, NULL);
|
||||
@@ -205,7 +206,7 @@ void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
|
||||
return getDropDataAsString(pDataObject);
|
||||
break;
|
||||
case GHOST_kDragnDropTypeBitmap:
|
||||
//return getDropDataAsBitmap(pDataObject);
|
||||
// return getDropDataAsBitmap(pDataObject);
|
||||
break;
|
||||
default:
|
||||
#ifdef GHOST_DEBUG
|
||||
@@ -322,10 +323,10 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
|
||||
int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
|
||||
{
|
||||
int size;
|
||||
out = NULL; //caller should free if != NULL
|
||||
out = NULL; // caller should free if != NULL
|
||||
|
||||
// Get the required size.
|
||||
size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage
|
||||
size = ::WideCharToMultiByte(CP_ACP, // System Default Codepage
|
||||
0x00000400, // WC_NO_BEST_FIT_CHARS
|
||||
in,
|
||||
-1, //-1 null terminated, makes output null terminated too.
|
||||
@@ -352,7 +353,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
|
||||
if (!size) {
|
||||
#ifdef GHOST_DEBUG
|
||||
::printLastError();
|
||||
#endif //GHOST_DEBUG
|
||||
#endif // GHOST_DEBUG
|
||||
::free(out);
|
||||
out = NULL;
|
||||
}
|
||||
|
||||
@@ -35,28 +35,31 @@ extern "C" {
|
||||
*
|
||||
* The dragging sequence is performed in four phases:
|
||||
*
|
||||
* <li> Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started.
|
||||
* Already gives the object data type, and the entering mouse location
|
||||
* - Start sequence (GHOST_kEventDraggingEntered) that tells
|
||||
* a drag'n'drop operation has started.
|
||||
* Already gives the object data type, and the entering mouse location
|
||||
*
|
||||
* <li> Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation
|
||||
* stops, to give the updated mouse position. Useful to highlight a potential destination, and update the status
|
||||
* (through GHOST_setAcceptDragOperation) telling if the object can be dropped at
|
||||
* the current cursor position.
|
||||
* - Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the
|
||||
* drag'n'drop operation stops, to give the updated mouse position.
|
||||
* Useful to highlight a potential destination, and update the status
|
||||
* (through GHOST_setAcceptDragOperation) telling if the object can be dropped at the current
|
||||
* cursor position.
|
||||
*
|
||||
* <li> Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.
|
||||
* - Abort drag'n'drop sequence (GHOST_kEventDraggingExited)
|
||||
* sent when the user moved the mouse outside the window.
|
||||
*
|
||||
* <li> Send the dropped data (GHOST_kEventDraggingDropDone)
|
||||
* - Send the dropped data (GHOST_kEventDraggingDropDone)
|
||||
*
|
||||
* <li> Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon).
|
||||
* This can happen when the user drops an object on the application icon.
|
||||
* (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
|
||||
* - Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon).
|
||||
* This can happen when the user drops an object on the application icon.
|
||||
* (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
|
||||
*
|
||||
* <br><br>Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
|
||||
* Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
|
||||
*
|
||||
* <br>Currently supported object types :
|
||||
* <li>UTF-8 string
|
||||
* <li>array of strings representing filenames (GHOST_TStringArray)
|
||||
* <li>bitmap ImBuf
|
||||
* Currently supported object types:
|
||||
* - UTF-8 string.
|
||||
* - array of strings representing filenames (GHOST_TStringArray).
|
||||
* - bitmap #ImBuf.
|
||||
*/
|
||||
class GHOST_EventDragnDrop : public GHOST_Event {
|
||||
public:
|
||||
@@ -88,7 +91,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
|
||||
|
||||
~GHOST_EventDragnDrop()
|
||||
{
|
||||
//Free the dropped object data
|
||||
// Free the dropped object data
|
||||
if (m_dragnDropEventData.data == NULL)
|
||||
return;
|
||||
|
||||
|
||||
@@ -271,11 +271,11 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
|
||||
case LANG_JAPANESE:
|
||||
|
||||
/**
|
||||
* For Japanese IMEs, the robustest way to retrieve the caret
|
||||
* is scanning the attribute of the latest composition string and
|
||||
* retrieving the begining and the end of the target clause, i.e.
|
||||
* a clause being converted.
|
||||
*/
|
||||
* For Japanese IMEs, the robustest way to retrieve the caret
|
||||
* is scanning the attribute of the latest composition string and
|
||||
* retrieving the begining and the end of the target clause, i.e.
|
||||
* a clause being converted.
|
||||
*/
|
||||
if (lparam & GCS_COMPATTR) {
|
||||
int attribute_size = ::ImmGetCompositionStringW(imm_context, GCS_COMPATTR, NULL, 0);
|
||||
if (attribute_size > 0) {
|
||||
@@ -292,10 +292,10 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
|
||||
}
|
||||
if (target_start == attribute_size) {
|
||||
/**
|
||||
* This composition clause does not contain any target clauses,
|
||||
* i.e. this clauses is an input clause.
|
||||
* We treat whole this clause as a target clause.
|
||||
*/
|
||||
* This composition clause does not contain any target clauses,
|
||||
* i.e. this clauses is an input clause.
|
||||
* We treat whole this clause as a target clause.
|
||||
*/
|
||||
target_end = target_start;
|
||||
target_start = 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: some of this file.
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup GHOST
|
||||
|
||||
@@ -138,11 +138,11 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting &setting
|
||||
m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
|
||||
m_preFullScreenSetting);
|
||||
|
||||
//GHOST_PRINT("GHOST_System::beginFullScreen(): activating new display settings\n");
|
||||
// GHOST_PRINT("GHOST_System::beginFullScreen(): activating new display settings\n");
|
||||
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
|
||||
setting);
|
||||
if (success == GHOST_kSuccess) {
|
||||
//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
|
||||
// GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
|
||||
success = createFullScreenWindow(
|
||||
(GHOST_Window **)window, setting, stereoVisual, alphaBackground);
|
||||
if (success == GHOST_kSuccess) {
|
||||
@@ -181,11 +181,11 @@ GHOST_TSuccess GHOST_System::endFullScreen(void)
|
||||
GHOST_TSuccess success = GHOST_kFailure;
|
||||
GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager");
|
||||
if (m_windowManager->getFullScreen()) {
|
||||
//GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
|
||||
//GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
|
||||
// GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
|
||||
// GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
|
||||
success = m_windowManager->endFullScreen();
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager");
|
||||
//GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
|
||||
// GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
|
||||
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
|
||||
m_preFullScreenSetting);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
||||
* be zoomed in and the desktop may be bigger then the viewport. */
|
||||
GHOST_ASSERT(m_displayManager,
|
||||
"GHOST_System::createFullScreenWindow(): invalid display manager");
|
||||
//GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
|
||||
// GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
|
||||
*window = (GHOST_Window *)createWindow(STR_String(""),
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -87,7 +87,8 @@ class GHOST_SystemCocoa : public GHOST_System {
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param title The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
@@ -150,7 +151,8 @@ class GHOST_SystemCocoa : public GHOST_System {
|
||||
/**
|
||||
* Handles a drag'n'drop destination event. Called by GHOST_WindowCocoa window subclass
|
||||
* \param eventType The type of drag'n'drop event
|
||||
* \param draggedObjectType The type object concerned (currently array of file names, string, TIFF image)
|
||||
* \param draggedObjectType The type object concerned
|
||||
* (currently array of file names, string, TIFF image)
|
||||
* \param mouseX x mouse coordinate (in cocoa base window coordinates)
|
||||
* \param mouseY y mouse coordinate
|
||||
* \param window The window on which the event occurred
|
||||
@@ -291,10 +293,12 @@ class GHOST_SystemCocoa : public GHOST_System {
|
||||
/** Start time at initialization. */
|
||||
GHOST_TUns64 m_start_time;
|
||||
|
||||
/** Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched */
|
||||
/** Event has been processed directly by Cocoa (or NDOF manager)
|
||||
* and has sent a ghost event to be dispatched */
|
||||
bool m_outsideLoopEventProcessed;
|
||||
|
||||
/** Raised window is not yet known by the window manager, so delay application become active event handling */
|
||||
/** Raised window is not yet known by the window manager,
|
||||
* so delay application become active event handling */
|
||||
bool m_needDelayedApplicationBecomeActiveEventProcessing;
|
||||
|
||||
/** State of the modifiers. */
|
||||
|
||||
@@ -86,7 +86,7 @@ static GHOST_TButtonMask convertButton(int button)
|
||||
*/
|
||||
static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
{
|
||||
//printf("\nrecvchar %c 0x%x",recvChar,recvChar);
|
||||
// printf("\nrecvchar %c 0x%x",recvChar,recvChar);
|
||||
switch (rawCode) {
|
||||
/*Physical keycodes not used due to map changes in int'l keyboards
|
||||
case kVK_ANSI_A: return GHOST_kKeyA;
|
||||
@@ -341,7 +341,8 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
static bool g_hasFirstFile = false;
|
||||
static char g_firstFileBuf[512];
|
||||
|
||||
//TODO:Need to investigate this. Function called too early in creator.c to have g_hasFirstFile == true
|
||||
// TODO: Need to investigate this.
|
||||
// Function called too early in creator.c to have g_hasFirstFile == true
|
||||
extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
{
|
||||
if (g_hasFirstFile) {
|
||||
@@ -423,8 +424,9 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
//TODO: implement graceful termination through Cocoa mechanism to avoid session log off to be canceled
|
||||
//Note that Cmd+Q is already handled by keyhandler
|
||||
/* TODO: implement graceful termination through Cocoa mechanism
|
||||
* to avoid session log off to be canceled. */
|
||||
/* Note that Cmd+Q is already handled by keyhandler. */
|
||||
if (systemCocoa->handleQuitRequest() == GHOST_kExitNow)
|
||||
return NSTerminateCancel; //NSTerminateNow;
|
||||
else
|
||||
@@ -514,7 +516,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_SystemCocoa::GHOST_SystemCocoa(): m_displayManager==0\n");
|
||||
m_displayManager->initialize();
|
||||
|
||||
//NSEvent timeStamp is given in system uptime, state start date is boot time
|
||||
// NSEvent timeStamp is given in system uptime, state start date is boot time
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_BOOTTIME;
|
||||
len = sizeof(struct timeval);
|
||||
@@ -522,7 +524,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
|
||||
sysctl(mib, 2, &boottime, &len, NULL, 0);
|
||||
m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000));
|
||||
|
||||
//Detect multitouch trackpad
|
||||
// Detect multitouch trackpad
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_MODEL;
|
||||
sysctl(mib, 2, NULL, &len, NULL, 0);
|
||||
@@ -550,9 +552,9 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
m_ndofManager = new GHOST_NDOFManagerCocoa(*this);
|
||||
#endif
|
||||
|
||||
//ProcessSerialNumber psn;
|
||||
// ProcessSerialNumber psn;
|
||||
|
||||
//Carbon stuff to move window & menu to foreground
|
||||
// Carbon stuff to move window & menu to foreground
|
||||
/*if (!GetCurrentProcess(&psn)) {
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
@@ -567,7 +569,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
NSMenu *windowMenu;
|
||||
NSMenu *appMenu;
|
||||
|
||||
//Create the application menu
|
||||
// Create the application menu
|
||||
appMenu = [[NSMenu alloc] initWithTitle:@"Blender"];
|
||||
|
||||
[appMenu addItemWithTitle:@"About Blender"
|
||||
@@ -599,10 +601,10 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
|
||||
[mainMenubar addItem:menuItem];
|
||||
[menuItem release];
|
||||
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu]; //Needed for 10.5
|
||||
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu]; // Needed for 10.5
|
||||
[appMenu release];
|
||||
|
||||
//Create the window menu
|
||||
// Create the window menu
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
menuItem = [windowMenu addItemWithTitle:@"Minimize"
|
||||
@@ -650,19 +652,19 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
|
||||
GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds() const
|
||||
{
|
||||
//Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
|
||||
// Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
|
||||
struct timeval currentTime;
|
||||
|
||||
gettimeofday(¤tTime, NULL);
|
||||
|
||||
//Return timestamp of system uptime
|
||||
// Return timestamp of system uptime
|
||||
|
||||
return ((currentTime.tv_sec * 1000) + (currentTime.tv_usec / 1000) - m_start_time);
|
||||
}
|
||||
|
||||
GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
|
||||
{
|
||||
//Note that OS X supports monitor hot plug
|
||||
// Note that OS X supports monitor hot plug
|
||||
// We do not support multiple monitors at the moment
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@@ -675,10 +677,10 @@ GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
|
||||
void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
//Get visible frame, that is frame excluding dock and top menu bar
|
||||
// Get visible frame, that is frame excluding dock and top menu bar
|
||||
NSRect frame = [[NSScreen mainScreen] visibleFrame];
|
||||
|
||||
//Returns max window contents (excluding title bar...)
|
||||
// Returns max window contents (excluding title bar...)
|
||||
NSRect contentRect = [NSWindow
|
||||
contentRectForFrameRect:frame
|
||||
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
|
||||
@@ -710,7 +712,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
GHOST_IWindow *window = NULL;
|
||||
|
||||
//Get the available rect for including window contents
|
||||
// Get the available rect for including window contents
|
||||
NSRect frame = [[NSScreen mainScreen] visibleFrame];
|
||||
NSRect contentRect = [NSWindow
|
||||
contentRectForFrameRect:frame
|
||||
@@ -719,7 +721,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
|
||||
|
||||
GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top;
|
||||
|
||||
//Ensures window top left is inside this available rect
|
||||
// Ensures window top left is inside this available rect
|
||||
left = left > contentRect.origin.x ? left : contentRect.origin.x;
|
||||
// Add contentRect.origin.y to respect docksize
|
||||
bottom = bottom > contentRect.origin.y ? bottom + contentRect.origin.y : contentRect.origin.y;
|
||||
@@ -740,7 +742,8 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
|
||||
GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
|
||||
m_windowManager->addWindow(window);
|
||||
m_windowManager->setActiveWindow(window);
|
||||
//Need to tell window manager the new window is the active one (Cocoa does not send the event activate upon window creation)
|
||||
/* Need to tell window manager the new window is the active one
|
||||
* (Cocoa does not send the event activate upon window creation). */
|
||||
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window));
|
||||
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
|
||||
}
|
||||
@@ -819,13 +822,13 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
|
||||
if (!window)
|
||||
return GHOST_kFailure;
|
||||
|
||||
//Cursor and mouse dissociation placed here not to interfere with continuous grab
|
||||
// Cursor and mouse dissociation placed here not to interfere with continuous grab
|
||||
// (in cont. grab setMouseCursorPosition is directly called)
|
||||
CGAssociateMouseAndMouseCursorPosition(false);
|
||||
setMouseCursorPosition(x, y);
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
|
||||
//Force mouse move event (not pushed by Cocoa)
|
||||
// Force mouse move event (not pushed by Cocoa)
|
||||
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y));
|
||||
m_outsideLoopEventProcessed = true;
|
||||
|
||||
@@ -843,11 +846,11 @@ GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_T
|
||||
NSScreen *windowScreen = window->getScreen();
|
||||
NSRect screenRect = [windowScreen frame];
|
||||
|
||||
//Set position relative to current screen
|
||||
// Set position relative to current screen
|
||||
xf -= screenRect.origin.x;
|
||||
yf -= screenRect.origin.y;
|
||||
|
||||
//Quartz Display Services uses the old coordinates (top left origin)
|
||||
// Quartz Display Services uses the old coordinates (top left origin)
|
||||
yf = screenRect.size.height - yf;
|
||||
|
||||
CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription]
|
||||
@@ -899,7 +902,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
|
||||
NSEvent *event;
|
||||
|
||||
// SetMouseCoalescingEnabled(false, NULL);
|
||||
//TODO : implement timer ??
|
||||
// TODO : implement timer ??
|
||||
#if 0
|
||||
do {
|
||||
GHOST_TimerManager* timerMgr = getTimerManager();
|
||||
@@ -979,11 +982,11 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
|
||||
return anyProcessed;
|
||||
}
|
||||
|
||||
//Note: called from NSApplication delegate
|
||||
// Note: called from NSApplication delegate
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
|
||||
{
|
||||
//Update the modifiers key mask, as its status may have changed when the application was not active
|
||||
//(that is when update events are sent to another application)
|
||||
// Update the modifiers key mask, as its status may have changed when the application
|
||||
// was not active (that is when update events are sent to another application).
|
||||
unsigned int modifiers;
|
||||
GHOST_IWindow *window = m_windowManager->getActiveWindow();
|
||||
|
||||
@@ -1036,7 +1039,7 @@ void GHOST_SystemCocoa::notifyExternalEventProcessed()
|
||||
m_outsideLoopEventProcessed = true;
|
||||
}
|
||||
|
||||
//Note: called from NSWindow delegate
|
||||
// Note: called from NSWindow delegate
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
|
||||
GHOST_WindowCocoa *window)
|
||||
{
|
||||
@@ -1077,13 +1080,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
|
||||
break;
|
||||
case GHOST_kEventWindowSize:
|
||||
if (!m_ignoreWindowSizedMessages) {
|
||||
//Enforce only one resize message per event loop (coalescing all the live resize messages)
|
||||
// Enforce only one resize message per event loop
|
||||
// (coalescing all the live resize messages)
|
||||
window->updateDrawingContext();
|
||||
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
|
||||
// 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));
|
||||
//m_ignoreWindowSizedMessages = true;
|
||||
// m_ignoreWindowSizedMessages = true;
|
||||
}
|
||||
break;
|
||||
case GHOST_kEventNativeResolutionChange:
|
||||
@@ -1102,7 +1107,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
//Note: called from NSWindow subclass
|
||||
// Note: called from NSWindow subclass
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType,
|
||||
GHOST_TDragnDropTypes draggedObjectType,
|
||||
GHOST_WindowCocoa *window,
|
||||
@@ -1238,7 +1243,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
|
||||
/* As Core Graphics does not support contextes with non premutliplied alpha,
|
||||
we need to get alpha key values in a separate batch */
|
||||
|
||||
/* First get RGB values w/o Alpha to avoid pre-multiplication, 32bit but last byte is unused */
|
||||
/* First get RGB values w/o Alpha to avoid pre-multiplication,
|
||||
* 32bit but last byte is unused */
|
||||
blBitmapFormatImageRGB = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:imgSize.width
|
||||
@@ -1340,11 +1346,11 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
|
||||
{
|
||||
GHOST_Window *window = (GHOST_Window *)m_windowManager->getActiveWindow();
|
||||
|
||||
//Discard quit event if we are in cursor grab sequence
|
||||
// Discard quit event if we are in cursor grab sequence
|
||||
if (window && window->getCursorGrabModeIsWarp())
|
||||
return GHOST_kExitCancel;
|
||||
|
||||
//Check open windows if some changes are not saved
|
||||
// Check open windows if some changes are not saved
|
||||
if (m_windowManager->getAnyModifiedState()) {
|
||||
int shouldQuit = NSRunAlertPanel(
|
||||
@"Exit Blender",
|
||||
@@ -1357,14 +1363,14 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
|
||||
return GHOST_kExitNow;
|
||||
}
|
||||
else {
|
||||
//Give back focus to the blender window if user selected cancel quit
|
||||
// Give back focus to the blender window if user selected cancel quit
|
||||
NSArray *windowsList = [NSApp orderedWindows];
|
||||
if ([windowsList count]) {
|
||||
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
|
||||
//Handle the modifiers keyes changed state issue
|
||||
//as recovering from the quit dialog is like application
|
||||
//gaining focus back.
|
||||
//Main issue fixed is Cmd modifier not being cleared
|
||||
// Handle the modifiers keyes changed state issue
|
||||
// as recovering from the quit dialog is like application
|
||||
// gaining focus back.
|
||||
// Main issue fixed is Cmd modifier not being cleared
|
||||
handleApplicationBecomeActiveEvent();
|
||||
}
|
||||
}
|
||||
@@ -1391,11 +1397,12 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
|
||||
return NO;
|
||||
}
|
||||
|
||||
//Discard event if we are in cursor grab sequence, it'll lead to "stuck cursor" situation if the alert panel is raised
|
||||
/* Discard event if we are in cursor grab sequence,
|
||||
* it'll lead to "stuck cursor" situation if the alert panel is raised */
|
||||
if (window && window->getCursorGrabModeIsWarp())
|
||||
return GHOST_kExitCancel;
|
||||
|
||||
//Check open windows if some changes are not saved
|
||||
// Check open windows if some changes are not saved
|
||||
if (m_windowManager->getAnyModifiedState()) {
|
||||
confirmOpen = NSRunAlertPanel(
|
||||
[NSString stringWithFormat:@"Opening %@", [filepath lastPathComponent]],
|
||||
@@ -1405,7 +1412,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
|
||||
nil);
|
||||
}
|
||||
|
||||
//Give back focus to the blender window
|
||||
// Give back focus to the blender window
|
||||
windowsList = [NSApp orderedWindows];
|
||||
if ([windowsList count]) {
|
||||
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
|
||||
@@ -1440,7 +1447,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
||||
|
||||
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
|
||||
if (!window) {
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
// printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
@@ -1464,7 +1471,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
||||
ct.Xtilt = 0;
|
||||
ct.Ytilt = 0;
|
||||
if ([event isEnteringProximity]) {
|
||||
//pointer is entering tablet area proximity
|
||||
// pointer is entering tablet area proximity
|
||||
switch ([event pointingDeviceType]) {
|
||||
case NSPenPointingDevice:
|
||||
ct.Active = GHOST_kTabletModeStylus;
|
||||
@@ -1505,7 +1512,7 @@ bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr)
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
return true;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
// No tablet event included : do nothing
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1524,7 +1531,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
if (!window) {
|
||||
window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
|
||||
if (!window) {
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
// printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
}
|
||||
@@ -1535,43 +1542,43 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSLeftMouseDown:
|
||||
pushEvent(new GHOST_EventButton(
|
||||
[event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
case NSRightMouseDown:
|
||||
pushEvent(new GHOST_EventButton(
|
||||
[event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskRight));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
case NSOtherMouseDown:
|
||||
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
|
||||
GHOST_kEventButtonDown,
|
||||
window,
|
||||
convertButton([event buttonNumber])));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
|
||||
case NSLeftMouseUp:
|
||||
pushEvent(new GHOST_EventButton(
|
||||
[event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
case NSRightMouseUp:
|
||||
pushEvent(new GHOST_EventButton(
|
||||
[event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskRight));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
case NSOtherMouseUp:
|
||||
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
|
||||
GHOST_kEventButtonUp,
|
||||
window,
|
||||
convertButton([event buttonNumber])));
|
||||
handleTabletEvent(event); //Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event); // Handle tablet events combined with mouse events
|
||||
break;
|
||||
|
||||
case NSLeftMouseDragged:
|
||||
case NSRightMouseDragged:
|
||||
case NSOtherMouseDragged:
|
||||
//Handle tablet events combined with mouse events
|
||||
// Handle tablet events combined with mouse events
|
||||
handleTabletEvent(event);
|
||||
|
||||
case NSMouseMoved: {
|
||||
@@ -1585,7 +1592,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
}
|
||||
|
||||
switch (grab_mode) {
|
||||
case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
|
||||
case GHOST_kGrabHide: // Cursor hidden grab operation : no cursor move
|
||||
{
|
||||
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
|
||||
|
||||
@@ -1595,7 +1602,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
x_accum += [event deltaX];
|
||||
y_accum += -[event
|
||||
deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
|
||||
deltaY]; // Strange Apple implementation (inverted coordinates for the deltaY) ...
|
||||
window->setCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
window->clientToScreenIntern(x_warp + x_accum, y_warp + y_accum, x, y);
|
||||
@@ -1603,7 +1610,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
[event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
|
||||
break;
|
||||
}
|
||||
case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
|
||||
case GHOST_kGrabWrap: // Wrap cursor at area/window boundaries
|
||||
{
|
||||
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
|
||||
GHOST_TInt32 x_mouse = mousePos.x;
|
||||
@@ -1614,23 +1621,24 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
|
||||
window->getClientBounds(bounds);
|
||||
|
||||
//Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
|
||||
/* Switch back to Cocoa coordinates orientation
|
||||
* (y=0 at botton,the same as blender internal btw!), and to client coordinates. */
|
||||
window->getClientBounds(windowBounds);
|
||||
window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
|
||||
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
|
||||
correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
|
||||
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
|
||||
|
||||
//Get accumulation from previous mouse warps
|
||||
// Get accumulation from previous mouse warps
|
||||
GHOST_TInt32 x_accum, y_accum;
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
//Warp mouse cursor if needed
|
||||
// Warp mouse cursor if needed
|
||||
GHOST_TInt32 warped_x_mouse = x_mouse;
|
||||
GHOST_TInt32 warped_y_mouse = y_mouse;
|
||||
correctedBounds.wrapPoint(warped_x_mouse, warped_y_mouse, 4);
|
||||
|
||||
//Set new cursor position
|
||||
// Set new cursor position
|
||||
if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
|
||||
GHOST_TInt32 warped_x, warped_y;
|
||||
window->clientToScreenIntern(warped_x_mouse, warped_y_mouse, warped_x, warped_y);
|
||||
@@ -1639,7 +1647,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
y_accum + (y_mouse - warped_y_mouse));
|
||||
}
|
||||
|
||||
//Generate event
|
||||
// Generate event
|
||||
GHOST_TInt32 x, y;
|
||||
window->clientToScreenIntern(x_mouse + x_accum, y_mouse + y_accum, x, y);
|
||||
pushEvent(new GHOST_EventCursor(
|
||||
@@ -1647,7 +1655,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
//Normal cursor operation: send mouse position in window
|
||||
// Normal cursor operation: send mouse position in window
|
||||
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
|
||||
GHOST_TInt32 x, y;
|
||||
|
||||
@@ -1669,9 +1677,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
phase = [event phase];
|
||||
|
||||
/* when pressing a key while momentum scrolling continues after
|
||||
* lifting fingers off the trackpad, the action can unexpectedly
|
||||
* change from e.g. scrolling to zooming. this works around the
|
||||
* issue by ignoring momentum scroll after a key press */
|
||||
* lifting fingers off the trackpad, the action can unexpectedly
|
||||
* change from e.g. scrolling to zooming. this works around the
|
||||
* issue by ignoring momentum scroll after a key press */
|
||||
if (momentumPhase) {
|
||||
if (m_ignoreMomentumScroll)
|
||||
break;
|
||||
@@ -1681,14 +1689,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
}
|
||||
|
||||
/* we assume phases are only set for gestures from trackpad or magic
|
||||
* mouse events. note that using tablet at the same time may not work
|
||||
* since this is a static variable */
|
||||
* mouse events. note that using tablet at the same time may not work
|
||||
* since this is a static variable */
|
||||
if (phase == NSEventPhaseBegan)
|
||||
m_multiTouchScroll = true;
|
||||
else if (phase == NSEventPhaseEnded)
|
||||
m_multiTouchScroll = false;
|
||||
|
||||
/* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */
|
||||
/* Standard scrollwheel case, if no swiping happened,
|
||||
* and no momentum (kinetic scroll) works. */
|
||||
if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) {
|
||||
GHOST_TInt32 delta;
|
||||
|
||||
@@ -1697,7 +1706,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
if (deltaF == 0.0)
|
||||
deltaF = [event deltaX]; // make blender decide if it's horizontal scroll
|
||||
if (deltaF == 0.0)
|
||||
break; //discard trackpad delta=0 events
|
||||
break; // discard trackpad delta=0 events
|
||||
|
||||
delta = deltaF > 0.0 ? 1 : -1;
|
||||
pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta));
|
||||
@@ -1712,7 +1721,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
dx = [event scrollingDeltaX];
|
||||
dy = [event scrollingDeltaY];
|
||||
|
||||
/* however, wacom tablet (intuos5) needs old deltas, it then has momentum and phase at zero */
|
||||
/* However, wacom tablet (intuos5) needs old deltas,
|
||||
* it then has momentum and phase at zero. */
|
||||
if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
|
||||
dx = [event deltaX];
|
||||
dy = [event deltaY];
|
||||
@@ -1770,7 +1780,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
|
||||
|
||||
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
|
||||
if (!window) {
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
// printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
@@ -1815,7 +1825,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
|
||||
utf8_buf[0] = '\0';
|
||||
|
||||
if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask))
|
||||
break; //Cmd-Q is directly handled by Cocoa
|
||||
break; // Cmd-Q is directly handled by Cocoa
|
||||
|
||||
/* ascii is a subset of unicode */
|
||||
if (utf8_buf[0] && !utf8_buf[1]) {
|
||||
@@ -1825,12 +1835,30 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
|
||||
if ([event type] == NSKeyDown) {
|
||||
pushEvent(new GHOST_EventKey(
|
||||
[event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf));
|
||||
//printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
|
||||
#if 0
|
||||
printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
|
||||
[event keyCode],
|
||||
[charsIgnoringModifiers length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
|
||||
' ',
|
||||
keyCode,
|
||||
ascii,
|
||||
ascii,
|
||||
utf8_buf);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
pushEvent(new GHOST_EventKey(
|
||||
[event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, NULL));
|
||||
//printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
|
||||
#if 0
|
||||
printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
|
||||
[event keyCode],
|
||||
[charsIgnoringModifiers length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
|
||||
' ',
|
||||
keyCode,
|
||||
ascii,
|
||||
ascii,
|
||||
utf8_buf);
|
||||
#endif
|
||||
}
|
||||
m_ignoreMomentumScroll = true;
|
||||
break;
|
||||
|
||||
@@ -313,7 +313,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||
SDL_WindowEvent &sdl_sub_evt = sdl_event->window;
|
||||
GHOST_WindowSDL *window = findGhostWindow(
|
||||
SDL_GetWindowFromID_fallback(sdl_sub_evt.windowID));
|
||||
//assert(window != NULL); // can be NULL on close window.
|
||||
// assert(window != NULL); // can be NULL on close window.
|
||||
|
||||
switch (sdl_sub_evt.event) {
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
@@ -453,7 +453,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||
assert(window != NULL);
|
||||
|
||||
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
|
||||
/* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
|
||||
/* note, the sdl_sub_evt.keysym.sym is truncated,
|
||||
* for unicode support ghost has to be modified */
|
||||
/* printf("%d\n", sym); */
|
||||
if (sym > 127) {
|
||||
switch (sym) {
|
||||
@@ -631,7 +632,7 @@ bool GHOST_SystemSDL::generateWindowExposeEvents()
|
||||
(*w_start)->validate();
|
||||
|
||||
if (g_event) {
|
||||
//printf("Expose events pushed\n");
|
||||
// printf("Expose events pushed\n");
|
||||
pushEvent(g_event);
|
||||
anyProcessed = true;
|
||||
}
|
||||
@@ -656,7 +657,7 @@ bool GHOST_SystemSDL::processEvents(bool waitForEvent)
|
||||
|
||||
if (next == GHOST_kFireTimeNever) {
|
||||
SDL_WaitEventTimeout(NULL, -1);
|
||||
//SleepTillEvent(m_display, -1);
|
||||
// SleepTillEvent(m_display, -1);
|
||||
}
|
||||
else {
|
||||
GHOST_TInt64 maxSleep = next - getMilliSeconds();
|
||||
|
||||
@@ -367,7 +367,8 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
|
||||
}
|
||||
|
||||
#elif defined(WITH_GL_PROFILE_COMPAT)
|
||||
// ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile)
|
||||
// ask for 2.1 context, driver gives any GL version >= 2.1
|
||||
// (hopefully the latest compatibility profile)
|
||||
// 2.1 ignores the profile bit & is incompatible with core profile
|
||||
context = new GHOST_ContextWGL(false,
|
||||
true,
|
||||
@@ -999,9 +1000,11 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
|
||||
int r;
|
||||
GetKeyboardState((PBYTE)state);
|
||||
|
||||
// don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical composition.
|
||||
// Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical
|
||||
// composition.
|
||||
if (MapVirtualKeyW(vk, 2) != 0) {
|
||||
// todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). Could be up to 24 utf8 bytes.
|
||||
// todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
|
||||
// Could be up to 24 utf8 bytes.
|
||||
if ((r = ToUnicodeEx(
|
||||
vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
|
||||
if ((r > 0 && r < 3)) {
|
||||
@@ -1191,7 +1194,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
if (wParam == RIM_INPUTSINK) {
|
||||
if (GetFocus() != hwnd) // WM_INPUT message not for this window
|
||||
return 0;
|
||||
} //else wParam == RIM_INPUT
|
||||
} // else wParam == RIM_INPUT
|
||||
|
||||
RAWINPUT raw;
|
||||
RAWINPUT *raw_ptr = &raw;
|
||||
@@ -1433,8 +1436,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
case WM_NCMOUSEMOVE:
|
||||
/* The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved
|
||||
* within the nonclient area of the window. This message is posted to the window
|
||||
* that contains the cursor. If a window has captured the mouse, this message is not posted.
|
||||
* within the nonclient area of the window. This message is posted to the window that
|
||||
* contains the cursor. If a window has captured the mouse, this message is not posted.
|
||||
*/
|
||||
case WM_NCHITTEST:
|
||||
/* The WM_NCHITTEST message is sent to a window when the cursor moves, or
|
||||
@@ -1448,16 +1451,17 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
// Window events, processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
case WM_CLOSE:
|
||||
/* The WM_CLOSE message is sent as a signal that a window or an application should terminate. */
|
||||
/* The WM_CLOSE message is sent as a signal that a window
|
||||
* or an application should terminate. */
|
||||
event = processWindowEvent(GHOST_kEventWindowClose, window);
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
/* The WM_ACTIVATE message is sent to both the window being activated and the window being
|
||||
* deactivated. If the windows use the same input queue, the message is sent synchronously,
|
||||
* first to the window procedure of the top-level window being deactivated, then to the window
|
||||
* procedure of the top-level window being activated. If the windows use different input queues,
|
||||
* the message is sent asynchronously, so the window is activated immediately.
|
||||
*/
|
||||
/* The WM_ACTIVATE message is sent to both the window being activated and the window
|
||||
* being deactivated. If the windows use the same input queue, the message is sent
|
||||
* synchronously, first to the window procedure of the top-level window being
|
||||
* deactivated, then to the window procedure of the top-level window being activated.
|
||||
* If the windows use different input queues, the message is sent asynchronously,
|
||||
* so the window is activated immediately. */
|
||||
{
|
||||
GHOST_ModifierKeys modifiers;
|
||||
modifiers.clear();
|
||||
@@ -1467,7 +1471,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
GHOST_kEventWindowDeactivate,
|
||||
window);
|
||||
/* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
|
||||
* will not be dispatched to OUR active window if we minimize one of OUR windows. */
|
||||
* will not be dispatched to OUR active window if we minimize one of OUR windows. */
|
||||
if (LOWORD(wParam) == WA_INACTIVE)
|
||||
window->lostMouseCapture();
|
||||
window->processWin32TabletActivateEvent(GET_WM_ACTIVATE_STATE(wParam, lParam));
|
||||
@@ -1519,7 +1523,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
*/
|
||||
/* we get first WM_SIZE before we fully init. So, do not dispatch before we continiously resizng */
|
||||
/* we get first WM_SIZE before we fully init.
|
||||
* So, do not dispatch before we continiously resizng */
|
||||
if (window->m_inLiveResize) {
|
||||
system->pushEvent(processWindowEvent(GHOST_kEventWindowSize, window));
|
||||
system->dispatchEvents();
|
||||
@@ -1553,9 +1558,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
/* The WM_DPICHANGED message is sent when the effective dots per inch (dpi) for a window has changed.
|
||||
* The DPI is the scale factor for a window. There are multiple events that can cause the DPI to
|
||||
* change such as when the window is moved to a monitor with a different DPI.
|
||||
/* The WM_DPICHANGED message is sent when the effective dots per inch (dpi) for a
|
||||
* window has changed. The DPI is the scale factor for a window. There are multiple
|
||||
* events that can cause the DPI tochange such as when the window is moved to a monitor
|
||||
* with a different DPI.
|
||||
*/
|
||||
{
|
||||
// The suggested new size and position of the window.
|
||||
@@ -1594,31 +1600,33 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* invalidated portion of a window for painting.
|
||||
*/
|
||||
case WM_NCPAINT:
|
||||
/* An application sends the WM_NCPAINT message to a window when its frame must be painted. */
|
||||
/* An application sends the WM_NCPAINT message to a window
|
||||
* when its frame must be painted. */
|
||||
case WM_NCACTIVATE:
|
||||
/* The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed
|
||||
* to indicate an active or inactive state.
|
||||
*/
|
||||
/* The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be
|
||||
* changed to indicate an active or inactive state. */
|
||||
case WM_DESTROY:
|
||||
/* The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window
|
||||
* procedure of the window being destroyed after the window is removed from the screen.
|
||||
* This message is sent first to the window being destroyed and then to the child windows
|
||||
* (if any) as they are destroyed. During the processing of the message, it can be assumed
|
||||
* that all child windows still exist.
|
||||
*/
|
||||
/* The WM_DESTROY message is sent when a window is being destroyed. It is sent to the
|
||||
* window procedure of the window being destroyed after the window is removed from the
|
||||
* screen. This message is sent first to the window being destroyed and then to the child
|
||||
* windows (if any) as they are destroyed. During the processing of the message, it can
|
||||
* be assumed that all child windows still exist. */
|
||||
case WM_NCDESTROY:
|
||||
/* The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The
|
||||
* DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY
|
||||
* message. WM_DESTROY is used to free the allocated memory object associated with the window.
|
||||
/* The WM_NCDESTROY message informs a window that its nonclient area is being
|
||||
* destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window
|
||||
* following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory
|
||||
* object associated with the window.
|
||||
*/
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
|
||||
* We want to prevent this if a window is still active and it loses focus to nowhere*/
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the
|
||||
* keyboard focus. We want to prevent this if a window is still active and it loses
|
||||
* focus to nowhere. */
|
||||
if (!wParam && hwnd == ::GetActiveWindow())
|
||||
::SetFocus(hwnd);
|
||||
case WM_SHOWWINDOW:
|
||||
/* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
|
||||
/* The WM_SHOWWINDOW message is sent to a window when the window is
|
||||
* about to be hidden or shown. */
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
/* The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in
|
||||
* the Z order is about to change as a result of a call to the SetWindowPos function or
|
||||
|
||||
@@ -102,7 +102,8 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param title The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
@@ -205,11 +206,12 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
/**
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Called by GHOST_DropTargetWin32 class.
|
||||
* \param eventType The type of drag'n'drop event
|
||||
* \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
|
||||
* \param mouseX x mouse coordinate (in window coordinates)
|
||||
* \param mouseY y mouse coordinate
|
||||
* \param window The window on which the event occurred
|
||||
* \param eventType: The type of drag'n'drop event
|
||||
* \param draggedObjectType: The type object concerned
|
||||
* (currently array of file names, string, ?bitmap)
|
||||
* \param mouseX: x mouse coordinate (in window coordinates)
|
||||
* \param mouseY: y mouse coordinate
|
||||
* \param window: The window on which the event occurred
|
||||
* \return Indication whether the event was handled.
|
||||
*/
|
||||
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType,
|
||||
|
||||
@@ -88,8 +88,8 @@
|
||||
/* see [#34039] Fix Alt key glitch on Unity desktop */
|
||||
#define USE_UNITY_WORKAROUND
|
||||
|
||||
/* Fix 'shortcut' part of keyboard reading code only ever using first defined keymap instead of active one.
|
||||
* See T47228 and D1746 */
|
||||
/* Fix 'shortcut' part of keyboard reading code only ever using first defined keymap
|
||||
* instead of active one. See T47228 and D1746 */
|
||||
#define USE_NON_LATIN_KB_WORKAROUND
|
||||
|
||||
static GHOST_TKey ghost_key_from_keysym(const KeySym key);
|
||||
@@ -314,7 +314,8 @@ void GHOST_SystemX11::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param title The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
@@ -944,18 +945,19 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
* - Fallback to XLookupString to get a key_sym from active user-defined keymap.
|
||||
*
|
||||
* Note that:
|
||||
* - This effectively 'lock' main number keys to always output number events (except when using alt-gr).
|
||||
* - This enforces users to use an ascii-compatible keymap with Blender - but at least it gives
|
||||
* predictable and consistent results.
|
||||
* - This effectively 'lock' main number keys to always output number events
|
||||
* (except when using alt-gr).
|
||||
* - This enforces users to use an ascii-compatible keymap with Blender -
|
||||
* but at least it gives predictable and consistent results.
|
||||
*
|
||||
* Also, note that nothing in XLib sources [1] makes it obvious why those two functions give different
|
||||
* key_sym results...
|
||||
* Also, note that nothing in XLib sources [1] makes it obvious why those two functions give
|
||||
* different key_sym results...
|
||||
*
|
||||
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
|
||||
*/
|
||||
KeySym key_sym_str;
|
||||
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled, we do not want to apply
|
||||
* that 'forced number' hack. */
|
||||
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled,
|
||||
* we do not want to apply that 'forced number' hack. */
|
||||
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
|
||||
const unsigned int number_hack_forbidden_kmods_mask = mode_switch_mask | ShiftMask;
|
||||
if ((xke->keycode >= 10 && xke->keycode < 20) &&
|
||||
@@ -973,8 +975,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
ascii = '\0';
|
||||
}
|
||||
|
||||
/* Only allow a limited set of keys from XLookupKeysym, all others we take from XLookupString,
|
||||
* unless it gives unknown key... */
|
||||
/* Only allow a limited set of keys from XLookupKeysym,
|
||||
* all others we take from XLookupString, unless it gives unknown key... */
|
||||
gkey = ghost_key_from_keysym_or_keycode(key_sym, m_xkb_descr, xke->keycode);
|
||||
switch (gkey) {
|
||||
case GHOST_kKeyRightAlt:
|
||||
@@ -1181,7 +1183,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
XFocusChangeEvent &xfe = xe->xfocus;
|
||||
|
||||
/* TODO: make sure this is the correct place for activate/deactivate */
|
||||
// printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
|
||||
// printf("X: focus %s for window %d\n",
|
||||
// xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
|
||||
|
||||
/* May have to look at the type of event and filter some out. */
|
||||
|
||||
@@ -1233,7 +1236,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
}
|
||||
else {
|
||||
#ifdef WITH_XDND
|
||||
/* try to handle drag event (if there's no such events, GHOST_HandleClientMessage will return zero) */
|
||||
/* try to handle drag event
|
||||
* (if there's no such events, GHOST_HandleClientMessage will return zero) */
|
||||
if (window->getDropTarget()->GHOST_HandleClientMessage(xe) == false) {
|
||||
/* Unknown client message, ignore */
|
||||
}
|
||||
@@ -1267,7 +1271,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
getMilliSeconds(), GHOST_kEventCursorMove, window, xce.x_root, xce.y_root);
|
||||
}
|
||||
|
||||
// printf("X: %s window %d\n", xce.type == EnterNotify ? "entering" : "leaving", (int) xce.window);
|
||||
// printf("X: %s window %d\n",
|
||||
// xce.type == EnterNotify ? "entering" : "leaving", (int) xce.window);
|
||||
|
||||
if (xce.type == EnterNotify)
|
||||
m_windowManager->setActiveWindow(window);
|
||||
@@ -1394,9 +1399,10 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
* around tablet surface */
|
||||
window->GetTabletData()->Active = xtablet.mode;
|
||||
|
||||
/* Note: This event might be generated with incomplete dataset (don't exactly know why, looks like in
|
||||
* some cases, if the value does not change, it is not included in subsequent XDeviceMotionEvent
|
||||
* events). So we have to check which values this event actually contains!
|
||||
/* Note: This event might be generated with incomplete dataset
|
||||
* (don't exactly know why, looks like in some cases, if the value does not change,
|
||||
* it is not included in subsequent XDeviceMotionEvent events).
|
||||
* So we have to check which values this event actually contains!
|
||||
*/
|
||||
|
||||
# define AXIS_VALUE_GET(axis, val) \
|
||||
@@ -1411,8 +1417,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
* but I got garbage data without it. Found it in the xidump.c source --matt
|
||||
*
|
||||
* The '& 0xffff' just truncates the value to its two lowest bytes, this probably means
|
||||
* some drivers do not properly set the whole int value? Since we convert to float afterward,
|
||||
* I don't think we need to cast to short here, but do not have a device to check this. --mont29
|
||||
* some drivers do not properly set the whole int value? Since we convert to float
|
||||
* afterward, I don't think we need to cast to short here, but do not have a device to
|
||||
* check this. --mont29
|
||||
*/
|
||||
if (AXIS_VALUE_GET(3, axis_value)) {
|
||||
window->GetTabletData()->Xtilt = (short)(axis_value & 0xffff) /
|
||||
@@ -2277,7 +2284,7 @@ void GHOST_SystemX11::refreshXInputDevices()
|
||||
NULL;
|
||||
GHOST_TTabletMode tablet_mode = tablet_mode_from_name(device_info[i].name, device_type);
|
||||
|
||||
// printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
|
||||
// printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
|
||||
|
||||
if (device_type) {
|
||||
XFree((void *)device_type);
|
||||
|
||||
@@ -128,7 +128,8 @@ class GHOST_SystemX11 : public GHOST_System {
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param title The name of the window
|
||||
* (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
* \param top The coordinate of the top edge of the window.
|
||||
* \param width The width the window.
|
||||
@@ -241,7 +242,8 @@ class GHOST_SystemX11 : public GHOST_System {
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Called by GHOST_DropTargetX11 class.
|
||||
* \param eventType The type of drag'n'drop event
|
||||
* \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
|
||||
* \param draggedObjectType The type object concerned
|
||||
* (currently array of file names, string, ?bitmap)
|
||||
* \param mouseX x mouse coordinate (in window coordinates)
|
||||
* \param mouseY y mouse coordinate
|
||||
* \param window The window on which the event occurred
|
||||
|
||||
@@ -68,8 +68,10 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
|
||||
* virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
|
||||
* virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
|
||||
* virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
|
||||
* virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
|
||||
* virtual void screenToClient(
|
||||
* GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
|
||||
* virtual void clientToScreen(
|
||||
* GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
|
||||
* virtual GHOST_TWindowState getState() const = 0;
|
||||
* virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
|
||||
* virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
|
||||
|
||||
@@ -98,7 +98,8 @@ class GHOST_WindowCocoa : public GHOST_Window {
|
||||
|
||||
/**
|
||||
* Returns the window rectangle dimensions.
|
||||
* The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
|
||||
* The dimensions are given in screen coordinates that are
|
||||
* relative to the upper-left corner of the screen.
|
||||
* \param bounds The bounding rectangle of the window.
|
||||
*/
|
||||
void getWindowBounds(GHOST_Rect &bounds) const;
|
||||
|
||||
@@ -115,7 +115,8 @@
|
||||
//Send event only once, at end of resize operation (when user has released mouse button)
|
||||
systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
|
||||
//}
|
||||
/* Live resize, send event, gets handled in wm_window.c. Needed because live resize runs in a modal loop, not letting main loop run */
|
||||
/* Live resize, send event, gets handled in wm_window.c.
|
||||
* Needed because live resize runs in a modal loop, not letting main loop run */
|
||||
if ([[notification object] inLiveResize]) {
|
||||
systemCocoa->dispatchEvents();
|
||||
}
|
||||
@@ -136,7 +137,8 @@
|
||||
@end
|
||||
|
||||
#pragma mark NSWindow subclass
|
||||
//We need to subclass it to tell that even borderless (fullscreen), it can become key (receive user events)
|
||||
// We need to subclass it to tell that even borderless (fullscreen),
|
||||
// it can become key (receive user events)
|
||||
@interface CocoaWindow : NSWindow
|
||||
{
|
||||
GHOST_SystemCocoa *systemCocoa;
|
||||
@@ -540,7 +542,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
//Creates the window
|
||||
// Creates the window
|
||||
NSRect rect;
|
||||
NSSize minSize;
|
||||
|
||||
@@ -563,12 +565,12 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
|
||||
|
||||
[m_window setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
|
||||
|
||||
//Forbid to resize the window below the blender defined minimum one
|
||||
// Forbid to resize the window below the blender defined minimum one
|
||||
minSize.width = 320;
|
||||
minSize.height = 240;
|
||||
[m_window setContentMinSize:minSize];
|
||||
|
||||
//Creates the OpenGL View inside the window
|
||||
// Creates the OpenGL View inside the window
|
||||
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect];
|
||||
|
||||
if (m_systemCocoa->m_nativePixel) {
|
||||
@@ -670,7 +672,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String &title)
|
||||
|
||||
NSString *windowTitle = [[NSString alloc] initWithCString:title encoding:NSUTF8StringEncoding];
|
||||
|
||||
//Set associated file if applicable
|
||||
// Set associated file if applicable
|
||||
if (windowTitle && [windowTitle hasPrefix:@"Blender"]) {
|
||||
NSRange fileStrRange;
|
||||
NSString *associatedFileName;
|
||||
@@ -684,7 +686,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String &title)
|
||||
associatedFileName = [windowTitle substringWithRange:fileStrRange];
|
||||
[m_window setTitle:[associatedFileName lastPathComponent]];
|
||||
|
||||
//Blender used file open/save functions converte file names into legal URL ones
|
||||
// Blender used file open/save functions converte file names into legal URL ones
|
||||
associatedFileName = [associatedFileName
|
||||
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
@try {
|
||||
@@ -751,7 +753,7 @@ void GHOST_WindowCocoa::getClientBounds(GHOST_Rect &bounds) const
|
||||
|
||||
NSRect screenSize = [[m_window screen] visibleFrame];
|
||||
|
||||
//Max window contents as screen size (excluding title bar...)
|
||||
// Max window contents as screen size (excluding title bar...)
|
||||
NSRect contentRect = [CocoaWindow
|
||||
contentRectForFrameRect:screenSize
|
||||
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
|
||||
@@ -999,7 +1001,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
|
||||
|
||||
[m_window orderBack:nil];
|
||||
|
||||
//Check for other blender opened windows and make the frontmost key
|
||||
// Check for other blender opened windows and make the frontmost key
|
||||
windowsList = [NSApp orderedWindows];
|
||||
if ([windowsList count]) {
|
||||
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
|
||||
@@ -1227,7 +1229,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
||||
GHOST_TSuccess err = GHOST_kSuccess;
|
||||
|
||||
if (mode != GHOST_kGrabDisable) {
|
||||
//No need to perform grab without warp as it is always on in OS X
|
||||
// No need to perform grab without warp as it is always on in OS X
|
||||
if (mode != GHOST_kGrabNormal) {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@@ -1238,7 +1240,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
||||
setWindowCursorVisibility(false);
|
||||
}
|
||||
|
||||
//Make window key if it wasn't to get the mouse move events
|
||||
// Make window key if it wasn't to get the mouse move events
|
||||
[m_window makeKeyWindow];
|
||||
|
||||
[pool drain];
|
||||
@@ -1250,7 +1252,8 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
||||
setWindowCursorVisibility(true);
|
||||
}
|
||||
|
||||
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
||||
/* Almost works without but important otherwise the mouse GHOST location
|
||||
* can be incorrect on exit. */
|
||||
setCursorGrabAccum(0, 0);
|
||||
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
|
||||
}
|
||||
@@ -1350,7 +1353,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
|
||||
hotSpotPoint.x = hotX;
|
||||
hotSpotPoint.y = hotY;
|
||||
|
||||
//foreground and background color parameter is not handled for now (10.6)
|
||||
// foreground and background color parameter is not handled for now (10.6)
|
||||
m_customCursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpotPoint];
|
||||
|
||||
[cursorImageRep release];
|
||||
|
||||
@@ -121,11 +121,11 @@ GHOST_TSuccess GHOST_WindowManager::endFullScreen(void)
|
||||
GHOST_TSuccess success = GHOST_kFailure;
|
||||
if (getFullScreen()) {
|
||||
if (m_fullScreenWindow != NULL) {
|
||||
//GHOST_PRINT("GHOST_WindowManager::endFullScreen(): deleting full-screen window\n");
|
||||
// GHOST_PRINT("GHOST_WindowManager::endFullScreen(): deleting full-screen window\n");
|
||||
setWindowInactive(m_fullScreenWindow);
|
||||
m_fullScreenWindow->endFullScreen();
|
||||
delete m_fullScreenWindow;
|
||||
//GHOST_PRINT("GHOST_WindowManager::endFullScreen(): done\n");
|
||||
// GHOST_PRINT("GHOST_WindowManager::endFullScreen(): done\n");
|
||||
m_fullScreenWindow = NULL;
|
||||
if (m_activeWindowBeforeFullScreen) {
|
||||
setActiveWindow(m_activeWindowBeforeFullScreen);
|
||||
|
||||
@@ -621,7 +621,7 @@ static void sdl_cursor_init(void)
|
||||
DEF_CURSOR(bottom_right_corner, GHOST_kStandardCursorBottomRightCorner);
|
||||
DEF_CURSOR(bottom_left_corner, GHOST_kStandardCursorBottomLeftCorner);
|
||||
DEF_CURSOR(arrow, GHOST_kStandardCursorCopy);
|
||||
//DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
|
||||
// DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
|
||||
DEF_CURSOR(arrow, GHOST_kStandardCursorPencil);
|
||||
|
||||
#undef DEF_CURSOR
|
||||
|
||||
@@ -261,7 +261,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
::UpdateWindow(m_hWnd);
|
||||
}
|
||||
else {
|
||||
//invalidate the window
|
||||
// invalidate the window
|
||||
::DestroyWindow(m_hWnd);
|
||||
m_hWnd = NULL;
|
||||
}
|
||||
@@ -656,7 +656,8 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
|
||||
#if defined(WITH_GL_PROFILE_CORE)
|
||||
/* - AMD and Intel give us exactly this version
|
||||
* - NVIDIA gives at least this version <-- desired behavior
|
||||
* So we ask for 4.5, 4.4 ... 3.3 in descending order to get the best version on the user's system. */
|
||||
* So we ask for 4.5, 4.4 ... 3.3 in descending order
|
||||
* to get the best version on the user's system. */
|
||||
for (int minor = 5; minor >= 0; --minor) {
|
||||
context = new GHOST_ContextWGL(m_wantStereoVisual,
|
||||
m_wantAlphaBackground,
|
||||
@@ -700,7 +701,8 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
|
||||
}
|
||||
|
||||
#elif defined(WITH_GL_PROFILE_COMPAT)
|
||||
// ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile)
|
||||
// ask for 2.1 context, driver gives any GL version >= 2.1
|
||||
// (hopefully the latest compatibility profile)
|
||||
// 2.1 ignores the profile bit & is incompatible with core profile
|
||||
context = new GHOST_ContextWGL(m_wantStereoVisual,
|
||||
m_wantAlphaBackground,
|
||||
@@ -894,7 +896,8 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
||||
m_system->setCursorPosition(pos[0], pos[1]);
|
||||
}
|
||||
|
||||
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
||||
/* Almost works without but important otherwise the mouse GHOST location
|
||||
* can be incorrect on exit. */
|
||||
setCursorGrabAccum(0, 0);
|
||||
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
|
||||
registerMouseClickEvent(3);
|
||||
|
||||
@@ -166,8 +166,8 @@ typedef struct tagPOINTER_TOUCH_INFO {
|
||||
} POINTER_TOUCH_INFO;
|
||||
|
||||
/*
|
||||
* Macros to retrieve information from pointer input message parameters
|
||||
*/
|
||||
* Macros to retrieve information from pointer input message parameters
|
||||
*/
|
||||
#define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam))
|
||||
#define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD(wParam) & (flag)) == (flag))
|
||||
#define IS_POINTER_NEW_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_NEW)
|
||||
@@ -270,7 +270,8 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
|
||||
/**
|
||||
* Returns the window rectangle dimensions.
|
||||
* The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
|
||||
* The dimensions are given in screen coordinates that are
|
||||
* relative to the upper-left corner of the screen.
|
||||
* \param bounds The bounding rectangle of the window.
|
||||
*/
|
||||
void getWindowBounds(GHOST_Rect &bounds) const;
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
# include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
|
||||
//For DPI value
|
||||
// For DPI value
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
#include <cstring>
|
||||
@@ -132,7 +132,7 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
|
||||
display, DefaultScreen(display), glx_attribs, &nbfbconfig);
|
||||
|
||||
/* Any sample level or even zero, which means oversampling disabled, is good
|
||||
* but we need a valid visual to continue */
|
||||
* but we need a valid visual to continue */
|
||||
if (nbfbconfig > 0) {
|
||||
/* take a frame buffer config that has alpha cap */
|
||||
for (int i = 0; i < nbfbconfig; i++) {
|
||||
@@ -140,7 +140,7 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
|
||||
if (!visual)
|
||||
continue;
|
||||
/* if we don't need a alpha background, the first config will do, otherwise
|
||||
* test the alphaMask as it won't necessarily be present */
|
||||
* test the alphaMask as it won't necessarily be present */
|
||||
if (needAlpha) {
|
||||
XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
|
||||
if (!pict_format)
|
||||
@@ -167,7 +167,7 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
|
||||
XVisualInfo *visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs);
|
||||
|
||||
/* Any sample level or even zero, which means oversampling disabled, is good
|
||||
* but we need a valid visual to continue */
|
||||
* but we need a valid visual to continue */
|
||||
if (visual != NULL) {
|
||||
return visual;
|
||||
}
|
||||
@@ -1449,7 +1449,8 @@ GHOST_TSuccess GHOST_WindowX11::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
|
||||
setWindowCursorVisibility(true);
|
||||
}
|
||||
|
||||
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
||||
/* Almost works without but important
|
||||
* otherwise the mouse GHOST location can be incorrect on exit. */
|
||||
setCursorGrabAccum(0, 0);
|
||||
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
|
||||
#ifdef GHOST_X11_GRAB
|
||||
|
||||
@@ -46,7 +46,8 @@ class GHOST_DropTargetX11;
|
||||
|
||||
/**
|
||||
* X11 implementation of GHOST_IWindow.
|
||||
* Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
|
||||
* Dimensions are given in screen coordinates that are
|
||||
* relative to the upper-left corner of the screen.
|
||||
*/
|
||||
|
||||
class GHOST_WindowX11 : public GHOST_Window {
|
||||
|
||||
@@ -678,11 +678,12 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
LONG lresult;
|
||||
HKEY hkey = 0;
|
||||
DWORD dwd = 0;
|
||||
//unsigned char buffer[128];
|
||||
// unsigned char buffer[128];
|
||||
|
||||
CRegKey regkey;
|
||||
//DWORD keyValue;
|
||||
// lresult = regkey.Open(HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
|
||||
// DWORD keyValue;
|
||||
// lresult = regkey.Open(
|
||||
// HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
|
||||
lresult = regkey.Open(HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable",
|
||||
KEY_ALL_ACCESS);
|
||||
@@ -718,7 +719,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
|
||||
// Enter main loop
|
||||
while (!app.m_exitRequested) {
|
||||
//printf("main: loop\n");
|
||||
// printf("main: loop\n");
|
||||
fSystem->processEvents(true);
|
||||
fSystem->dispatchEvents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user