From ee492d9e2f406dd2dca4804d2f86fe218d4b05ef Mon Sep 17 00:00:00 2001 From: "SND\\ckain_cp" Date: Thu, 25 Jul 2013 13:06:43 +0000 Subject: GTK: added "hide mouse cursor" feature. Enable/disable via dfinput config dialog's option tab. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86239 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfinput/cfg-gtk.c | 12 ++++++------ plugins/dfinput/dfinput.ui | 15 +++++++++++++++ plugins/dfinput/pad.h | 2 +- plugins/dfinput/xkb.c | 18 +++++++++++------- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index d52d929d..a60a16a9 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -349,6 +349,7 @@ static void OnVisualVibration2Toggled(GtkWidget *widget, gpointer user_data) { } static void OnHideCursorToggled(GtkWidget *widget, gpointer user_data) { + (void)user_data; // unused g.cfg.HideCursor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); } @@ -702,12 +703,11 @@ long PADconfigure() { g_signal_connect_data(G_OBJECT(widget), "toggled", G_CALLBACK(OnThreadedToggled), NULL, NULL, G_CONNECT_AFTER); -/* - widget = gtk_builder_get_object(xml, "checkcg"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.HideCursor); - g_signal_connect_data(GTK_OBJECT(widget), "toggled", - G_CALLBACK(OnHideCursorToggled), NULL, NULL, G_CONNECT_AFTER); -*/ + widget = GTK_WIDGET(gtk_builder_get_object(xml, "checkcg")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.HideCursor); + g_signal_connect_data(G_OBJECT(widget), "toggled", + G_CALLBACK(OnHideCursorToggled), NULL, NULL, G_CONNECT_AFTER); + widget = GTK_WIDGET(gtk_builder_get_object(xml, widgetname_combodev[1])); g_signal_connect_data(G_OBJECT(widget), "changed", G_CALLBACK(OnDeviceChanged), GINT_TO_POINTER(0), NULL, G_CONNECT_AFTER); diff --git a/plugins/dfinput/dfinput.ui b/plugins/dfinput/dfinput.ui index 236b597a..df3b4606 100644 --- a/plugins/dfinput/dfinput.ui +++ b/plugins/dfinput/dfinput.ui @@ -679,6 +679,21 @@ 0 + + + Hide mouse cursor + True + True + False + 0 + True + + + False + True + 1 + + 3 diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h index 671edf18..f7927214 100755 --- a/plugins/dfinput/pad.h +++ b/plugins/dfinput/pad.h @@ -217,7 +217,7 @@ enum { CMD_QUERY_ACT = 0x46, // ?? CMD_QUERY_COMB = 0x47, // ?? CMD_QUERY_MODE = 0x4C, // QUERY_MODE ?? - CMD_VIBRATION_TOGGLE = 0x4D, + CMD_VIBRATION_TOGGLE = 0x4D }; // cfg.c functions... diff --git a/plugins/dfinput/xkb.c b/plugins/dfinput/xkb.c index 616e722f..ed13c7c4 100755 --- a/plugins/dfinput/xkb.c +++ b/plugins/dfinput/xkb.c @@ -25,24 +25,26 @@ static int g_currentMouse_Y; static Window window; void InitKeyboard() { - wmprotocols = XInternAtom(g.Disp, "WM_PROTOCOLS", 0); - wmdelwindow = XInternAtom(g.Disp, "WM_DELETE_WINDOW", 0); + int revert_to; - XkbSetDetectableAutoRepeat(g.Disp, 1, NULL); + wmprotocols = XInternAtom(g.Disp, "WM_PROTOCOLS", 0); + wmdelwindow = XInternAtom(g.Disp, "WM_DELETE_WINDOW", 0); + XkbSetDetectableAutoRepeat(g.Disp, 1, NULL); + XGetInputFocus(g.Disp, &window, &revert_to); if (g.cfg.PadDef[0].Type == PSE_PAD_TYPE_MOUSE || g.cfg.PadDef[1].Type == PSE_PAD_TYPE_MOUSE) { - int revert_to; - XGetInputFocus(g.Disp, &window, &revert_to); grabCursor(g.Disp, window, 1); showCursor(g.Disp, window, 0); + } else if (g.cfg.HideCursor) { + showCursor(g.Disp, window, 0); } g_currentMouse_X = 0; g_currentMouse_Y = 0; - g.PadState[0].KeyStatus = 0xFFFF; - g.PadState[1].KeyStatus = 0xFFFF; + g.PadState[0].KeyStatus = 0xFFFF; + g.PadState[1].KeyStatus = 0xFFFF; } void DestroyKeyboard() { @@ -52,6 +54,8 @@ void DestroyKeyboard() { g.cfg.PadDef[1].Type == PSE_PAD_TYPE_MOUSE) { grabCursor(g.Disp, window, 0); showCursor(g.Disp, window, 1); + } else if (g.cfg.HideCursor) { + showCursor(g.Disp, window, 1); } } -- cgit v1.2.3