mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
gdk: Remove testing functions
They were unused and unimplemented.
This commit is contained in:
parent
2a9ae1e8df
commit
7ade6e3f46
@ -1217,14 +1217,6 @@ GdkAppLaunchContextClass
|
|||||||
gdk_app_launch_context_get_type
|
gdk_app_launch_context_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
|
||||||
<TITLE>Testing</TITLE>
|
|
||||||
<FILE>gdktestutils</FILE>
|
|
||||||
gdk_test_render_sync
|
|
||||||
gdk_test_simulate_button
|
|
||||||
gdk_test_simulate_key
|
|
||||||
</SECTION>
|
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<TITLE>GdkFrameClock</TITLE>
|
<TITLE>GdkFrameClock</TITLE>
|
||||||
<FILE>gdkframeclock</FILE>
|
<FILE>gdkframeclock</FILE>
|
||||||
|
@ -87,7 +87,6 @@ gdk_public_h_sources = \
|
|||||||
gdkscreen.h \
|
gdkscreen.h \
|
||||||
gdkseat.h \
|
gdkseat.h \
|
||||||
gdkselection.h \
|
gdkselection.h \
|
||||||
gdktestutils.h \
|
|
||||||
gdkthreads.h \
|
gdkthreads.h \
|
||||||
gdktypes.h \
|
gdktypes.h \
|
||||||
gdkvisual.h \
|
gdkvisual.h \
|
||||||
@ -264,7 +263,6 @@ x11_introspection_files = \
|
|||||||
x11/gdkscreen-x11.c \
|
x11/gdkscreen-x11.c \
|
||||||
x11/gdkselection-x11.c \
|
x11/gdkselection-x11.c \
|
||||||
x11/gdksettings.c \
|
x11/gdksettings.c \
|
||||||
x11/gdktestutils-x11.c \
|
|
||||||
x11/gdkvisual-x11.c \
|
x11/gdkvisual-x11.c \
|
||||||
x11/gdkwindow-x11.c \
|
x11/gdkwindow-x11.c \
|
||||||
x11/gdkxftdefaults.c \
|
x11/gdkxftdefaults.c \
|
||||||
@ -321,7 +319,6 @@ w32_introspection_files = \
|
|||||||
win32/gdkproperty-win32.c \
|
win32/gdkproperty-win32.c \
|
||||||
win32/gdkscreen-win32.c \
|
win32/gdkscreen-win32.c \
|
||||||
win32/gdkselection-win32.c \
|
win32/gdkselection-win32.c \
|
||||||
win32/gdktestutils-win32.c \
|
|
||||||
win32/gdkwin32.h \
|
win32/gdkwin32.h \
|
||||||
win32/gdkwin32cursor.h \
|
win32/gdkwin32cursor.h \
|
||||||
win32/gdkwin32display.h \
|
win32/gdkwin32display.h \
|
||||||
|
@ -71,7 +71,6 @@ libgdk_broadway_la_SOURCES = \
|
|||||||
gdkscreen-broadway.c \
|
gdkscreen-broadway.c \
|
||||||
gdkscreen-broadway.h \
|
gdkscreen-broadway.h \
|
||||||
gdkselection-broadway.c \
|
gdkselection-broadway.c \
|
||||||
gdktestutils-broadway.c \
|
|
||||||
gdkwindow-broadway.c \
|
gdkwindow-broadway.c \
|
||||||
gdkwindow-broadway.h \
|
gdkwindow-broadway.h \
|
||||||
gdkprivate-broadway.h \
|
gdkprivate-broadway.h \
|
||||||
|
@ -161,19 +161,6 @@ BroadwayInputMsg * _gdk_broadway_display_block_for_input (GdkDisplay *display,
|
|||||||
gboolean remove);
|
gboolean remove);
|
||||||
|
|
||||||
/* Window methods - testing */
|
/* Window methods - testing */
|
||||||
void _gdk_broadway_window_sync_rendering (GdkWindow *window);
|
|
||||||
gboolean _gdk_broadway_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease);
|
|
||||||
gboolean _gdk_broadway_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease);
|
|
||||||
void _gdk_broadway_window_resize_surface (GdkWindow *window);
|
void _gdk_broadway_window_resize_surface (GdkWindow *window);
|
||||||
|
|
||||||
void _gdk_broadway_cursor_update_theme (GdkCursor *cursor);
|
void _gdk_broadway_cursor_update_theme (GdkCursor *cursor);
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
/* Gtk+ testing utilities
|
|
||||||
* Copyright (C) 2007 Imendio AB
|
|
||||||
* Authors: Tim Janik
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "config.h"
|
|
||||||
#include <gdk/gdktestutils.h>
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
#include <gdk/gdkinternals.h>
|
|
||||||
#include "gdkprivate-broadway.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_broadway_window_sync_rendering (GdkWindow *window)
|
|
||||||
{
|
|
||||||
/* FIXME: Find out if there is a way to implement this on broadway. */
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_broadway_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* FIXME: Implement. */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_broadway_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* FIXME: Implement. */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
@ -1534,9 +1534,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
|||||||
impl_class->destroy_notify = gdk_broadway_window_destroy_notify;
|
impl_class->destroy_notify = gdk_broadway_window_destroy_notify;
|
||||||
impl_class->register_dnd = _gdk_broadway_window_register_dnd;
|
impl_class->register_dnd = _gdk_broadway_window_register_dnd;
|
||||||
impl_class->drag_begin = _gdk_broadway_window_drag_begin;
|
impl_class->drag_begin = _gdk_broadway_window_drag_begin;
|
||||||
impl_class->sync_rendering = _gdk_broadway_window_sync_rendering;
|
|
||||||
impl_class->simulate_key = _gdk_broadway_window_simulate_key;
|
|
||||||
impl_class->simulate_button = _gdk_broadway_window_simulate_button;
|
|
||||||
impl_class->get_property = _gdk_broadway_window_get_property;
|
impl_class->get_property = _gdk_broadway_window_get_property;
|
||||||
impl_class->change_property = _gdk_broadway_window_change_property;
|
impl_class->change_property = _gdk_broadway_window_change_property;
|
||||||
impl_class->delete_property = _gdk_broadway_window_delete_property;
|
impl_class->delete_property = _gdk_broadway_window_delete_property;
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
#include <gdk/gdkscreen.h>
|
#include <gdk/gdkscreen.h>
|
||||||
#include <gdk/gdkseat.h>
|
#include <gdk/gdkseat.h>
|
||||||
#include <gdk/gdkselection.h>
|
#include <gdk/gdkselection.h>
|
||||||
#include <gdk/gdktestutils.h>
|
|
||||||
#include <gdk/gdkthreads.h>
|
#include <gdk/gdkthreads.h>
|
||||||
#include <gdk/gdktypes.h>
|
#include <gdk/gdktypes.h>
|
||||||
#include <gdk/gdkvisual.h>
|
#include <gdk/gdkvisual.h>
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
/* Gdk testing utilities
|
|
||||||
* Copyright (C) 2007 Imendio AB
|
|
||||||
* Authors: Tim Janik
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GDK_TEST_UTILS_H__
|
|
||||||
#define __GDK_TEST_UTILS_H__
|
|
||||||
|
|
||||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
|
||||||
#error "Only <gdk/gdk.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gdk/gdkwindow.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:gdktestutils
|
|
||||||
* @Short_description: Test utilities
|
|
||||||
* @Title: Testing
|
|
||||||
*
|
|
||||||
* The functions in this section are intended to be used in test programs.
|
|
||||||
* They allow to simulate some user input.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* --- Gdk Test Utility API --- */
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
void gdk_test_render_sync (GdkWindow *window);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
gboolean gdk_test_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
gboolean gdk_test_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __GDK_TEST_UTILS_H__ */
|
|
100
gdk/gdkwindow.c
100
gdk/gdkwindow.c
@ -8930,106 +8930,6 @@ gdk_drag_begin_from_point (GdkWindow *window,
|
|||||||
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, targets, x_root, y_root);
|
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, targets, x_root, y_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_test_render_sync:
|
|
||||||
* @window: a mapped #GdkWindow
|
|
||||||
*
|
|
||||||
* Retrieves a pixel from @window to force the windowing
|
|
||||||
* system to carry out any pending rendering commands.
|
|
||||||
*
|
|
||||||
* This function is intended to be used to synchronize with rendering
|
|
||||||
* pipelines, to benchmark windowing system rendering operations.
|
|
||||||
*
|
|
||||||
* Since: 2.14
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gdk_test_render_sync (GdkWindow *window)
|
|
||||||
{
|
|
||||||
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->sync_rendering (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_test_simulate_key:
|
|
||||||
* @window: a #GdkWindow to simulate a key event for
|
|
||||||
* @x: x coordinate within @window for the key event
|
|
||||||
* @y: y coordinate within @window for the key event
|
|
||||||
* @keyval: A GDK keyboard value
|
|
||||||
* @modifiers: Keyboard modifiers the event is setup with
|
|
||||||
* @key_pressrelease: either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
|
|
||||||
*
|
|
||||||
* This function is intended to be used in GTK+ test programs.
|
|
||||||
* If (@x,@y) are > (-1,-1), it will warp the mouse pointer to
|
|
||||||
* the given (@x,@y) coordinates within @window and simulate a
|
|
||||||
* key press or release event.
|
|
||||||
*
|
|
||||||
* When the mouse pointer is warped to the target location, use
|
|
||||||
* of this function outside of test programs that run in their
|
|
||||||
* own virtual windowing system (e.g. Xvfb) is not recommended.
|
|
||||||
* If (@x,@y) are passed as (-1,-1), the mouse pointer will not
|
|
||||||
* be warped and @window origin will be used as mouse pointer
|
|
||||||
* location for the event.
|
|
||||||
*
|
|
||||||
* Also, gdk_test_simulate_key() is a fairly low level function,
|
|
||||||
* for most testing purposes, gtk_test_widget_send_key() is the
|
|
||||||
* right function to call which will generate a key press event
|
|
||||||
* followed by its accompanying key release event.
|
|
||||||
*
|
|
||||||
* Returns: whether all actions necessary for a key event simulation
|
|
||||||
* were carried out successfully
|
|
||||||
*
|
|
||||||
* Since: 2.14
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gdk_test_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)
|
|
||||||
->simulate_key (window, x, y, keyval, modifiers, key_pressrelease);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_test_simulate_button:
|
|
||||||
* @window: a #GdkWindow to simulate a button event for
|
|
||||||
* @x: x coordinate within @window for the button event
|
|
||||||
* @y: y coordinate within @window for the button event
|
|
||||||
* @button: Number of the pointer button for the event, usually 1, 2 or 3
|
|
||||||
* @modifiers: Keyboard modifiers the event is setup with
|
|
||||||
* @button_pressrelease: either %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE
|
|
||||||
*
|
|
||||||
* This function is intended to be used in GTK+ test programs.
|
|
||||||
* It will warp the mouse pointer to the given (@x,@y) coordinates
|
|
||||||
* within @window and simulate a button press or release event.
|
|
||||||
* Because the mouse pointer needs to be warped to the target
|
|
||||||
* location, use of this function outside of test programs that
|
|
||||||
* run in their own virtual windowing system (e.g. Xvfb) is not
|
|
||||||
* recommended.
|
|
||||||
*
|
|
||||||
* Also, gdk_test_simulate_button() is a fairly low level function,
|
|
||||||
* for most testing purposes, gtk_test_widget_click() is the right
|
|
||||||
* function to call which will generate a button press event followed
|
|
||||||
* by its accompanying button release event.
|
|
||||||
*
|
|
||||||
* Returns: whether all actions necessary for a button event simulation
|
|
||||||
* were carried out successfully
|
|
||||||
*
|
|
||||||
* Since: 2.14
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gdk_test_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)
|
|
||||||
->simulate_button (window, x, y, button, modifiers, button_pressrelease);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_property_get:
|
* gdk_property_get:
|
||||||
* @window: a #GdkWindow
|
* @window: a #GdkWindow
|
||||||
|
@ -231,20 +231,6 @@ struct _GdkWindowImplClass
|
|||||||
void (*process_updates_recurse) (GdkWindow *window,
|
void (*process_updates_recurse) (GdkWindow *window,
|
||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
|
|
||||||
void (*sync_rendering) (GdkWindow *window);
|
|
||||||
gboolean (*simulate_key) (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType event_type);
|
|
||||||
gboolean (*simulate_button) (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType event_type);
|
|
||||||
|
|
||||||
gboolean (*get_property) (GdkWindow *window,
|
gboolean (*get_property) (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
GdkAtom type,
|
GdkAtom type,
|
||||||
|
@ -1400,37 +1400,6 @@ gdk_mir_window_impl_process_updates_recurse (GdkWindow *window,
|
|||||||
_gdk_window_process_updates_recurse (window, region);
|
_gdk_window_process_updates_recurse (window, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gdk_mir_window_impl_sync_rendering (GdkWindow *window)
|
|
||||||
{
|
|
||||||
//g_printerr ("gdk_mir_window_impl_sync_rendering window=%p\n", window);
|
|
||||||
// FIXME: Only used for benchmarking
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_mir_window_impl_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
//g_printerr ("gdk_mir_window_impl_simulate_key window=%p\n", window);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_mir_window_impl_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
//g_printerr ("gdk_mir_window_impl_simulate_button window=%p\n", window);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_mir_window_impl_get_property (GdkWindow *window,
|
gdk_mir_window_impl_get_property (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
@ -2007,9 +1976,6 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
|||||||
impl_class->register_dnd = gdk_mir_window_impl_register_dnd;
|
impl_class->register_dnd = gdk_mir_window_impl_register_dnd;
|
||||||
impl_class->drag_begin = gdk_mir_window_impl_drag_begin;
|
impl_class->drag_begin = gdk_mir_window_impl_drag_begin;
|
||||||
impl_class->process_updates_recurse = gdk_mir_window_impl_process_updates_recurse;
|
impl_class->process_updates_recurse = gdk_mir_window_impl_process_updates_recurse;
|
||||||
impl_class->sync_rendering = gdk_mir_window_impl_sync_rendering;
|
|
||||||
impl_class->simulate_key = gdk_mir_window_impl_simulate_key;
|
|
||||||
impl_class->simulate_button = gdk_mir_window_impl_simulate_button;
|
|
||||||
impl_class->get_property = gdk_mir_window_impl_get_property;
|
impl_class->get_property = gdk_mir_window_impl_get_property;
|
||||||
impl_class->change_property = gdk_mir_window_impl_change_property;
|
impl_class->change_property = gdk_mir_window_impl_change_property;
|
||||||
impl_class->delete_property = gdk_mir_window_impl_delete_property;
|
impl_class->delete_property = gdk_mir_window_impl_delete_property;
|
||||||
|
@ -44,7 +44,6 @@ libgdk_quartz_la_SOURCES = \
|
|||||||
gdkscreen-quartz.c \
|
gdkscreen-quartz.c \
|
||||||
gdkscreen-quartz.h \
|
gdkscreen-quartz.h \
|
||||||
gdkselection-quartz.c \
|
gdkselection-quartz.c \
|
||||||
gdktestutils-quartz.c \
|
|
||||||
gdkutils-quartz.c \
|
gdkutils-quartz.c \
|
||||||
gdkwindow-quartz.c \
|
gdkwindow-quartz.c \
|
||||||
gdkwindow-quartz.h \
|
gdkwindow-quartz.h \
|
||||||
|
@ -194,21 +194,6 @@ void _gdk_quartz_window_debug_highlight (GdkWindow *window,
|
|||||||
void _gdk_quartz_window_update_position (GdkWindow *window);
|
void _gdk_quartz_window_update_position (GdkWindow *window);
|
||||||
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
|
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
|
||||||
|
|
||||||
/* Window methods - testing */
|
|
||||||
void _gdk_quartz_window_sync_rendering (GdkWindow *window);
|
|
||||||
gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease);
|
|
||||||
gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease);
|
|
||||||
|
|
||||||
/* Window methods - property */
|
/* Window methods - property */
|
||||||
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
|
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
/* Gtk+ testing utilities
|
|
||||||
* Copyright (C) 2007 Imendio AB
|
|
||||||
* Authors: Tim Janik
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "config.h"
|
|
||||||
#include <gdk/gdktestutils.h>
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
#include <gdk/gdkinternals.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_quartz_window_sync_rendering (GdkWindow *window)
|
|
||||||
{
|
|
||||||
/* FIXME: Find out if there is a way to implement this on quartz. */
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_quartz_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* FIXME: Implement. */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_quartz_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* FIXME: Implement. */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
@ -2791,9 +2791,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
|||||||
impl_class->register_dnd = _gdk_quartz_window_register_dnd;
|
impl_class->register_dnd = _gdk_quartz_window_register_dnd;
|
||||||
impl_class->drag_begin = _gdk_quartz_window_drag_begin;
|
impl_class->drag_begin = _gdk_quartz_window_drag_begin;
|
||||||
impl_class->process_updates_recurse = _gdk_quartz_window_process_updates_recurse;
|
impl_class->process_updates_recurse = _gdk_quartz_window_process_updates_recurse;
|
||||||
impl_class->sync_rendering = _gdk_quartz_window_sync_rendering;
|
|
||||||
impl_class->simulate_key = _gdk_quartz_window_simulate_key;
|
|
||||||
impl_class->simulate_button = _gdk_quartz_window_simulate_button;
|
|
||||||
impl_class->get_property = _gdk_quartz_window_get_property;
|
impl_class->get_property = _gdk_quartz_window_get_property;
|
||||||
impl_class->change_property = _gdk_quartz_window_change_property;
|
impl_class->change_property = _gdk_quartz_window_change_property;
|
||||||
impl_class->delete_property = _gdk_quartz_window_delete_property;
|
impl_class->delete_property = _gdk_quartz_window_delete_property;
|
||||||
|
@ -3422,33 +3422,6 @@ gdk_wayland_window_destroy_notify (GdkWindow *window)
|
|||||||
g_object_unref (window);
|
g_object_unref (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gdk_wayland_window_sync_rendering (GdkWindow *window)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_wayland_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_wayland_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_wayland_window_get_property (GdkWindow *window,
|
gdk_wayland_window_get_property (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
@ -3639,9 +3612,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
|||||||
impl_class->get_drag_protocol = _gdk_wayland_window_get_drag_protocol;
|
impl_class->get_drag_protocol = _gdk_wayland_window_get_drag_protocol;
|
||||||
impl_class->register_dnd = _gdk_wayland_window_register_dnd;
|
impl_class->register_dnd = _gdk_wayland_window_register_dnd;
|
||||||
impl_class->drag_begin = _gdk_wayland_window_drag_begin;
|
impl_class->drag_begin = _gdk_wayland_window_drag_begin;
|
||||||
impl_class->sync_rendering = gdk_wayland_window_sync_rendering;
|
|
||||||
impl_class->simulate_key = gdk_wayland_window_simulate_key;
|
|
||||||
impl_class->simulate_button = gdk_wayland_window_simulate_button;
|
|
||||||
impl_class->get_property = gdk_wayland_window_get_property;
|
impl_class->get_property = gdk_wayland_window_get_property;
|
||||||
impl_class->change_property = gdk_wayland_window_change_property;
|
impl_class->change_property = gdk_wayland_window_change_property;
|
||||||
impl_class->delete_property = gdk_wayland_window_delete_property;
|
impl_class->delete_property = gdk_wayland_window_delete_property;
|
||||||
|
@ -54,7 +54,6 @@ libgdk_win32_la_SOURCES = \
|
|||||||
gdkproperty-win32.c \
|
gdkproperty-win32.c \
|
||||||
gdkscreen-win32.c \
|
gdkscreen-win32.c \
|
||||||
gdkselection-win32.c \
|
gdkselection-win32.c \
|
||||||
gdktestutils-win32.c \
|
|
||||||
gdkvulkancontext-win32.c \
|
gdkvulkancontext-win32.c \
|
||||||
gdkvulkancontext-win32.h \
|
gdkvulkancontext-win32.h \
|
||||||
gdkwin32cursor.h \
|
gdkwin32cursor.h \
|
||||||
|
@ -481,18 +481,6 @@ void _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
|||||||
/* stray GdkWindowImplWin32 members */
|
/* stray GdkWindowImplWin32 members */
|
||||||
void _gdk_win32_window_register_dnd (GdkWindow *window);
|
void _gdk_win32_window_register_dnd (GdkWindow *window);
|
||||||
GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets, gint x_root, gint y_root);
|
GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets, gint x_root, gint y_root);
|
||||||
gboolean _gdk_win32_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease);
|
|
||||||
gboolean _gdk_win32_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease);
|
|
||||||
|
|
||||||
gint _gdk_win32_window_get_property (GdkWindow *window,
|
gint _gdk_win32_window_get_property (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
@ -1,127 +0,0 @@
|
|||||||
/* Gtk+ testing utilities
|
|
||||||
* Copyright (C) 2007 Imendio AB
|
|
||||||
* Authors: Tim Janik
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <gdk/gdktestutils.h>
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
#include <win32/gdkwin32.h>
|
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_win32_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
gboolean success = FALSE;
|
|
||||||
GdkKeymapKey *keys = NULL;
|
|
||||||
gint n_keys = 0;
|
|
||||||
INPUT ip;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
ip.type = INPUT_KEYBOARD;
|
|
||||||
ip.ki.wScan = 0;
|
|
||||||
ip.ki.time = 0;
|
|
||||||
ip.ki.dwExtraInfo = 0;
|
|
||||||
|
|
||||||
switch (key_pressrelease)
|
|
||||||
{
|
|
||||||
case GDK_KEY_PRESS:
|
|
||||||
ip.ki.dwFlags = 0;
|
|
||||||
break;
|
|
||||||
case GDK_KEY_RELEASE:
|
|
||||||
ip.ki.dwFlags = KEYEVENTF_KEYUP;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* Not a key event. */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), keyval, &keys, &n_keys))
|
|
||||||
{
|
|
||||||
for (i = 0; i < n_keys; i++)
|
|
||||||
{
|
|
||||||
if (key_pressrelease == GDK_KEY_PRESS)
|
|
||||||
{
|
|
||||||
/* 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 || (modifiers & GDK_SHIFT_MASK))
|
|
||||||
{
|
|
||||||
ip.ki.wVk = VK_SHIFT;
|
|
||||||
SendInput(1, &ip, sizeof(INPUT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Key pressed/released. */
|
|
||||||
ip.ki.wVk = keys[i].keycode;
|
|
||||||
SendInput(1, &ip, sizeof(INPUT));
|
|
||||||
|
|
||||||
if (key_pressrelease == GDK_KEY_RELEASE)
|
|
||||||
{
|
|
||||||
/* Shift release. */
|
|
||||||
if (keys[i].level || (modifiers & GDK_SHIFT_MASK))
|
|
||||||
{
|
|
||||||
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. */
|
|
||||||
success = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
g_free (keys);
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_win32_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
@ -5939,9 +5939,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
|||||||
impl_class->get_drag_protocol = _gdk_win32_window_get_drag_protocol;
|
impl_class->get_drag_protocol = _gdk_win32_window_get_drag_protocol;
|
||||||
impl_class->register_dnd = _gdk_win32_window_register_dnd;
|
impl_class->register_dnd = _gdk_win32_window_register_dnd;
|
||||||
impl_class->drag_begin = _gdk_win32_window_drag_begin;
|
impl_class->drag_begin = _gdk_win32_window_drag_begin;
|
||||||
//? impl_class->sync_rendering = _gdk_win32_window_sync_rendering;
|
|
||||||
impl_class->simulate_key = _gdk_win32_window_simulate_key;
|
|
||||||
impl_class->simulate_button = _gdk_win32_window_simulate_button;
|
|
||||||
impl_class->get_property = _gdk_win32_window_get_property;
|
impl_class->get_property = _gdk_win32_window_get_property;
|
||||||
impl_class->change_property = _gdk_win32_window_change_property;
|
impl_class->change_property = _gdk_win32_window_change_property;
|
||||||
impl_class->delete_property = _gdk_win32_window_delete_property;
|
impl_class->delete_property = _gdk_win32_window_delete_property;
|
||||||
|
@ -50,7 +50,6 @@ libgdk_x11_la_SOURCES = \
|
|||||||
gdkscreen-x11.c \
|
gdkscreen-x11.c \
|
||||||
gdkscreen-x11.h \
|
gdkscreen-x11.h \
|
||||||
gdkselection-x11.c \
|
gdkselection-x11.c \
|
||||||
gdktestutils-x11.c \
|
|
||||||
gdkvisual-x11.c \
|
gdkvisual-x11.c \
|
||||||
gdkvulkancontext-x11.c \
|
gdkvulkancontext-x11.c \
|
||||||
gdkvulkancontext-x11.h \
|
gdkvulkancontext-x11.h \
|
||||||
|
@ -74,19 +74,6 @@ void _gdk_x11_window_process_expose (GdkWindow *window,
|
|||||||
gulong serial,
|
gulong serial,
|
||||||
GdkRectangle *area);
|
GdkRectangle *area);
|
||||||
|
|
||||||
void _gdk_x11_window_sync_rendering (GdkWindow *window);
|
|
||||||
gboolean _gdk_x11_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease);
|
|
||||||
gboolean _gdk_x11_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease);
|
|
||||||
gboolean _gdk_x11_window_get_property (GdkWindow *window,
|
gboolean _gdk_x11_window_get_property (GdkWindow *window,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
GdkAtom type,
|
GdkAtom type,
|
||||||
|
@ -1,184 +0,0 @@
|
|||||||
/* Gtk+ testing utilities
|
|
||||||
* Copyright (C) 2007 Imendio AB
|
|
||||||
* Authors: Tim Janik
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "gdktestutils.h"
|
|
||||||
|
|
||||||
#include "gdkkeysyms.h"
|
|
||||||
#include "gdkprivate-x11.h"
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_x11_window_sync_rendering (GdkWindow *window)
|
|
||||||
{
|
|
||||||
Display *display = GDK_WINDOW_XDISPLAY (window);
|
|
||||||
XImage *ximage;
|
|
||||||
|
|
||||||
/* syncronize to X drawing queue, see:
|
|
||||||
* http://mail.gnome.org/archives/gtk-devel-list/2006-October/msg00103.html
|
|
||||||
*/
|
|
||||||
ximage = XGetImage (display, DefaultRootWindow (display),
|
|
||||||
0, 0, 1, 1, AllPlanes, ZPixmap);
|
|
||||||
if (ximage != NULL)
|
|
||||||
XDestroyImage (ximage);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_x11_window_simulate_key (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint keyval,
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType key_pressrelease)
|
|
||||||
{
|
|
||||||
GdkScreen *screen;
|
|
||||||
GdkKeymapKey *keys = NULL;
|
|
||||||
gboolean success;
|
|
||||||
gint n_keys = 0;
|
|
||||||
XKeyEvent xev = {
|
|
||||||
0, /* type */
|
|
||||||
0, /* serial */
|
|
||||||
1, /* send_event */
|
|
||||||
};
|
|
||||||
g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
screen = gdk_window_get_screen (window);
|
|
||||||
|
|
||||||
if (x < 0 && y < 0)
|
|
||||||
{
|
|
||||||
x = window->width / 2;
|
|
||||||
y = window->height / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert to impl coordinates */
|
|
||||||
x = x + window->abs_x;
|
|
||||||
y = y + window->abs_y;
|
|
||||||
|
|
||||||
xev.type = key_pressrelease == GDK_KEY_PRESS ? KeyPress : KeyRelease;
|
|
||||||
xev.display = GDK_WINDOW_XDISPLAY (window);
|
|
||||||
xev.window = GDK_WINDOW_XID (window);
|
|
||||||
xev.root = RootWindow (xev.display, GDK_X11_SCREEN (screen)->screen_num);
|
|
||||||
xev.subwindow = 0;
|
|
||||||
xev.time = 0;
|
|
||||||
xev.x = MAX (x, 0);
|
|
||||||
xev.y = MAX (y, 0);
|
|
||||||
xev.x_root = 0;
|
|
||||||
xev.y_root = 0;
|
|
||||||
xev.state = modifiers;
|
|
||||||
xev.keycode = 0;
|
|
||||||
success = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_for_display (gdk_window_get_display (window)), keyval, &keys, &n_keys);
|
|
||||||
success &= n_keys > 0;
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
gint i;
|
|
||||||
for (i = 0; i < n_keys; i++)
|
|
||||||
if (keys[i].group == 0 && (keys[i].level == 0 || keys[i].level == 1))
|
|
||||||
{
|
|
||||||
xev.keycode = keys[i].keycode;
|
|
||||||
if (keys[i].level == 1)
|
|
||||||
{
|
|
||||||
/* Assume shift takes us to level 1 */
|
|
||||||
xev.state |= GDK_SHIFT_MASK;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i >= n_keys) /* no match for group==0 and level==0 or 1 */
|
|
||||||
xev.keycode = keys[0].keycode;
|
|
||||||
}
|
|
||||||
g_free (keys);
|
|
||||||
if (!success)
|
|
||||||
return FALSE;
|
|
||||||
gdk_x11_display_error_trap_push (GDK_WINDOW_DISPLAY (window));
|
|
||||||
xev.same_screen = XTranslateCoordinates (xev.display, xev.window, xev.root,
|
|
||||||
xev.x, xev.y, &xev.x_root, &xev.y_root,
|
|
||||||
&xev.subwindow);
|
|
||||||
if (!xev.subwindow)
|
|
||||||
xev.subwindow = xev.window;
|
|
||||||
success &= xev.same_screen;
|
|
||||||
if (x >= 0 && y >= 0)
|
|
||||||
success &= 0 != XWarpPointer (xev.display, None, xev.window, 0, 0, 0, 0, xev.x, xev.y);
|
|
||||||
success &= 0 != XSendEvent (xev.display, xev.window, True, key_pressrelease == GDK_KEY_PRESS ? KeyPressMask : KeyReleaseMask, (XEvent*) &xev);
|
|
||||||
XSync (xev.display, False);
|
|
||||||
success &= 0 == gdk_x11_display_error_trap_pop (GDK_WINDOW_DISPLAY (window));
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gdk_x11_window_simulate_button (GdkWindow *window,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
guint button, /*1..3*/
|
|
||||||
GdkModifierType modifiers,
|
|
||||||
GdkEventType button_pressrelease)
|
|
||||||
{
|
|
||||||
GdkScreen *screen;
|
|
||||||
XButtonEvent xev = {
|
|
||||||
0, /* type */
|
|
||||||
0, /* serial */
|
|
||||||
1, /* send_event */
|
|
||||||
};
|
|
||||||
gboolean success;
|
|
||||||
|
|
||||||
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
|
|
||||||
g_return_val_if_fail (window != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
screen = gdk_window_get_screen (window);
|
|
||||||
|
|
||||||
if (x < 0 && y < 0)
|
|
||||||
{
|
|
||||||
x = window->width / 2;
|
|
||||||
y = window->height / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert to impl coordinates */
|
|
||||||
x = x + window->abs_x;
|
|
||||||
y = y + window->abs_y;
|
|
||||||
|
|
||||||
xev.type = button_pressrelease == GDK_BUTTON_PRESS ? ButtonPress : ButtonRelease;
|
|
||||||
xev.display = GDK_WINDOW_XDISPLAY (window);
|
|
||||||
xev.window = GDK_WINDOW_XID (window);
|
|
||||||
xev.root = RootWindow (xev.display, GDK_X11_SCREEN (screen)->screen_num);
|
|
||||||
xev.subwindow = 0;
|
|
||||||
xev.time = 0;
|
|
||||||
xev.x = x;
|
|
||||||
xev.y = y;
|
|
||||||
xev.x_root = 0;
|
|
||||||
xev.y_root = 0;
|
|
||||||
xev.state = modifiers;
|
|
||||||
xev.button = button;
|
|
||||||
gdk_x11_display_error_trap_push (GDK_WINDOW_DISPLAY (window));
|
|
||||||
xev.same_screen = XTranslateCoordinates (xev.display, xev.window, xev.root,
|
|
||||||
xev.x, xev.y, &xev.x_root, &xev.y_root,
|
|
||||||
&xev.subwindow);
|
|
||||||
if (!xev.subwindow)
|
|
||||||
xev.subwindow = xev.window;
|
|
||||||
success = xev.same_screen;
|
|
||||||
success &= 0 != XWarpPointer (xev.display, None, xev.window, 0, 0, 0, 0, xev.x, xev.y);
|
|
||||||
success &= 0 != XSendEvent (xev.display, xev.window, True, button_pressrelease == GDK_BUTTON_PRESS ? ButtonPressMask : ButtonReleaseMask, (XEvent*) &xev);
|
|
||||||
XSync (xev.display, False);
|
|
||||||
success &= 0 == gdk_x11_display_error_trap_pop(GDK_WINDOW_DISPLAY (window));
|
|
||||||
return success;
|
|
||||||
}
|
|
@ -5105,9 +5105,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
|||||||
impl_class->get_drag_protocol = gdk_x11_window_get_drag_protocol;
|
impl_class->get_drag_protocol = gdk_x11_window_get_drag_protocol;
|
||||||
impl_class->register_dnd = _gdk_x11_window_register_dnd;
|
impl_class->register_dnd = _gdk_x11_window_register_dnd;
|
||||||
impl_class->drag_begin = _gdk_x11_window_drag_begin;
|
impl_class->drag_begin = _gdk_x11_window_drag_begin;
|
||||||
impl_class->sync_rendering = _gdk_x11_window_sync_rendering;
|
|
||||||
impl_class->simulate_key = _gdk_x11_window_simulate_key;
|
|
||||||
impl_class->simulate_button = _gdk_x11_window_simulate_button;
|
|
||||||
impl_class->get_property = _gdk_x11_window_get_property;
|
impl_class->get_property = _gdk_x11_window_get_property;
|
||||||
impl_class->change_property = _gdk_x11_window_change_property;
|
impl_class->change_property = _gdk_x11_window_change_property;
|
||||||
impl_class->delete_property = _gdk_x11_window_delete_property;
|
impl_class->delete_property = _gdk_x11_window_delete_property;
|
||||||
|
Loading…
Reference in New Issue
Block a user