X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Flinux%2Fgp2x.c;h=a22e079f1b4ca740405d78299e5cea8b7393ce8f;hb=e54507e8567e1f52954ced5f85737195ee65c7b5;hp=4f24ca9e4c2bbe3589ff01c24b157695e6ed5a4e;hpb=e2de9939cd42db1810cb523eda4bc9186d7b4ddf;p=picodrive.git diff --git a/platform/linux/gp2x.c b/platform/linux/gp2x.c index 4f24ca9..a22e079 100644 --- a/platform/linux/gp2x.c +++ b/platform/linux/gp2x.c @@ -48,6 +48,12 @@ static void destroy (GtkWidget *widget, gpointer data) gtk_main_quit (); } +/* faking GP2X pad */ +enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40, + GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11, + GP2X_A=1<<12, GP2X_B=1<<13, GP2X_X=1<<14, GP2X_Y=1<<15, + GP2X_VOL_UP=1<<23, GP2X_VOL_DOWN=1<<22, GP2X_PUSH=1<<27 }; + static gint key_press_event (GtkWidget *widget, GdkEventKey *event) { switch (event->hardware_keycode) @@ -114,9 +120,11 @@ static gint key_release_event (GtkWidget *widget, GdkEventKey *event) static void size_allocate_event(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) { // printf("%dx%d\n", allocation->width, allocation->height); - scr_w = allocation->width - 2; - scr_h = allocation->height - 2; - scr_changed = 1; + if (scr_w != allocation->width - 2 || scr_h != allocation->height - 2) { + scr_w = allocation->width - 2; + scr_h = allocation->height - 2; + scr_changed = 1; + } } static void *gtk_threadf(void *targ) @@ -198,7 +206,7 @@ static void realloc_screen(void) void *old = g_screen_ptr; g_screen_width = scr_w; g_screen_height = scr_h; - g_screen_ptr = malloc(g_screen_width * g_screen_height * 2); + g_screen_ptr = calloc(g_screen_width * g_screen_height * 2, 1); free(old); scr_changed = 0; } @@ -332,11 +340,6 @@ void gp2x_pd_clone_buffer2(void) } /* joy */ -unsigned long gp2x_joystick_read(int allow_usb_joy) -{ - return current_keys; -} - int gp2x_touchpad_read(int *x, int *y) { return -1;