linux cursors. resizing ones flicker a bit currently
This commit is contained in:
parent
fde2fda466
commit
9435396741
|
@ -37,6 +37,7 @@
|
|||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
@ -103,6 +104,8 @@ struct Linux_Vars{
|
|||
Atom atom_CLIPBOARD;
|
||||
Atom atom_UTF8_STRING;
|
||||
|
||||
Application_Mouse_Cursor cursor;
|
||||
|
||||
void *app_code;
|
||||
void *custom;
|
||||
|
||||
|
@ -1553,6 +1556,14 @@ main(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
Cursor xcursors[APP_MOUSE_CURSOR_COUNT] = {
|
||||
None,
|
||||
XCreateFontCursor(linuxvars.XDisplay, XC_arrow),
|
||||
XCreateFontCursor(linuxvars.XDisplay, XC_xterm),
|
||||
XCreateFontCursor(linuxvars.XDisplay, XC_sb_h_double_arrow),
|
||||
XCreateFontCursor(linuxvars.XDisplay, XC_sb_v_double_arrow)
|
||||
};
|
||||
|
||||
XSetICFocus(linuxvars.input_context);
|
||||
|
||||
linuxvars.atom_CLIPBOARD = XInternAtom(linuxvars.XDisplay, "CLIPBOARD", False);
|
||||
|
@ -1843,6 +1854,12 @@ main(int argc, char **argv)
|
|||
usleep(frame_useconds - time_diff);
|
||||
}
|
||||
|
||||
if(result.mouse_cursor_type != linuxvars.cursor){
|
||||
Cursor c = xcursors[result.mouse_cursor_type];
|
||||
XDefineCursor(linuxvars.XDisplay, linuxvars.XWindow, c);
|
||||
linuxvars.cursor = result.mouse_cursor_type;
|
||||
}
|
||||
|
||||
linuxvars.redraw = 0;
|
||||
linuxvars.key_data = {};
|
||||
linuxvars.mouse_data.left_button_pressed = 0;
|
||||
|
|
Loading…
Reference in New Issue