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
path: root/intern
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2004-07-28 00:40:42 +0400
committerJean-Luc Peurière <jlp@nerim.net>2004-07-28 00:40:42 +0400
commitf3beeec296a773300999a4c7dac91e21c736f244 (patch)
treebf5470dc2de650ded78d35d14780e51e8c3999a0 /intern
parent0b9cf9006a062c8e6897b000c1204d963d1e5a4c (diff)
new window behaviour for macos X computers :
if video card is open GL accelerated and has 16 Mo or more start window in maximized mode wich is a full screen mode but keeping access to other windows and sytem menu items older comps start as usual
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp44
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.cpp69
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.h21
3 files changed, 116 insertions, 18 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index d6d6d6f7a6c..88bc859be6e 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -75,13 +75,21 @@ const EventTypeSpec kEvents[] =
{ kEventClassMouse, kEventMouseDragged },
{ kEventClassMouse, kEventMouseWheelMoved },
+ { kEventClassWindow, kEventWindowClickZoomRgn } , /* for new zoom behaviour */
+ { kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
+ { kEventClassWindow, kEventWindowExpand } , /* for new zoom behaviour */
+ { kEventClassWindow, kEventWindowExpandAll }, /* for new zoom behaviour */
+
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
{ kEventClassWindow, kEventWindowUpdate },
{ kEventClassWindow, kEventWindowBoundsChanged }
+
};
+
+
static GHOST_TButtonMask convertButton(EventMouseButton button)
{
switch (button) {
@@ -385,7 +393,9 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
)
{
GHOST_IWindow* window = 0;
- window = new GHOST_WindowCarbon (title, left, top, width, height, state, type);
+
+ window = new GHOST_WindowCarbon (title, left, top, width, height, state, type);
+
if (window) {
if (window->getValid()) {
// Store the pointer to the window
@@ -633,7 +643,7 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
return err;
}
- if (!getFullScreen()) {
+ //if (!getFullScreen()) {
err = noErr;
switch(::GetEventKind(event))
{
@@ -664,7 +674,7 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
err = eventNotHandledErr;
break;
}
- }
+// }
//else {
//window = (GHOST_WindowCarbon*) m_windowManager->getFullScreenWindow();
//GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen window event, " << window << "\n");
@@ -770,7 +780,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
key = convertKey(rawCode);
ascii= convertRomanToLatin(ascii);
- if (key!=GHOST_kKeyUnknown) {
+ // if (key!=GHOST_kKeyUnknown) {
GHOST_TEventType type;
if (kind == kEventRawKeyDown) {
type = GHOST_kEventKeyDown;
@@ -780,7 +790,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
type = GHOST_kEventKeyUp;
}
pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii) );
- }
+// }
break;
case kEventRawKeyModifiersChanged:
@@ -817,13 +827,13 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
short part;
BitMap screenBits;
bool handled = true;
- GHOST_IWindow* ghostWindow;
+ GHOST_WindowCarbon* ghostWindow;
Point mousePos = {0 , 0};
::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
part = ::FindWindow(mousePos, &window);
- ghostWindow = (GHOST_IWindow*) ::GetWRefCon(window);
+ ghostWindow = (GHOST_WindowCarbon*) ::GetWRefCon(window);
switch (part) {
case inMenuBar:
@@ -880,7 +890,25 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
case inZoomOut:
GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
if (::TrackBox(window, mousePos, part)) {
- ::ZoomWindow(window, part, true);
+ int macState;
+
+ macState = ghostWindow->getMac_windowState();
+ if ( macState== 0)
+ ::ZoomWindow(window, part, true);
+ else
+ if (macState == 2) { // always ok
+ ::ZoomWindow(window, part, true);
+ ghostWindow->setMac_windowState(1);
+ } else { // need to force size again
+ GHOST_TUns32 scr_x,scr_y;
+
+ ghostWindow->setMac_windowState(2);
+
+ this->getMainDisplayDimensions(scr_x,scr_y);
+ ::SizeWindow (window, scr_x,scr_y-22,false);
+ ::MoveWindow (window, 1,22,true);
+ }
+
}
break;
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp
index 516a753f4b2..518fdf605bc 100644
--- a/intern/ghost/intern/GHOST_WindowCarbon.cpp
+++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp
@@ -66,8 +66,33 @@ AGL_DEPTH_SIZE, 16,
AGL_NONE,
};
+
+
WindowRef ugly_hack=NULL;
+const EventTypeSpec kWEvents[] = {
+ { kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
+};
+
+static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData) {
+ WindowRef mywindow;
+ GHOST_WindowCarbon *ghost_window;
+ OSStatus err;
+ int theState;
+
+ if (::GetEventKind(event) == kEventWindowZoom) {
+ err = ::GetEventParameter (event,kEventParamDirectObject,typeWindowRef,NULL,sizeof(mywindow),NULL, &mywindow);
+ ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
+ theState = ghost_window->getMac_windowState();
+ if (theState == 1)
+ ghost_window->setMac_windowState(2);
+ else if (theState == 2)
+ ghost_window->setMac_windowState(1);
+
+ }
+ return eventNotHandledErr;
+}
+
GHOST_WindowCarbon::GHOST_WindowCarbon(
const STR_String& title,
GHOST_TInt32 left,
@@ -86,21 +111,36 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
m_fullScreenDirty(false)
{
Str255 title255;
+ OSStatus err;
+
+ if (state >= 8 ) {
+ state = state - 8;
+ setMac_windowState(2);
+ } else
+ setMac_windowState(0);
if (state != GHOST_kWindowStateFullScreen) {
Rect bnds = { top, left, top+height, left+width };
Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized);
gen2mac(title, title255);
- m_windowRef = ::NewCWindow(
- nil, // Storage
- &bnds, // Bounding rectangle of the window
- title255, // Title of the window
- visible, // Window initially visible
- kWindowFullZoomGrowDocumentProc, //kWindowGrowDocumentProc, // procID
- (WindowRef)-1L, // Put window before all other windows
- true, // Window has minimize box
- (SInt32)this); // Store a pointer to the class in the refCon
+ err = ::CreateNewWindow( kDocumentWindowClass,
+ kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute,
+ &bnds,
+ &m_windowRef);
+ if ( err != noErr) {
+ fprintf(stderr," error creating window %i \n",err);
+ } else {
+ //void *handler = &GHOST_WindowCarbon::myWEventHandlerProc;
+
+ ::SetWRefCon(m_windowRef,(SInt32)this);
+ err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
+ if ( err != noErr) {
+ fprintf(stderr," error creating handler %i \n",err);
+ } else {
+ ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
+ }
+ }
if (m_windowRef) {
m_grafPtr = ::GetWindowPort(m_windowRef);
setDrawingContextType(type);
@@ -654,3 +694,14 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap
{
setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*) mask, 16, 16, hotX, hotY, 0, 1);
}
+
+
+void GHOST_WindowCarbon::setMac_windowState(short value)
+{
+ mac_windowState = value;
+}
+
+short GHOST_WindowCarbon::getMac_windowState()
+{
+ return mac_windowState;
+}
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.h b/intern/ghost/intern/GHOST_WindowCarbon.h
index 289ad44dc6b..dbf45882705 100644
--- a/intern/ghost/intern/GHOST_WindowCarbon.h
+++ b/intern/ghost/intern/GHOST_WindowCarbon.h
@@ -207,6 +207,11 @@ public:
*/
virtual bool getFullScreenDirty();
+ /* accessor for fullscreen window */
+ virtual void setMac_windowState(short value);
+ virtual short getMac_windowState();
+
+
protected:
/**
* Tries to install a rendering context in this window.
@@ -261,7 +266,7 @@ protected:
* @param out The converted string object.
*/
virtual void mac2gen(const Str255 in, STR_String& out) const;
-
+
WindowRef m_windowRef;
CGrafPtr m_grafPtr;
AGLContext m_aglCtx;
@@ -273,6 +278,20 @@ protected:
/** When running in full-screen this tells whether to refresh the window. */
bool m_fullScreenDirty;
+
+ /** specific MacOs X full screen window setting as we use partially system mechanism
+ values : 0 not maximizable default
+ 1 normal state
+ 2 maximized state
+
+ this will be reworked when rebuilding GHOST carbon to use new OS X apis
+ in order to be unified with GHOST fullscreen/maximised settings
+
+ (lukep)
+ **/
+
+ short mac_windowState;
+
/**
* The width/height of the size rectangle in the lower right corner of a