|
|
| version 1.1, 2004/07/14 16:01:40 | version 1.5, 2007/01/10 18:03:46 |
|---|---|
| Line 10 | Line 10 |
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. |
| * 3. The name of the author may not be used to endorse or promote products | |
| * derived from this software without specific prior written permission. | |
| * | * |
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| Line 39 typedef struct { | Line 37 typedef struct { |
| int lastmouse; // working | int lastmouse; // working |
| short mousex; | short mousex; |
| short mousey; | short mousey; |
| BYTE mouseb; | UINT8 mouseb; |
| BYTE mouse_move_ratio; | UINT8 mouse_move_ratio; |
| BYTE mouse_move_mul; | UINT8 mouse_move_mul; |
| BYTE mouse_move_div; | UINT8 mouse_move_div; |
| GdkPixmap *cursor_pixmap; | GdkPixmap *cursor_pixmap; |
| GdkCursor *cursor; | GdkCursor *cursor; |
| Line 72 mousemng_initialize(void) | Line 70 mousemng_initialize(void) |
| ms = ms_default; | ms = ms_default; |
| ms.cursor_pixmap = gdk_pixmap_create_from_data(drawarea->window, | ms.cursor_pixmap = gdk_pixmap_create_from_data(main_window->window, |
| hide_cursor, 16, 16, 1, | hide_cursor, 16, 16, 1, |
| &drawarea->style->black, &drawarea->style->black); | &main_window->style->black, &main_window->style->black); |
| ms.cursor = gdk_cursor_new_from_pixmap(ms.cursor_pixmap, | ms.cursor = gdk_cursor_new_from_pixmap(ms.cursor_pixmap, |
| ms.cursor_pixmap, &drawarea->style->black, &drawarea->style->black, | ms.cursor_pixmap, &main_window->style->black, |
| 0, 0); | &main_window->style->black, 0, 0); |
| return SUCCESS; | return SUCCESS; |
| } | } |
| Line 87 mousemng_term(void) | Line 85 mousemng_term(void) |
| { | { |
| if (ms.cursor_pixmap) { | if (ms.cursor_pixmap) { |
| gdk_pixmap_unref(ms.cursor_pixmap); | g_object_unref(ms.cursor_pixmap); |
| ms.cursor_pixmap = NULL; | ms.cursor_pixmap = NULL; |
| } | } |
| } | } |
| Line 108 mouseonoff(int flag) | Line 106 mouseonoff(int flag) |
| if ((ms.lastmouse ^ flag) & 1) { | if ((ms.lastmouse ^ flag) & 1) { |
| ms.lastmouse = flag & 1; | ms.lastmouse = flag & 1; |
| if (ms.lastmouse) { | if (ms.lastmouse) { |
| gdk_pointer_grab(drawarea->window, TRUE, 0, | gdk_pointer_grab(main_window->window, TRUE, 0, |
| drawarea->window, ms.cursor, 0); | main_window->window, ms.cursor, 0); |
| getmaincenter(drawarea, &curx, &cury); | getmaincenter(main_window, &curx, &cury); |
| gdk_window_set_pointer(drawarea->window, curx, cury); | gdk_window_set_pointer(main_window->window, curx, cury); |
| } else { | } else { |
| gdk_pointer_ungrab(0); | gdk_pointer_ungrab(0); |
| } | } |
| } | } |
| } | } |
| BYTE | UINT8 |
| mouse_flag(void) | mouse_flag(void) |
| { | { |
| Line 126 mouse_flag(void) | Line 124 mouse_flag(void) |
| } | } |
| void | void |
| mouse_running(BYTE flg) | mouse_running(UINT8 flg) |
| { | { |
| BYTE mf = ms.mouserunning; | UINT8 mf = ms.mouserunning; |
| switch (flg & 0xc0) { | switch (flg & 0xc0) { |
| case 0x00: | case 0x00: |
| Line 157 mousemng_callback(void) | Line 155 mousemng_callback(void) |
| int cx, cy; | int cx, cy; |
| if (ms.lastmouse & 1) { | if (ms.lastmouse & 1) { |
| gdk_window_get_pointer(drawarea->window, &wx, &wy, NULL); | gdk_window_get_pointer(main_window->window, &wx, &wy, NULL); |
| getmaincenter(drawarea, &cx, &cy); | getmaincenter(main_window, &cx, &cy); |
| ms.mousex += (short)((wx - cx) / 2); | ms.mousex += (short)((wx - cx) / 2); |
| ms.mousey += (short)((wy - cy) / 2); | ms.mousey += (short)((wy - cy) / 2); |
| gdk_window_set_pointer(drawarea->window, cx, cy); | gdk_window_set_pointer(main_window->window, cx, cy); |
| } | } |
| } | } |
| BYTE | UINT8 |
| mouse_btn(BYTE button) | mouse_btn(UINT8 button) |
| { | { |
| if ((ms.lastmouse & 1) == 0) | if ((ms.lastmouse & 1) == 0) |
| Line 192 mouse_btn(BYTE button) | Line 190 mouse_btn(BYTE button) |
| return 1; | return 1; |
| } | } |
| BYTE | UINT8 |
| mousemng_getstat(short *x, short *y, int clear) | mousemng_getstat(short *x, short *y, int clear) |
| { | { |
| Line 214 mousemng_getstat(short *x, short *y, int | Line 212 mousemng_getstat(short *x, short *y, int |
| } | } |
| void | void |
| mousemng_set_ratio(BYTE new_ratio) | mousemng_set_ratio(UINT8 new_ratio) |
| { | { |
| np2oscfg.mouse_move_ratio = new_ratio; | np2oscfg.mouse_move_ratio = new_ratio; |