aboutsummaryrefslogtreecommitdiffstats
path: root/src/glut/glx/glut_cursor.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-07-14 17:28:52 +0100
committerJosé Fonseca <[email protected]>2011-07-14 17:35:05 +0100
commit9a7f84d6b28e180ef79349b36de9a5d58a1e2dc9 (patch)
tree31d2acf247f5a0738ed7656f86125fa065ce0a36 /src/glut/glx/glut_cursor.c
parentff2efdf5997d20b41f7a82b77118366e6fbd23bc (diff)
Squashed commit of the following:
commit 1856230d9fa61710cce3e152b8d88b1269611a73 Author: José Fonseca <[email protected]> Date: Tue Jul 12 23:41:27 2011 +0100 make: Use better var names on packaging. commit d1ae72d0bd14e820ecfe9f8f27b316f9566ceb0c Author: José Fonseca <[email protected]> Date: Tue Jul 12 23:38:21 2011 +0100 make: Apply several of Dan Nicholson's suggestions. commit f27cf8743ac9cbf4c0ad66aff0cd3f97efde97e4 Author: José Fonseca <[email protected]> Date: Sat Jul 9 14:18:20 2011 +0100 make: Put back the tar.bz2 creation rule. Removed by accident. commit 34983337f9d7db984e9f0117808274106d262110 Author: José Fonseca <[email protected]> Date: Sat Jul 9 11:59:29 2011 +0100 make: Determine tarballs contents via git ls-files. The wildcards were a mess: - lots of files for non Linux platforms missing - several files listed and archived twice Using git-ls-files ensures things are not loss when making the tarballs. commit 34a28ccbf459ed5710aafba5e7149e8291cb808c Author: José Fonseca <[email protected]> Date: Sat Jul 9 11:07:14 2011 +0100 glut: Remove GLUT source. Most distros ship freeglut, and most people don't care one vs the other, and it hasn't been really maintained. So it is better to have Mesa GLUT be revisioned and built separately from Mesa. commit 5c26a2c3c0c7e95ef853e19d12d75c4f80137e7d Author: José Fonseca <[email protected]> Date: Sat Jul 9 10:31:02 2011 +0100 Ignore the tarballs. commit 26edecac589819f0d0efe2165ab748dbc4e53394 Author: José Fonseca <[email protected]> Date: Sat Jul 9 10:30:24 2011 +0100 make: Create the Mesa-xxx-devel symlink automatically. Also actually remote the intermediate uncompressed tarballs.
Diffstat (limited to 'src/glut/glx/glut_cursor.c')
-rw-r--r--src/glut/glx/glut_cursor.c201
1 files changed, 0 insertions, 201 deletions
diff --git a/src/glut/glx/glut_cursor.c b/src/glut/glx/glut_cursor.c
deleted file mode 100644
index 797cb49fb09..00000000000
--- a/src/glut/glx/glut_cursor.c
+++ /dev/null
@@ -1,201 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1995, 1998. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-#include "glutint.h"
-
-#if !defined(_WIN32)
-#include <X11/Xatom.h> /* For XA_CURSOR */
-#include <X11/cursorfont.h>
-#endif
-
-typedef struct _CursorTable {
-#if defined(_WIN32)
- char* glyph;
-#else
- int glyph;
-#endif
- Cursor cursor;
-} CursorTable;
-/* *INDENT-OFF* */
-
-static CursorTable cursorTable[] = {
- {XC_arrow, None}, /* GLUT_CURSOR_RIGHT_ARROW */
- {XC_top_left_arrow, None}, /* GLUT_CURSOR_LEFT_ARROW */
- {XC_hand1, None}, /* GLUT_CURSOR_INFO */
- {XC_pirate, None}, /* GLUT_CURSOR_DESTROY */
- {XC_question_arrow, None}, /* GLUT_CURSOR_HELP */
- {XC_exchange, None}, /* GLUT_CURSOR_CYCLE */
- {XC_spraycan, None}, /* GLUT_CURSOR_SPRAY */
- {XC_watch, None}, /* GLUT_CURSOR_WAIT */
- {XC_xterm, None}, /* GLUT_CURSOR_TEXT */
- {XC_crosshair, None}, /* GLUT_CURSOR_CROSSHAIR */
- {XC_sb_v_double_arrow, None}, /* GLUT_CURSOR_UP_DOWN */
- {XC_sb_h_double_arrow, None}, /* GLUT_CURSOR_LEFT_RIGHT */
- {XC_top_side, None}, /* GLUT_CURSOR_TOP_SIDE */
- {XC_bottom_side, None}, /* GLUT_CURSOR_BOTTOM_SIDE */
- {XC_left_side, None}, /* GLUT_CURSOR_LEFT_SIDE */
- {XC_right_side, None}, /* GLUT_CURSOR_RIGHT_SIDE */
- {XC_top_left_corner, None}, /* GLUT_CURSOR_TOP_LEFT_CORNER */
- {XC_top_right_corner, None}, /* GLUT_CURSOR_TOP_RIGHT_CORNER */
- {XC_bottom_right_corner, None}, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */
- {XC_bottom_left_corner, None}, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */
-};
-/* *INDENT-ON* */
-
-#if !defined(_WIN32)
-static Cursor blankCursor = None;
-static Cursor fullCrosshairCusor = None;
-
-/* SGI X server's support a special property called the
- _SGI_CROSSHAIR_CURSOR that when installed as a window's
- cursor, becomes a full screen crosshair cursor. SGI
- has special cursor generation hardware for this case. */
-static Cursor
-getFullCrosshairCursor(void)
-{
- Cursor cursor;
- Atom crosshairAtom, actualType;
- int rc, actualFormat;
- unsigned long n, left;
- unsigned char *value;
-
- if (fullCrosshairCusor == None) {
- crosshairAtom = XInternAtom(__glutDisplay,
- "_SGI_CROSSHAIR_CURSOR", True);
- if (crosshairAtom != None) {
- value = 0; /* Make compiler happy. */
- rc = XGetWindowProperty(__glutDisplay, __glutRoot,
- crosshairAtom, 0, 1, False, XA_CURSOR, &actualType,
- &actualFormat, &n, &left, &value);
- if (rc == Success && actualFormat == 32 && n >= 1) {
- cursor = ((unsigned long *)value)[0];
- XFree(value);
- return cursor;
- }
- }
- }
- return XCreateFontCursor(__glutDisplay, XC_crosshair);
-}
-
-/* X11 forces you to create a blank cursor if you want
- to disable the cursor. */
-static Cursor
-makeBlankCursor(void)
-{
- static char data[1] =
- {0};
- Cursor cursor;
- Pixmap blank;
- XColor dummy;
-
- blank = XCreateBitmapFromData(__glutDisplay, __glutRoot,
- data, 1, 1);
- if (blank == None)
- __glutFatalError("out of memory.");
- cursor = XCreatePixmapCursor(__glutDisplay, blank, blank,
- &dummy, &dummy, 0, 0);
- XFreePixmap(__glutDisplay, blank);
-
- return cursor;
-}
-#endif /* !_WIN32 */
-
-/* Win32 and X11 use this same function to accomplish
- fairly different tasks. X11 lets you just define the
- cursor for a window and the window system takes care
- of making sure that the window's cursor is installed
- when the mouse is in the window. Win32 requires the
- application to handle a WM_SETCURSOR message to install
- the right cursor when windows are entered. Think of
- the Win32 __glutSetCursor (called from __glutWindowProc)
- as "install cursor". Think of the X11 __glutSetCursor
- (called from glutSetCursor) as "define cursor". */
-void
-__glutSetCursor(GLUTwindow *window)
-{
- int cursor = window->cursor;
- Cursor xcursor = 0;
-
- if (cursor >= 0 &&
- cursor < sizeof(cursorTable) / sizeof(cursorTable[0])) {
- if (cursorTable[cursor].cursor == None) {
- cursorTable[cursor].cursor = XCreateFontCursor(__glutDisplay,
- cursorTable[cursor].glyph);
- }
- xcursor = cursorTable[cursor].cursor;
- } else {
- /* Special cases. */
- switch (cursor) {
- case GLUT_CURSOR_INHERIT:
-#if defined(_WIN32)
- while (window->parent) {
- window = window->parent;
- if (window->cursor != GLUT_CURSOR_INHERIT) {
- __glutSetCursor(window);
- return;
- }
- }
- /* XXX Default to an arrow cursor. Is this
- right or should we be letting the default
- window proc be installing some system cursor? */
- xcursor = cursorTable[0].cursor;
- if (xcursor == NULL) {
- xcursor =
- cursorTable[0].cursor =
- LoadCursor(NULL, cursorTable[0].glyph);
- }
-#else
- xcursor = None;
-#endif
- break;
- case GLUT_CURSOR_NONE:
-#if defined(_WIN32)
- xcursor = NULL;
-#else
- if (blankCursor == None) {
- blankCursor = makeBlankCursor();
- }
- xcursor = blankCursor;
-#endif
- break;
- case GLUT_CURSOR_FULL_CROSSHAIR:
-#if defined(_WIN32)
- xcursor = (HICON) IDC_CROSS;
-#else
- if (fullCrosshairCusor == None) {
- fullCrosshairCusor = getFullCrosshairCursor();
- }
- xcursor = fullCrosshairCusor;
-#endif
- break;
- }
- }
- XDefineCursor(__glutDisplay,
- window->win, xcursor);
- XFlush(__glutDisplay);
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutSetCursor(int cursor)
-{
-#ifdef _WIN32
- POINT point;
-
- __glutCurrentWindow->cursor = cursor;
- /* Are we in the window right now? If so,
- install the cursor. */
- GetCursorPos(&point);
- if (__glutCurrentWindow->win == WindowFromPoint(point)) {
- __glutSetCursor(__glutCurrentWindow);
- }
-#else
- __glutCurrentWindow->cursor = cursor;
- __glutSetCursor(__glutCurrentWindow);
-#endif
-}
-/* ENDCENTRY */