--- np2/x11/gtk2/gtk_mouse.c 2004/07/14 16:01:40 1.1 +++ np2/x11/gtk2/gtk_mouse.c 2007/01/10 18:03:46 1.5 @@ -10,8 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * 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 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -39,11 +37,11 @@ typedef struct { int lastmouse; // working short mousex; short mousey; - BYTE mouseb; + UINT8 mouseb; - BYTE mouse_move_ratio; - BYTE mouse_move_mul; - BYTE mouse_move_div; + UINT8 mouse_move_ratio; + UINT8 mouse_move_mul; + UINT8 mouse_move_div; GdkPixmap *cursor_pixmap; GdkCursor *cursor; @@ -72,12 +70,12 @@ mousemng_initialize(void) 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, - &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_pixmap, &drawarea->style->black, &drawarea->style->black, - 0, 0); + ms.cursor_pixmap, &main_window->style->black, + &main_window->style->black, 0, 0); return SUCCESS; } @@ -87,7 +85,7 @@ mousemng_term(void) { if (ms.cursor_pixmap) { - gdk_pixmap_unref(ms.cursor_pixmap); + g_object_unref(ms.cursor_pixmap); ms.cursor_pixmap = NULL; } } @@ -108,17 +106,17 @@ mouseonoff(int flag) if ((ms.lastmouse ^ flag) & 1) { ms.lastmouse = flag & 1; if (ms.lastmouse) { - gdk_pointer_grab(drawarea->window, TRUE, 0, - drawarea->window, ms.cursor, 0); - getmaincenter(drawarea, &curx, &cury); - gdk_window_set_pointer(drawarea->window, curx, cury); + gdk_pointer_grab(main_window->window, TRUE, 0, + main_window->window, ms.cursor, 0); + getmaincenter(main_window, &curx, &cury); + gdk_window_set_pointer(main_window->window, curx, cury); } else { gdk_pointer_ungrab(0); } } } -BYTE +UINT8 mouse_flag(void) { @@ -126,9 +124,9 @@ mouse_flag(void) } void -mouse_running(BYTE flg) +mouse_running(UINT8 flg) { - BYTE mf = ms.mouserunning; + UINT8 mf = ms.mouserunning; switch (flg & 0xc0) { case 0x00: @@ -157,16 +155,16 @@ mousemng_callback(void) int cx, cy; if (ms.lastmouse & 1) { - gdk_window_get_pointer(drawarea->window, &wx, &wy, NULL); - getmaincenter(drawarea, &cx, &cy); + gdk_window_get_pointer(main_window->window, &wx, &wy, NULL); + getmaincenter(main_window, &cx, &cy); ms.mousex += (short)((wx - cx) / 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 -mouse_btn(BYTE button) +UINT8 +mouse_btn(UINT8 button) { if ((ms.lastmouse & 1) == 0) @@ -192,7 +190,7 @@ mouse_btn(BYTE button) return 1; } -BYTE +UINT8 mousemng_getstat(short *x, short *y, int clear) { @@ -214,7 +212,7 @@ mousemng_getstat(short *x, short *y, int } void -mousemng_set_ratio(BYTE new_ratio) +mousemng_set_ratio(UINT8 new_ratio) { np2oscfg.mouse_move_ratio = new_ratio;