* 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
This commit is contained in:
2003-07-10 20:34:41 +00:00
parent f999426daa
commit ad6ddb4689
3 changed files with 27 additions and 15 deletions

View File

@@ -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! float xf=(float)x, yf=(float)y;
return GHOST_kFailure;
CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0);
return GHOST_kSuccess;
} }

View File

@@ -34,6 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <string.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
@@ -288,7 +289,7 @@ int gesture(void)
return 1; return 1;
} }
return 0; else return 0;
} }
void mouse_cursor(void) void mouse_cursor(void)
@@ -397,6 +398,7 @@ static void deselectall_ex(Base *b) /* deselect all except b */
countall(); 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) static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
{ {
Base *base; Base *base;
@@ -483,7 +485,7 @@ void set_active_object(Object *ob)
void mouse_select(void) void mouse_select(void)
{ {
Base *base, *startbase=0, *basact=0, *oldbasact; Base *base, *startbase=0, *basact=0, *oldbasact;
GLuint buffer[MAXPICKBUF]; unsigned int buffer[MAXPICKBUF];
int temp, a, dist=100; int temp, a, dist=100;
short hits, mval[2]; short hits, mval[2];
@@ -619,8 +621,7 @@ void borderselect(void)
BPoint *bp; BPoint *bp;
MetaElem *ml; MetaElem *ml;
struct EditVert *eve; struct EditVert *eve;
/* was IGLuint */ unsigned int buffer[MAXPICKBUF];
GLuint buffer[MAXPICKBUF];
int a, index; int a, index;
short hits, val, tel; short hits, val, tel;

View File

@@ -1728,6 +1728,14 @@ static void ui_set_name_menu(uiBut *but, int value)
menudata_free(md); 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) static int ui_do_but_MENU(uiBut *but)
{ {
@@ -1850,7 +1858,7 @@ static int ui_do_but_MENU(uiBut *but)
starty= endy-height; 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[0]= mval[0];
mousemove[1]= mval[1]; mousemove[1]= mval[1];
@@ -1884,7 +1892,7 @@ static int ui_do_but_MENU(uiBut *but)
menudata_free(md); 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; but->flag &= ~UI_SELECT;
ui_check_but(but); ui_check_but(but);
@@ -3305,7 +3313,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(block->win != mywinget()) return UI_NOTHING; if(block->win != mywinget()) return UI_NOTHING;
/* filter some unwanted events */ /* 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(block->flag & UI_BLOCK_ENTER_OK) {
if(uevent->event == RETKEY && uevent->val) { if(uevent->event == RETKEY && uevent->val) {
@@ -3702,7 +3710,7 @@ int uiDoBlocks(ListBase *lb, int event)
} }
retval= ui_do_block(block, &uevent); retval= ui_do_block(block, &uevent);
if(block->frontbuf == UI_HAS_DRAW_FRONT) { if(block->frontbuf == UI_HAS_DRAW_FRONT) {
glFinish(); glFinish();
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
@@ -4583,7 +4591,7 @@ short pupmenu(char *instr)
} }
if(mouseymove) { if(mouseymove) {
warp_pointer(mval[0], mouseymove+mval[1]); ui_warp_pointer(mval[0], mouseymove+mval[1]);
mousexmove= mval[0]; mousexmove= mval[0];
mouseymove= mval[1]; mouseymove= mval[1];
} }
@@ -4622,7 +4630,7 @@ short pupmenu(char *instr)
menudata_free(md); 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; return val;
} }
@@ -4744,7 +4752,7 @@ short pupmenu_col(char *instr, int maxrow)
starty= endy-height; 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[0]= mval[0];
mousemove[1]= mval[1]; mousemove[1]= mval[1];
@@ -4773,7 +4781,7 @@ short pupmenu_col(char *instr, int maxrow)
menudata_free(md); 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; return val;
} }