Commit ec78a7e4 authored by Jehan's avatar Jehan

app: gdk_test_simulate_key() Win32 replacement code unneeded on master.

This is still needed on the gimp-2-10 branch since the implementation
appeared on GTK+ 2.24.25. But for GTK+3, it appeared for 3.14.0, which
is below our current minimum requirement on master. So let' clean out
this now useless piece of code.
parent 28d376ae
......@@ -220,72 +220,7 @@ void
gimp_test_utils_synthesize_key_event (GtkWidget *widget,
guint keyval)
{
#if defined G_OS_WIN32 && ! GTK_CHECK_VERSION (2, 24, 25)
/* gdk_test_simulate_key() has no implementation for win32 until
* GTK+ 2.24.25.
* TODO: remove the below hack when our GTK+ requirement is over 2.24.25. */
GdkKeymapKey *keys = NULL;
gint n_keys = 0;
INPUT ip;
gint i;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), keyval, &keys, &n_keys))
{
for (i = 0; i < n_keys; i++)
{
ip.ki.dwFlags = 0;
/* AltGr press. */
if (keys[i].group)
{
/* According to some virtualbox code I found, AltGr is
* simulated on win32 with LCtrl+RAlt */
ip.ki.wVk = VK_CONTROL;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = VK_MENU;
SendInput(1, &ip, sizeof(INPUT));
}
/* Shift press. */
if (keys[i].level)
{
ip.ki.wVk = VK_SHIFT;
SendInput(1, &ip, sizeof(INPUT));
}
/* Key pressed. */
ip.ki.wVk = keys[i].keycode;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.dwFlags = KEYEVENTF_KEYUP;
/* Key released. */
SendInput(1, &ip, sizeof(INPUT));
/* Shift release. */
if (keys[i].level)
{
ip.ki.wVk = VK_SHIFT;
SendInput(1, &ip, sizeof(INPUT));
}
/* AltrGr release. */
if (keys[i].group)
{
ip.ki.wVk = VK_MENU;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = VK_CONTROL;
SendInput(1, &ip, sizeof(INPUT));
}
/* No need to loop for alternative keycodes. We want only one
* key generated. */
break;
}
g_free (keys);
}
else
{
g_warning ("%s: no win32 key mapping found for keyval %d.", G_STRFUNC, keyval);
}
#elif defined(GDK_WINDOWING_QUARTZ)
#if defined(GDK_WINDOWING_QUARTZ)
GdkKeymapKey *keys = NULL;
gint n_keys = 0;
......@@ -354,7 +289,7 @@ else
g_warning ("%s: no macOS key mapping found for keyval %d.", G_STRFUNC, keyval);
}
#else /* G_OS_WIN32 && ! GTK_CHECK_VERSION (2, 24, 25) && ! GDK_WINDOWING_QUARTZ */
#else /* ! GDK_WINDOWING_QUARTZ */
gdk_test_simulate_key (gtk_widget_get_window (widget),
-1, -1, /*x, y*/
keyval,
......@@ -365,7 +300,7 @@ else
keyval,
0 /*modifiers*/,
GDK_KEY_RELEASE);
#endif /* G_OS_WIN32 && ! GTK_CHECK_VERSION (2, 24, 25) */
#endif /* ! GDK_WINDOWING_QUARTZ */
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment