- ugh, do not break open an abstract data type just to add one single
function, especially when you are introducing extra dependencies
(GHOST) on files that should not have them.
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
#include "BIF_graphics.h"
|
||||
#include "BIF_screen.h"
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
#include "winlay.h"
|
||||
|
||||
|
||||
@@ -99,7 +98,6 @@ void SetBlenderCursor(short curs){
|
||||
win=winlay_get_active_window();
|
||||
|
||||
if (win==NULL) return; /* Can't set custom cursor before Window init */
|
||||
if (win->ghostwin==NULL) return;
|
||||
|
||||
LastCursor=CurrentCursor;
|
||||
CurrentCursor=curs;
|
||||
@@ -110,23 +108,10 @@ void SetBlenderCursor(short curs){
|
||||
set_cursor(CURSOR_STD);
|
||||
}
|
||||
else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
|
||||
/*printf("setting small cursor\n");*/
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
BlenderCursor[curs]->small_bm, BlenderCursor[curs]->small_mask,
|
||||
BlenderCursor[curs]->small_sizex,BlenderCursor[curs]->small_sizey,
|
||||
BlenderCursor[curs]->small_hotx,BlenderCursor[curs]->small_hoty,
|
||||
BlenderCursor[curs]->fg_color, BlenderCursor[curs]->bg_color
|
||||
);
|
||||
window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
|
||||
}
|
||||
else {
|
||||
/*printf("setting big cursor\n");*/
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
BlenderCursor[curs]->big_bm, BlenderCursor[curs]->big_mask,
|
||||
BlenderCursor[curs]->big_sizex,BlenderCursor[curs]->big_sizey,
|
||||
BlenderCursor[curs]->big_hotx,BlenderCursor[curs]->big_hoty,
|
||||
BlenderCursor[curs]->fg_color, BlenderCursor[curs]->bg_color
|
||||
);
|
||||
|
||||
window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,12 +57,43 @@
|
||||
#include "BIF_mywindow.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_usiblender.h"
|
||||
#include "BIF_cursors.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
#include "blendef.h"
|
||||
|
||||
#include "winlay.h"
|
||||
|
||||
///
|
||||
|
||||
struct _Window {
|
||||
GHOST_WindowHandle ghostwin;
|
||||
|
||||
/* Handler and private data for handler */
|
||||
WindowHandlerFP handler;
|
||||
void *user_data;
|
||||
|
||||
/* Window state */
|
||||
int size[2], position[2];
|
||||
int active, visible;
|
||||
|
||||
/* Last known mouse/button/qualifier state */
|
||||
int lmouse[2];
|
||||
int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY) */
|
||||
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.
|
||||
*/
|
||||
int faked_mbut;
|
||||
|
||||
GHOST_TimerTaskHandle timer;
|
||||
int timer_event;
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
static GHOST_SystemHandle g_system= 0;
|
||||
|
||||
/* Some simple ghost <-> blender conversions */
|
||||
@@ -306,6 +337,22 @@ void window_set_custom_cursor(Window *win, unsigned char mask[16][2],
|
||||
GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
|
||||
}
|
||||
|
||||
void window_set_custom_cursor_ex(Window *win, BCursor *cursor, int useBig) {
|
||||
if (useBig) {
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
cursor->big_bm, cursor->big_mask,
|
||||
cursor->big_sizex,cursor->big_sizey,
|
||||
cursor->big_hotx,cursor->big_hoty,
|
||||
cursor->fg_color, cursor->bg_color);
|
||||
} else {
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
cursor->small_bm, cursor->small_mask,
|
||||
cursor->small_sizex,cursor->small_sizey,
|
||||
cursor->small_hotx,cursor->small_hoty,
|
||||
cursor->fg_color, cursor->bg_color);
|
||||
}
|
||||
}
|
||||
|
||||
void window_make_active(Window *win) {
|
||||
if (win != active_gl_window) {
|
||||
active_gl_window= win;
|
||||
|
||||
@@ -32,9 +32,8 @@
|
||||
|
||||
/* Abstract window operations */
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
|
||||
typedef struct _Window Window;
|
||||
typedef struct BCursor BCursor;
|
||||
typedef void (*WindowHandlerFP) (Window *win, void *user_data, short evt, short val, char ascii);
|
||||
|
||||
Window* window_open (char *title, int x, int y, int width, int height, int start_maximized);
|
||||
@@ -68,6 +67,7 @@ void window_set_title (Window *win, char *title);
|
||||
void window_set_cursor (Window *win, int cursor);
|
||||
void window_set_custom_cursor (Window *win, unsigned char mask[16][2],
|
||||
unsigned char bitmap[16][2], int hotx, int hoty );
|
||||
void window_set_custom_cursor_ex (Window *win, BCursor *cursor, int useBig);
|
||||
|
||||
void window_warp_pointer (Window *win, int x, int y);
|
||||
|
||||
@@ -80,30 +80,3 @@ Window* winlay_get_active_window(void);
|
||||
void winlay_process_events (int wait_for_event);
|
||||
|
||||
void winlay_get_screensize (int *width_r, int *height_r);
|
||||
|
||||
|
||||
struct _Window {
|
||||
GHOST_WindowHandle ghostwin;
|
||||
|
||||
/* Handler and private data for handler */
|
||||
WindowHandlerFP handler;
|
||||
void *user_data;
|
||||
|
||||
/* Window state */
|
||||
int size[2], position[2];
|
||||
int active, visible;
|
||||
|
||||
/* Last known mouse/button/qualifier state */
|
||||
int lmouse[2];
|
||||
int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY) */
|
||||
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.
|
||||
*/
|
||||
int faked_mbut;
|
||||
|
||||
GHOST_TimerTaskHandle timer;
|
||||
int timer_event;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user