diff options
author | Ton Roosendaal <ton@blender.org> | 2003-07-11 00:34:41 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-07-11 00:34:41 +0400 |
commit | ad6ddb4689cd9463c37a600c5af85b6799ec054c (patch) | |
tree | 719049639afdb485ffc4047f24386c526fa3ea01 | |
parent | f999426daaf98c3abdb65ae6b78a9463ebcad0dd (diff) |
* cursor now moves with arrow keys again for OSX
* this apple method to do it generates unwanted events, so it could not
be used for the menu mouse-move trick. this is #ifdeffed
* we should re-evaluate if this mousemove should remain in blender...
there are better ways (scrolling contents of pup)
* plus: removed warnings from drawview.c
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 9 | ||||
-rw-r--r-- | source/blender/src/editview.c | 9 | ||||
-rw-r--r-- | source/blender/src/interface.c | 24 |
3 files changed, 27 insertions, 15 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 2f89818ac99..0dd65f4e76f 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -465,10 +465,13 @@ GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt } -GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 /*x*/, GHOST_TInt32 /*y*/) const +GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const { - // Not supported in Carbon! - return GHOST_kFailure; + float xf=(float)x, yf=(float)y; + + CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0); + + return GHOST_kSuccess; } diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 72df0915900..0d012b0b3cb 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -34,6 +34,7 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> +#include <string.h> #ifdef HAVE_CONFIG_H #include <config.h> @@ -288,7 +289,7 @@ int gesture(void) return 1; } - return 0; + else return 0; } void mouse_cursor(void) @@ -397,6 +398,7 @@ static void deselectall_ex(Base *b) /* deselect all except b */ countall(); } +/* smart function to sample a rect spiralling outside, nice for backbuf selection */ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo) { Base *base; @@ -483,7 +485,7 @@ void set_active_object(Object *ob) void mouse_select(void) { Base *base, *startbase=0, *basact=0, *oldbasact; - GLuint buffer[MAXPICKBUF]; + unsigned int buffer[MAXPICKBUF]; int temp, a, dist=100; short hits, mval[2]; @@ -619,8 +621,7 @@ void borderselect(void) BPoint *bp; MetaElem *ml; struct EditVert *eve; - /* was IGLuint */ - GLuint buffer[MAXPICKBUF]; + unsigned int buffer[MAXPICKBUF]; int a, index; short hits, val, tel; diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index c779d696464..d2a6f9c27bb 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -1728,6 +1728,14 @@ static void ui_set_name_menu(uiBut *but, int value) menudata_free(md); } +static ui_warp_pointer(short x, short y) +{ + /* OSX has very poor mousewarp support, it sends events; + this causes a menu being pressed immediately ... */ + #ifndef __APPLE__ + warp_pointer(x, y); + #endif +} static int ui_do_but_MENU(uiBut *but) { @@ -1850,7 +1858,7 @@ static int ui_do_but_MENU(uiBut *but) starty= endy-height; } - warp_pointer(mval[0]+mousemove[0], mval[1]+mousemove[1]); + ui_warp_pointer(mval[0]+mousemove[0], mval[1]+mousemove[1]); mousemove[0]= mval[0]; mousemove[1]= mval[1]; @@ -1884,7 +1892,7 @@ static int ui_do_but_MENU(uiBut *but) menudata_free(md); - if((event & UI_RETURN_OUT)==0) warp_pointer(mousemove[0], mousemove[1]); + if((event & UI_RETURN_OUT)==0) ui_warp_pointer(mousemove[0], mousemove[1]); but->flag &= ~UI_SELECT; ui_check_but(but); @@ -3305,7 +3313,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) if(block->win != mywinget()) return UI_NOTHING; /* filter some unwanted events */ - if(uevent->event==LEFTSHIFTKEY || uevent->event==RIGHTSHIFTKEY) return UI_NOTHING; + if(uevent->event==0 || uevent->event==LEFTSHIFTKEY || uevent->event==RIGHTSHIFTKEY) return UI_NOTHING; if(block->flag & UI_BLOCK_ENTER_OK) { if(uevent->event == RETKEY && uevent->val) { @@ -3702,7 +3710,7 @@ int uiDoBlocks(ListBase *lb, int event) } retval= ui_do_block(block, &uevent); - + if(block->frontbuf == UI_HAS_DRAW_FRONT) { glFinish(); glDrawBuffer(GL_BACK); @@ -4583,7 +4591,7 @@ short pupmenu(char *instr) } if(mouseymove) { - warp_pointer(mval[0], mouseymove+mval[1]); + ui_warp_pointer(mval[0], mouseymove+mval[1]); mousexmove= mval[0]; mouseymove= mval[1]; } @@ -4622,7 +4630,7 @@ short pupmenu(char *instr) menudata_free(md); - if(mouseymove && (event & UI_RETURN_OUT)==0) warp_pointer(mousexmove, mouseymove); + if(mouseymove && (event & UI_RETURN_OUT)==0) ui_warp_pointer(mousexmove, mouseymove); return val; } @@ -4744,7 +4752,7 @@ short pupmenu_col(char *instr, int maxrow) starty= endy-height; } - warp_pointer(mval[0]+mousemove[0], mval[1]+mousemove[1]); + ui_warp_pointer(mval[0]+mousemove[0], mval[1]+mousemove[1]); mousemove[0]= mval[0]; mousemove[1]= mval[1]; @@ -4773,7 +4781,7 @@ short pupmenu_col(char *instr, int maxrow) menudata_free(md); - if((event & UI_RETURN_OUT)==0) warp_pointer(mousemove[0], mousemove[1]); + if((event & UI_RETURN_OUT)==0) ui_warp_pointer(mousemove[0], mousemove[1]); return val; } |