Two in one:
[blender.git] / source / blender / src / ghostwinlay.c
index f08085afa06086cc2e1994da9612843b782faa3a..d63574e79f9fc002c3659285bfceebac05301e73 100644 (file)
 #include <config.h>
 #endif
 
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
 #include "MEM_guardedalloc.h"
 
 #include "DNA_listBase.h"      
 
 #ifdef __APPLE__
 #include <OpenGL/OpenGL.h>
+#define __CARBONSOUND__
 #include <Carbon/Carbon.h>
 
 /*declarations*/
-int checkAppleVideoCard();
+int checkAppleVideoCard(void);
+void getMacAvailableBounds(short *, short *, short *, short *);
+
 #endif
 ///
 
@@ -88,7 +87,6 @@ struct _Window {
        int             lmouse[2];
        int             lqual;          /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY, LR_COMMANDKEY) */
        int             lmbut;          /* (L_MOUSE, M_MOUSE, R_MOUSE) */
-       int             commandqual;
 
                /* Tracks the faked mouse button, if non-zero it is
                 * the event number of the last faked button.
@@ -114,7 +112,7 @@ struct _Window {
                
 static int macPrefState = 0;
                
-int checkAppleVideoCard() {
+int checkAppleVideoCard(void) {
        long theErr;
        unsigned long display_mask;
        CGLRendererInfoObj rend;
@@ -332,9 +330,9 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
                GHOST_kWindowStateFullScreen:GHOST_kWindowStateNormal;
 #else
 #ifdef _WIN32  // FULLSCREEN
-       if (start_maximized == G_WINDOWSTATE_FULLSCREEN)
-               inital_state= GHOST_kWindowStateFullScreen;
-       else
+//     if (start_maximized == G_WINDOWSTATE_FULLSCREEN)
+//             inital_state= GHOST_kWindowStateFullScreen;
+//     else
                inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
 #else                  // APPLE
        inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
@@ -362,6 +360,8 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
                        
                        win->lmouse[0]= win->size[0]/2;
                        win->lmouse[1]= win->size[1]/2;
+                       
+                       
                } else {
                        GHOST_DisposeWindow(g_system, ghostwin);
                }
@@ -412,7 +412,18 @@ void window_set_cursor(Window *win, int curs) {
                GHOST_SetCursorVisibility(win->ghostwin, 0);
        } else {
                GHOST_SetCursorVisibility(win->ghostwin, 1);
-               GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
+               
+               /* detect if we use system cursor or Blender cursor */
+               switch(curs) {
+                       case CURSOR_TEXTEDIT:
+                               SetBlenderCursor(BC_TEXTEDITCURSOR);
+                               break;
+                       case CURSOR_VPAINT:
+                               SetBlenderCursor(BC_PAINTBRUSHCURSOR);
+                               break;
+                       default:
+                               GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
+               }
        }
 }
 
@@ -439,6 +450,7 @@ void window_set_custom_cursor_ex(Window *win, BCursor *cursor, int useBig) {
 
 void window_make_active(Window *win) {
        if (win != active_gl_window) {
+               win->lmbut= 0;  /* keeps hanging when mousepressed while other window opened */
                active_gl_window= win;
                GHOST_ActivateWindowDrawingContext(win->ghostwin);
        }
@@ -524,7 +536,7 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                
                        if (bbut==LEFTMOUSE) {
                                if (val) {
-                                       if (win->commandqual) {
+                                       if (win->lqual & LR_COMMANDKEY) {
                                                bbut= win->faked_mbut= RIGHTMOUSE;
                                        } else if ((win->lqual & LR_ALTKEY) && (U.flag & USER_TWOBUTTONMOUSE)) {
                                                /* finally, it actually USES the userpref! :) -intrr */
@@ -556,10 +568,6 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                        int val= (type==GHOST_kEventKeyDown);
                        int bkey= convert_key(kd->key);
 
-                       if (kd->key == GHOST_kKeyCommand) {
-                               win->commandqual= val;
-                       }
-
                        if (bkey) {
                                if (bkey==LEFTSHIFTKEY || bkey==RIGHTSHIFTKEY) {
                                        win->lqual= change_bit(win->lqual, LR_SHIFTKEY, val);
@@ -609,8 +617,6 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                        win->lqual= change_bit(win->lqual, LR_COMMANDKEY, 0);
                                        window_handle(win, LR_COMMANDKEY, 0);
                                }
-                               /* probably redundant now (ton) */
-                               win->commandqual= query_qual('C');
 
                                /* 
                                 * XXX quick hack so OSX version works better
@@ -708,6 +714,11 @@ void window_get_position(Window *win, int *posx_r, int *posy_r) {
        *posy_r= win->position[1];
 }
 
+const GHOST_TabletData* window_get_tablet_data(Window *win)
+{
+       return GHOST_GetTabletData(win->ghostwin);
+}
+
 void window_get_size(Window *win, int *width_r, int *height_r) {
        *width_r= win->size[0];
        *height_r= win->size[1];
@@ -728,7 +739,8 @@ void window_raise(Window *win) {
 #endif
 }
 
-#ifdef _WIN32  //FULLSCREEN
+#if 0
+//#ifdef _WIN32        //FULLSCREEN
 void window_toggle_fullscreen(Window *win, int fullscreen) {
        /* these two lines make sure front and backbuffer are equal. for swapbuffers */
        markdirty_all();