[gok] Compile with GSEAL enabled - bgo#600736
- From: Gerd Kohlberger <gerdk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gok] Compile with GSEAL enabled - bgo#600736
- Date: Sun, 15 Nov 2009 13:41:35 +0000 (UTC)
commit 2420bd35ffb3dbb05547c6b978a410ecee3ae189
Author: Gerd Kohlberger <gerdk src gnome org>
Date: Sun Nov 15 14:37:45 2009 +0100
Compile with GSEAL enabled - bgo#600736
configure.in | 2 +-
gok/callbacks.c | 10 ++--
gok/gok-button.c | 18 ++++---
gok/gok-input.c | 80 ++++++++++++++---------------
gok/gok-key.c | 39 ++++++++++----
gok/gok-keyboard.c | 56 +++++++++++++--------
gok/gok-page-actions.c | 8 ++-
gok/gok-page-feedbacks.c | 8 ++-
gok/gok-page-keysizespace.c | 4 +-
gok/gok-scanner.c | 22 +++++---
gok/gok-settings-dialog.c | 2 +-
gok/main.c | 118 ++++++++++++++++++++++++++----------------
12 files changed, 218 insertions(+), 149 deletions(-)
---
diff --git a/configure.in b/configure.in
index 89e6aeb..752d8c0 100644
--- a/configure.in
+++ b/configure.in
@@ -167,7 +167,7 @@ PKG_CHECK_MODULES(GOK,
libloginhelper-1.0 >= 1.5.2
libbonobo-2.0 >= 2.5.1
atk >= 1.3.0
- gtk+-2.0 >= 2.16.0
+ gtk+-2.0 >= 2.18.0
gail
libwnck-1.0
gnome-speech-1.0
diff --git a/gok/callbacks.c b/gok/callbacks.c
index f1eecc4..43724da 100644
--- a/gok/callbacks.c
+++ b/gok/callbacks.c
@@ -77,22 +77,22 @@ on_window1_realize (GtkWidget *widget,
{
struct gok_window_realize_data *window_realize_data = (struct gok_window_realize_data *) user_data;
GdkKeymap *map = gdk_keymap_get_default ();
+ GdkWindow *window;
gok_main_center_corepointer (widget);
+ window = gtk_widget_get_window (widget);
if (window_realize_data->is_dock) {
gok_main_set_wm_dock (TRUE);
}
else {
- if (widget->window) {
- gdk_window_set_decorations (widget->window, GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
- gdk_window_set_functions (widget->window, GDK_FUNC_MOVE | GDK_FUNC_RESIZE);
- }
+ gdk_window_set_decorations (window, GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
+ gdk_window_set_functions (window, GDK_FUNC_MOVE | GDK_FUNC_RESIZE);
}
gtk_window_stick (GTK_WINDOW (widget));
- if (!gok_keyboard_xkb_select (GDK_WINDOW_XDISPLAY (widget->window)))
+ if (!gok_keyboard_xkb_select (GDK_WINDOW_XDISPLAY (window)))
g_warning ("Could not register for XKB events!");
if (window_realize_data->use_libusb == FALSE) {
diff --git a/gok/gok-button.c b/gok/gok-button.c
index 3bf7416..333b312 100644
--- a/gok/gok-button.c
+++ b/gok/gok-button.c
@@ -2,6 +2,7 @@
*
* Copyright 2002-2009 Sun Microsystems, Inc.,
* Copyright 2001-2009 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -207,8 +208,7 @@ gint gok_button_leave_notify (GtkWidget *widget, GdkEventCrossing *event)
if (GOK_IS_BUTTON (widget))
{
- gdk_drawable_get_size (GTK_BUTTON (widget)->event_window,
- &x, &y);
+ gdk_drawable_get_size (event->window, &x, &y);
if (event->x <= 0 || event->x >= x ||
event->y <= 0 || event->y >= y)
{
@@ -278,10 +278,11 @@ static gboolean
gok_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
+ GtkAllocation image_alloc;
gboolean retval =
(* GTK_WIDGET_CLASS (gok_button_parent_class)->expose_event) (widget, event);
- if (GTK_WIDGET_DRAWABLE (widget) && GOK_BUTTON (widget)->pImage) {
+ if (gtk_widget_is_drawable (widget) && GOK_BUTTON (widget)->pImage) {
if (GOK_BUTTON (widget)->indicator_type != NULL) {
GtkWidget *image = GOK_BUTTON (widget)->pImage;
GdkRectangle rect;
@@ -290,15 +291,16 @@ gok_button_expose (GtkWidget *widget,
gtk_widget_style_get (image, "indicator_size", &indicator_size,
"indicator_spacing", &indicator_spacing, NULL);
*/
- rect.x = image->allocation.x + (image->allocation.width - indicator_size)/2;
+ gtk_widget_get_allocation (image, &image_alloc);
+ rect.x = image_alloc.x + (image_alloc.width - indicator_size)/2;
/* "20" is size of standard status images we use. kludge. */
- rect.y = image->allocation.y + (image->allocation.height - indicator_size)/2;
+ rect.y = image_alloc.y + (image_alloc.height - indicator_size)/2;
rect.width = indicator_size;
rect.height = indicator_size;
if (*(GOK_BUTTON (widget)->indicator_type) == 'r') {
gtk_paint_option (gtk_widget_get_style (image),
gtk_widget_get_parent_window (image),
- GTK_WIDGET_STATE (image),
+ gtk_widget_get_state (image),
(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) ?
GTK_SHADOW_IN : GTK_SHADOW_OUT,
&rect,
@@ -318,7 +320,7 @@ gok_button_expose (GtkWidget *widget,
gtk_paint_polygon (gtk_widget_get_style (widget),
gtk_widget_get_parent_window (image),
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ?
- GTK_STATE_PRELIGHT : GTK_WIDGET_STATE (widget),
+ GTK_STATE_PRELIGHT : gtk_widget_get_state (widget),
GTK_SHADOW_IN,
&rect,
image,
@@ -331,7 +333,7 @@ gok_button_expose (GtkWidget *widget,
else {
gtk_paint_check (gtk_widget_get_style (image),
gtk_widget_get_parent_window (image),
- GTK_WIDGET_STATE (image),
+ gtk_widget_get_state (image),
(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) ?
GTK_SHADOW_IN : GTK_SHADOW_OUT,
&rect,
diff --git a/gok/gok-input.c b/gok/gok-input.c
index d8558f6..450ccb5 100644
--- a/gok/gok-input.c
+++ b/gok/gok-input.c
@@ -2,6 +2,7 @@
*
* Copyright 2002 Sun Microsystems, Inc.,
* Copyright 2002 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -140,18 +141,36 @@ gok_input_extension_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer dat
#endif
}
+static GdkWindow *
+gok_input_get_root_window (void)
+{
+ GtkWidget *main_window;
+ GdkWindow *gdk_window;
+
+ main_window = gok_main_get_main_window ();
+ if (main_window)
+ {
+ gdk_window = gtk_widget_get_window (main_window);
+ if (gdk_window)
+ return gdk_screen_get_root_window (gdk_drawable_get_screen (gdk_window));
+ }
+ return NULL;
+}
+
void
gok_input_detach_corepointer (void)
{
int num_devices, i;
+ GdkWindow *root;
Display *display;
- GtkWidget *pMainWindow = gok_main_get_main_window ();
#ifdef HAVE_XINPUT
XDeviceInfo *devices;
- if (!corepointer_detached && pMainWindow && pMainWindow->window)
+
+ root = gok_input_get_root_window ();
+ if (!corepointer_detached && root)
{
XDeviceInfo *pointer = NULL, *ext = NULL;
- display = GDK_WINDOW_XDISPLAY (pMainWindow->window);
+ display = gok_main_display ();
devices = XListInputDevices(display, &num_devices);
for (i = 0; i < num_devices; i++)
{
@@ -179,12 +198,10 @@ gok_input_detach_corepointer (void)
gint number;
XEventClass ev_list[40];
XDevice *newdev;
- GdkWindow *root;
saved_corepointer_id = pointer->id;
XChangePointerDevice (display, XOpenDevice (display, ext->id), 0, 1);
newdev = XOpenDevice (display, pointer->id);
number = gok_input_init_device_event_list (pointer, newdev, ev_list);
- root = gdk_screen_get_root_window (gdk_drawable_get_screen (pMainWindow->window));
if (XSelectExtensionEvent(GDK_WINDOW_XDISPLAY (root),
GDK_WINDOW_XWINDOW (root),
ev_list, number))
@@ -212,11 +229,10 @@ void
gok_input_restore_corepointer (void)
{
Display *display;
- GtkWidget *pMainWindow = gok_main_get_main_window ();
#ifdef HAVE_XINPUT
- if (corepointer_detached && pMainWindow && pMainWindow->window)
+ if (corepointer_detached)
{
- display = GDK_WINDOW_XDISPLAY (pMainWindow->window);
+ display = gok_main_display ();
XChangePointerDevice (display, XOpenDevice (display, saved_corepointer_id), 0, 1);
corepointer_detached = FALSE;
}
@@ -239,19 +255,14 @@ gok_input_ext_devices_exist (void)
static gboolean
gok_input_open (GokInput *input)
{
- GtkWidget *window;
-
g_return_val_if_fail (input != NULL, FALSE);
input->open = FALSE;
#ifdef HAVE_XINPUT
- window = gok_main_get_main_window ();
- if (window && window->window &&
- input->info && (input->info->use == IsXExtensionDevice))
+ if (input->info && (input->info->use == IsXExtensionDevice))
{
gdk_error_trap_push ();
- input->device = XOpenDevice(GDK_WINDOW_XDISPLAY (window->window),
- input->info->id);
+ input->device = XOpenDevice(gok_main_display (), input->info->id);
if (!gdk_error_trap_pop ())
input->open = TRUE;
}
@@ -265,14 +276,10 @@ gok_input_open (GokInput *input)
static void
gok_input_close (GokInput *input)
{
- GtkWidget *window = gok_main_get_main_window ();
-
-#ifdef HAVE_XINPUT
- if (window && window->window &&
- input && input->info && (input->info->use == IsXExtensionDevice))
+#ifdef HAVE_XINPUT
+ if (input && input->info && (input->info->use == IsXExtensionDevice))
{
- XCloseDevice(GDK_WINDOW_XDISPLAY (window->window),
- input->device);
+ XCloseDevice(gok_main_display (), input->device);
input->open = FALSE;
}
#endif
@@ -285,14 +292,11 @@ gok_input_get_device_list (void)
int i;
int num_devices;
Display *display;
- GtkWidget *pMainWindow = gok_main_get_main_window ();
-
#ifdef HAVE_XINPUT
XDeviceInfo *devices;
- if (!input_device_list && pMainWindow && pMainWindow->window) {
- display = GDK_WINDOW_XDISPLAY (pMainWindow->window);
-
+ if (!input_device_list) {
+ display = gok_main_display ();
devices = XListInputDevices(display, &num_devices);
for (i = 0; i < num_devices; i++) {
GokInput *pInput;
@@ -370,10 +374,13 @@ gok_input_init (GdkFilterFunc filter_func)
#ifdef HAVE_XINPUT
XEventClass event_list[40];
int number;
- GtkWidget *window = gok_main_get_main_window ();
GdkWindow *root;
GSList *device_list = gok_input_get_device_list ();
-
+
+ root = gok_input_get_root_window ();
+ if (!root)
+ return FALSE;
+
while (device_list && device_list->data) {
GokInput *input = device_list->data;
if (!input->open && !gok_input_open (input)) {
@@ -381,8 +388,6 @@ gok_input_init (GdkFilterFunc filter_func)
}
else {
number = gok_input_init_device_event_list (input->info, input->device, event_list);
- root = gdk_screen_get_root_window (gdk_drawable_get_screen (window->window));
-
if (XSelectExtensionEvent(GDK_WINDOW_XDISPLAY (root),
GDK_WINDOW_XWINDOW (root),
event_list, number))
@@ -439,14 +444,9 @@ gok_input_free (GokInput *pInput)
GokInput *
gok_input_find_by_device_id (guint id, gboolean extended_only)
{
- GtkWidget *window = gok_main_get_main_window ();
GokInput *input = NULL;
#ifdef HAVE_XINPUT
-
- if (window && window->window)
- {
- input = find_input_by_id (GDK_WINDOW_XDISPLAY (window->window), id, extended_only);
- }
+ input = find_input_by_id (gok_main_display (), id, extended_only);
#else
g_message ("Warning, XInput extension not present, cannot open input device.");
#endif
@@ -456,13 +456,11 @@ gok_input_find_by_device_id (guint id, gboolean extended_only)
GokInput *
gok_input_find_by_name (char *name, gboolean extended_only)
{
- GtkWidget *window = gok_main_get_main_window ();
GokInput *input = NULL;
#ifdef HAVE_XINPUT
-
- if (name && window && window->window)
+ if (name)
{
- input = find_input (GDK_WINDOW_XDISPLAY (window->window), name, extended_only);
+ input = find_input (gok_main_display (), name, extended_only);
}
#else
g_message ("Warning, XInput extension not present, cannot open input device.");
diff --git a/gok/gok-key.c b/gok/gok-key.c
index a88ba19..470aff6 100644
--- a/gok/gok-key.c
+++ b/gok/gok-key.c
@@ -2,6 +2,7 @@
*
* Copyright 2001-2009 Sun Microsystems, Inc.,
* Copyright 2001-2009 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -469,28 +470,44 @@ gok_key_keycode_from_xkb_key (XkbKeyPtr keyp, XkbDescPtr kbd)
gint
gok_key_get_default_border_width (GokKey *pKey)
{
+ GtkStyle *style;
+ gint border_width;
+
if (pKey->pButton)
- return GTK_CONTAINER (pKey->pButton)->border_width +
- CHILD_SPACING +
- GTK_WIDGET (pKey->pButton)->style->xthickness;
- else
- return 0;
+ {
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (pKey->pButton));
+ style = gtk_widget_get_style (pKey->pButton);
+ return border_width + CHILD_SPACING + style->xthickness;
+ }
+ return 0;
}
static gint
gok_key_get_default_font_size (GokKey *pKey)
{
- PangoFontDescription *font_desc =
- GTK_WIDGET (pKey->pButton)->style->font_desc;
- return PANGO_PIXELS (pango_font_description_get_size (font_desc));
+ GtkStyle *style;
+
+ if (pKey->pButton)
+ {
+ style = gtk_widget_get_style (pKey->pButton);
+ return PANGO_PIXELS (pango_font_description_get_size (style->font_desc));
+ }
+ return 0;
}
static gint
gok_key_get_default_border_height (GokKey *pKey)
{
- return GTK_CONTAINER (pKey->pButton)->border_width +
- CHILD_SPACING +
- GTK_WIDGET (pKey->pButton)->style->ythickness;
+ GtkStyle *style;
+ gint border_width;
+
+ if (pKey->pButton)
+ {
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (pKey->pButton));
+ style = gtk_widget_get_style (pKey->pButton);
+ return border_width + CHILD_SPACING + style->ythickness;
+ }
+ return 0;
}
/**
diff --git a/gok/gok-keyboard.c b/gok/gok-keyboard.c
index 94d2497..88dbe95 100644
--- a/gok/gok-keyboard.c
+++ b/gok/gok-keyboard.c
@@ -2,6 +2,7 @@
*
* Copyright 2001-2009 Sun Microsystems, Inc.,
* Copyright 2001-2009 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -1627,9 +1628,9 @@ gok_keyboard_get_cell_width (GokKeyboard *keyboard)
gint width_window;
gboolean expand;
- if (window && window->window)
+ if (window)
{
- screen = gdk_drawable_get_screen (window->window);
+ screen = gtk_window_get_screen (GTK_WINDOW (window));
}
else
{
@@ -1765,16 +1766,20 @@ void gok_keyboard_calculate_font_size_group (GokKeyboard* pKeyboard, gint GroupN
void
gok_keyboard_paint_pointer (GokKeyboard *pKeyboard, GtkWidget *pWindowMain, gint x, gint y)
{
- if (pWindowMain->window) {
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (pWindowMain);
+ if (window) {
GdkGC *gc;
GdkGCValues values;
+
values.function = GDK_INVERT;
values.line_width = 2;
- gc = gdk_gc_new_with_values (pWindowMain->window, &values, GDK_GC_FUNCTION | GDK_GC_LINE_WIDTH);
+ gc = gdk_gc_new_with_values (window, &values, GDK_GC_FUNCTION | GDK_GC_LINE_WIDTH);
m_oldPointerX = x;
m_oldPointerY = y;
- gdk_draw_line (pWindowMain->window, gc, x-6, y, x+6, y);
- gdk_draw_line (pWindowMain->window, gc, x, y-6, x, y+6);
+ gdk_draw_line (window, gc, x-6, y, x+6, y);
+ gdk_draw_line (window, gc, x, y-6, x, y+6);
g_object_unref (gc);
}
}
@@ -1790,14 +1795,18 @@ gok_keyboard_paint_pointer (GokKeyboard *pKeyboard, GtkWidget *pWindowMain, gint
void
gok_keyboard_unpaint_pointer (GokKeyboard *pKeyboard, GtkWidget *pWindowMain)
{
- if (pWindowMain->window) {
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (pWindowMain);
+ if (window) {
GdkRectangle rect;
+
rect.x = m_oldPointerX - 6;
rect.y = m_oldPointerY - 6;
rect.width = 13;
rect.height = 13;
- gdk_window_invalidate_rect (pWindowMain->window, &rect, TRUE);
- gdk_window_process_updates (pWindowMain->window, TRUE);
+ gdk_window_invalidate_rect (window, &rect, TRUE);
+ gdk_window_process_updates (window, TRUE);
}
}
@@ -1820,6 +1829,7 @@ gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCur
gchar* titleWindow;
GtkWidget* pFixedContainer;
GtkWidget* pNewButton;
+ GdkWindow* gdk_window;
GokKey* pKey;
gint heightWindow;
gint widthWindow;
@@ -1863,7 +1873,7 @@ gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCur
g_free (titleWindow);
/* get the "fixed container" that holds the buttons */
- pFixedContainer = GTK_BIN(pWindowMain)->child;
+ pFixedContainer = gtk_bin_get_child (GTK_BIN (pWindowMain));
if ((gok_data_get_dock_type () != GOK_DOCK_NONE) && gok_data_get_expand ()) {
borderWidth = GOK_KEYBOARD_DOCK_BORDERPIX;
@@ -1976,8 +1986,9 @@ gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCur
/* is this window bigger than the screen (or screen geometry)? */
/* get the frame size */
- gdk_window_get_frame_extents ((GdkWindow*)pWindowMain->window, &rectFrame);
- gdk_window_get_position (pWindowMain->window, &winX, &winY);
+ gdk_window = gtk_widget_get_window (pWindowMain);
+ gdk_window_get_frame_extents (gdk_window, &rectFrame);
+ gdk_window_get_position (gdk_window, &winX, &winY);
if ((winX != 0) &&
(winY != 0))
{
@@ -1999,7 +2010,7 @@ gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCur
}
else if (pKeyboard->shape == KEYBOARD_SHAPE_FITWINDOW)
{
- gdk_drawable_get_size (pWindowMain->window, &widthMax, &heightMax);
+ gdk_drawable_get_size (gdk_window, &widthMax, &heightMax);
}
else
{
@@ -2070,6 +2081,7 @@ void gok_keyboard_position_keys (GokKeyboard* pKeyboard, GtkWidget* pWindow)
{
GokKey* pKey;
GtkWidget* pContainer;
+ GdkWindow* gdk_window;
gint left, top, width, height;
gint widthKey;
gint heightKey;
@@ -2089,16 +2101,17 @@ void gok_keyboard_position_keys (GokKeyboard* pKeyboard, GtkWidget* pWindow)
if ((gok_data_get_expand () && (pKeyboard->expand != GOK_EXPAND_NEVER))
|| (pKeyboard->expand == GOK_EXPAND_ALWAYS))
{
- if (pWindow->window)
+ gdk_window = gtk_widget_get_window (pWindow);
+ if (gdk_window)
{
gint widthWindow, heightWindow;
- gdk_drawable_get_size (pWindow->window, &widthWindow, &heightWindow);
+ gdk_drawable_get_size (gdk_window, &widthWindow, &heightWindow);
widthKey = (double) widthWindow / pKeyboard->NumberColumns - spacingKey;
}
}
/* get the container from the window */
- pContainer = GTK_BIN(pWindow)->child;
+ pContainer = gtk_bin_get_child (GTK_BIN (pWindow));
g_assert (pContainer != NULL);
/* loop through all the keys */
@@ -3619,10 +3632,11 @@ gok_keyboard_dock (GokKey *pKey)
}
if (dir == GOK_DIRECTION_NONE) {
GtkWidget *widget = gok_main_get_main_window ();
- if (widget)
- gdk_window_raise (widget->window);
-/* FIXME: why do we need this? */
- gtk_widget_show_now (gok_main_get_main_window ());
+ if (widget) {
+ gdk_window_raise (gtk_widget_get_window (widget));
+ /* FIXME: why do we need this? */
+ gtk_widget_show_now (widget);
+ }
}
}
@@ -4315,7 +4329,7 @@ void gok_keyboard_on_window_resize ()
}
/* compare the size of the window to the size we made the window */
- gdk_drawable_get_size (pWindow->window, &widthWindow, &heightWindow);
+ gdk_drawable_get_size (gtk_widget_get_window (pWindow), &widthWindow, &heightWindow);
gok_main_get_our_window_size (&widthWindowPrevious, &heightWindowPrevious);
#ifndef BUG_133323_LIVES
diff --git a/gok/gok-page-actions.c b/gok/gok-page-actions.c
index 8e5409e..2fb9003 100644
--- a/gok/gok-page-actions.c
+++ b/gok/gok-page-actions.c
@@ -310,6 +310,7 @@ void gok_page_actions_toggle_type_valuator (gboolean Pressed)
void gok_page_actions_button_clicked_change_name ()
{
GtkWidget* pDialogChangeName;
+ GtkWidget* pContent;
GtkWidget* pLabel;
GtkWidget* pEntryNewName;
gint response;
@@ -326,19 +327,20 @@ void gok_page_actions_button_clicked_change_name ()
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+ pContent = gtk_dialog_get_content_area (GTK_DIALOG (pDialogChangeName));
/* add a text label */
pLabel = gtk_label_new (_("Change the action name:"));
gtk_widget_show (pLabel);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), pLabel, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(pContent), pLabel, FALSE, FALSE, 0);
/* add a text entry */
pEntryNewName = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY(pEntryNewName), m_pActionCurrent->pDisplayName);
gtk_widget_show (pEntryNewName);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), pEntryNewName, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(pContent), pEntryNewName, FALSE, FALSE, 0);
/* increase the spacing among the controls */
- gtk_box_set_spacing (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), 10);
+ gtk_box_set_spacing (GTK_BOX(pContent), 10);
/* display the dialog */
while (1)
diff --git a/gok/gok-page-feedbacks.c b/gok/gok-page-feedbacks.c
index 73f9d42..11888aa 100644
--- a/gok/gok-page-feedbacks.c
+++ b/gok/gok-page-feedbacks.c
@@ -325,6 +325,7 @@ void gok_page_feedbacks_update_controls (GokFeedback* pFeedback)
void gok_page_feedbacks_button_clicked_change_name ()
{
GtkWidget* pDialogChangeName;
+ GtkWidget* pContent;
GtkWidget* pLabel;
GtkWidget* pEntryNewName;
gint response;
@@ -341,19 +342,20 @@ void gok_page_feedbacks_button_clicked_change_name ()
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+ pContent = gtk_dialog_get_content_area (GTK_DIALOG (pDialogChangeName));
/* add a text label */
pLabel = gtk_label_new (_("Change the feedback name:"));
gtk_widget_show (pLabel);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), pLabel, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(pContent), pLabel, FALSE, FALSE, 0);
/* add a text entry */
pEntryNewName = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY(pEntryNewName), m_pFeedbackCurrent->pDisplayName);
gtk_widget_show (pEntryNewName);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), pEntryNewName, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(pContent), pEntryNewName, FALSE, FALSE, 0);
/* increase the spacing among the controls */
- gtk_box_set_spacing (GTK_BOX(GTK_DIALOG (pDialogChangeName)->vbox), 10);
+ gtk_box_set_spacing (GTK_BOX(pContent), 10);
/* display the dialog */
while (1)
diff --git a/gok/gok-page-keysizespace.c b/gok/gok-page-keysizespace.c
index ac86092..fd71205 100644
--- a/gok/gok-page-keysizespace.c
+++ b/gok/gok-page-keysizespace.c
@@ -291,9 +291,9 @@ void gok_settings_page_keysizespace_display_keysizespacing (gint KeyWidth, gint
/* calculate the left side based upon the window size */
pWindowSettings = WID ("window");
- if (GDK_IS_DRAWABLE(pWindowSettings->window) == TRUE)
+ if (gtk_widget_is_drawable (pWindowSettings))
{
- gdk_drawable_get_size (pWindowSettings->window, &width, NULL);
+ gdk_drawable_get_size (gtk_widget_get_window (pWindowSettings), &width, NULL);
left = ((width - 32) - ((KeyWidth * 2) + Space)) / 2;
}
diff --git a/gok/gok-scanner.c b/gok/gok-scanner.c
index f21b00e..791dacd 100644
--- a/gok/gok-scanner.c
+++ b/gok/gok-scanner.c
@@ -2,6 +2,7 @@
*
* Copyright 2002 Sun Microsystems, Inc.
* Copyright 2002 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -2340,22 +2341,25 @@ void gok_scanner_input_motion (gint *motion_data, gint n_axes)
GokKeyboard *pKeyboard = gok_main_get_current_keyboard ();
GokKey *pKey;
GtkWidget *pWindow = gok_main_get_main_window ();
+ GdkWindow *gdk_window;
gint x=0, y=0;
- if ((n_axes >= 2) && pWindow->window) {
+
+ gdk_window = gtk_widget_get_window (pWindow);
+ if ((n_axes >= 2) && gdk_window) {
gint o_x, o_y;
gdouble multiplier = gok_data_get_valuator_sensitivity ();
x = motion_data[0] * multiplier - m_OffsetX;
y = motion_data[1] * multiplier - m_OffsetY;
- gdk_window_get_origin (pWindow->window, &o_x, &o_y);
+ gdk_window_get_origin (gdk_window, &o_x, &o_y);
if (!gok_data_get_drive_corepointer ()) {
- gok_pointer_clip_to_window (&x, &y, pWindow->window,
+ gok_pointer_clip_to_window (&x, &y, gdk_window,
gok_scanner_get_slop ());
}
else {
GdkWindow *root =
gdk_screen_get_root_window (
gdk_drawable_get_screen (
- pWindow->window));
+ gdk_window));
gok_pointer_clip_to_window (&x, &y, root, 0);
}
motion_data[0] = x;
@@ -2400,7 +2404,7 @@ void gok_scanner_input_motion_libusb (gint x, gint y)
y = y * multiplier;
/* clip coordinates to window */
- gdk_drawable_get_size (pWindow->window, &w, &h);
+ gdk_drawable_get_size (gtk_widget_get_window (pWindow), &w, &h);
/* horizontal */
if (w + slop < offset_x + x) {
/* too far right */
@@ -2449,13 +2453,15 @@ void gok_scanner_input_motion_xevie (gint x, gint y)
gint w, h;
static gint offset_x = 0, origin_x = 0;
static gint offset_y = 0, origin_y = 0;
+ GdkWindow *gdk_window;
GokKeyboard *pKeyboard = gok_main_get_current_keyboard ();
GtkWidget *pWindow = gok_main_get_main_window ();
/* ignore motion events outside window */
- gdk_drawable_get_size (pWindow->window, &w, &h);
- gdk_window_get_position (pWindow->window, &offset_x, &offset_y);
- gdk_window_get_root_origin (pWindow->window, &origin_x, &origin_y);
+ gdk_window = gtk_widget_get_window (pWindow);
+ gdk_drawable_get_size (gdk_window, &w, &h);
+ gdk_window_get_position (gdk_window, &offset_x, &offset_y);
+ gdk_window_get_root_origin (gdk_window, &origin_x, &origin_y);
if (x < offset_x || x > offset_x+w ||
y < offset_y || y > offset_y+h) {
gok_scanner_on_key_leave (m_pContainingKey);
diff --git a/gok/gok-settings-dialog.c b/gok/gok-settings-dialog.c
index 7459f8c..264f652 100644
--- a/gok/gok-settings-dialog.c
+++ b/gok/gok-settings-dialog.c
@@ -121,7 +121,7 @@ gboolean gok_settingsdialog_show()
}
}
- bFirstShowing = (GDK_IS_DRAWABLE(m_pWindowSettings->window) == FALSE) ? TRUE : FALSE;
+ bFirstShowing = !gtk_widget_is_drawable (m_pWindowSettings);
gtk_widget_show (m_pWindowSettings);
diff --git a/gok/main.c b/gok/main.c
index 0e2121a..da82cd4 100644
--- a/gok/main.c
+++ b/gok/main.c
@@ -4,7 +4,9 @@
* Main file for the mighty GOK
*
* Copyright 2001-2009 Sun Microsystems, Inc.,
-* Copyright 2001-2009 University Of Toronto*
+* Copyright 2001-2009 University Of Toronto
+* Copyright 2009 Gerd Kohlberger <gerdko gmail com>
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
@@ -498,13 +500,18 @@ static Window*
gok_application_get_raise_windows (LoginHelper *helper)
{
Window *mainwin = NULL;
+ GdkWindow *window;
GtkWidget *widget = gok_main_get_main_window ();
if (widget)
{
- mainwin = g_new0 (Window, 2);
- mainwin[0] = GDK_WINDOW_XWINDOW (widget->window);
- mainwin[1] = None;
+ window = gtk_widget_get_window (widget);
+ if (window)
+ {
+ mainwin = g_new0 (Window, 2);
+ mainwin[0] = GDK_WINDOW_XWINDOW (window);
+ mainwin[1] = None;
+ }
}
return mainwin;
}
@@ -617,13 +624,14 @@ void
gok_main_center_corepointer (GtkWidget *window)
{
Display *display;
- GdkWindow *root;
+ GdkWindow *root, *gdk_window;
GdkScreen *screen;
gint screen_width, screen_height;
window = gok_main_get_main_window ();
- display = GDK_WINDOW_XDISPLAY (window->window);
- screen = gdk_drawable_get_screen (window->window);
+ gdk_window = gtk_widget_get_window (window);
+ display = GDK_WINDOW_XDISPLAY (gdk_window);
+ screen = gdk_drawable_get_screen (gdk_window);
root = gdk_screen_get_root_window (screen);
screen_width = gdk_screen_get_width (screen);
screen_height = gdk_screen_get_height (screen);
@@ -1087,6 +1095,7 @@ gok_main_set_cursor (GdkCursor *cursor)
{
GdkColor color = { 0, 0, 0, 0 };
static GdkCursor *nilCursor = NULL;
+ GtkWidget *main;
if (!cursor) {
if (!nilCursor) {
GdkPixmap *source =
@@ -1097,7 +1106,8 @@ gok_main_set_cursor (GdkCursor *cursor)
}
cursor = nilCursor;
}
- gdk_window_set_cursor (gok_main_get_main_window ()->window, cursor);
+ main = gok_main_get_main_window ();
+ gdk_window_set_cursor (gtk_widget_get_window (main), cursor);
}
/**
@@ -1354,6 +1364,7 @@ gok_main_queue_input_event (int *motion_data, gint n_axes)
*/
void gok_main_motion_listener (gint n_axes, int *motion_data, long mods, long timestamp)
{
+ GdkWindow *gdk_window;
GtkWidget *window = gok_main_get_main_window ();
if (window)
{
@@ -1366,12 +1377,12 @@ void gok_main_motion_listener (gint n_axes, int *motion_data, long mods, long ti
#endif
gok_main_queue_input_event (motion_data, n_axes);
-
- if (gok_data_get_drive_corepointer ()) {
+ gdk_window = gtk_widget_get_window (window);
+ if (gok_data_get_drive_corepointer () && gdk_window) {
Display *display;
GdkWindow *root;
- display = GDK_WINDOW_XDISPLAY (window->window);
- root = gdk_screen_get_root_window (gdk_drawable_get_screen (window->window));
+ display = GDK_WINDOW_XDISPLAY (gdk_window);
+ root = gdk_screen_get_root_window (gdk_drawable_get_screen (gdk_window));
XWarpPointer (display, None, GDK_WINDOW_XWINDOW (root), 0, 0, 0, 0, motion_data[0], motion_data[1]);
}
}
@@ -1397,11 +1408,14 @@ void gok_main_button_listener (gint button, gint state, long mods, long timestam
Window root_ret, child_ret;
unsigned int mask_ret;
GtkWidget *window;
+ GdkWindow *gdk_window;
char ename[12];
+
snprintf (ename, 12, "b%d%c", button, (state) ? 'p' : 'r');
window = gok_main_get_main_window ();
- XQueryPointer (GDK_WINDOW_XDISPLAY (window->window),
- GDK_WINDOW_XWINDOW (window->window),
+ gdk_window = gtk_widget_get_window (window);
+ XQueryPointer (GDK_WINDOW_XDISPLAY (gdk_window),
+ GDK_WINDOW_XWINDOW (gdk_window),
&root_ret, &child_ret, &x, &y,
&win_x, &win_y, &mask_ret);
SPI_generateMouseEvent (x, y, ename);
@@ -1472,9 +1486,11 @@ void gok_main_button_listener (gint button, gint state, long mods, long timestam
void
gok_main_raise_window (void)
{
- if (m_pWindowMain && m_pWindowMain->window)
+ GdkWindow *window;
+
+ if (m_pWindowMain && (window = gtk_widget_get_window (m_pWindowMain)))
{
- gdk_window_raise (m_pWindowMain->window);
+ gdk_window_raise (window);
}
}
@@ -2401,6 +2417,7 @@ void gok_main_resize_window (GtkWidget* pWindow, GokKeyboard *pKeyboard, gint Wi
gint screenX;
gint screenY;
GdkRectangle rectFrame;
+ GdkWindow *gdk_window;
/* ensure the window is at least this big */
if (Width < 50)
@@ -2450,9 +2467,10 @@ void gok_main_resize_window (GtkWidget* pWindow, GokKeyboard *pKeyboard, gint Wi
/* add the frame dimension to the window dimension */
/* get the frame location */
- gdk_window_get_frame_extents ((GdkWindow*)pWindow->window, &rectFrame);
+ gdk_window = gtk_widget_get_window (pWindow);
+ gdk_window_get_frame_extents (gdk_window, &rectFrame);
/* get the window location */
- gdk_window_get_position (pWindow->window, &winX, &winY);
+ gdk_window_get_position (gdk_window, &winX, &winY);
if ((winX != 0) &&
(winY != 0))
@@ -2510,7 +2528,7 @@ void gok_main_resize_window (GtkWidget* pWindow, GokKeyboard *pKeyboard, gint Wi
}
/* move/resize the main window */
- gdk_window_move_resize ((GdkWindow*)pWindow->window, left, top, Width, Height);
+ gdk_window_move_resize (gdk_window, left, top, Width, Height);
if (gok_data_get_dock_type () != GOK_DOCK_NONE) {
/* if this is a "never expand" keyboard, unset struts! */
@@ -2530,8 +2548,10 @@ gok_main_set_wm_dock (gboolean is_dock)
{
Atom atom_type[1], atom_window_type;
GtkWidget *widget = gok_main_get_main_window ();
+ GdkWindow *window;
if (widget) gtk_widget_hide (widget);
+ window = gtk_widget_get_window (widget);
gdk_error_trap_push ();
atom_window_type = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE");
@@ -2540,8 +2560,8 @@ gok_main_set_wm_dock (gboolean is_dock)
else
atom_type[0] = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE_NORMAL");
- XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window),
- GDK_WINDOW_XWINDOW (widget->window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (window),
atom_window_type,
XA_ATOM, 32, PropModeReplace,
(guchar *) &atom_type, 1);
@@ -2581,6 +2601,7 @@ void
gok_main_update_struts (gint width, gint height, gint x, gint y)
{
GtkWidget *widget = gok_main_get_main_window ();
+ GdkWindow *window;
Atom atom_strut = gdk_x11_get_xatom_by_name ("_NET_WM_STRUT");
Atom atom_strut_partial = gdk_x11_get_xatom_by_name ("_NET_WM_STRUT_PARTIAL");
guint32 struts[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -2602,15 +2623,15 @@ gok_main_update_struts (gint width, gint height, gint x, gint y)
}
gdk_error_trap_push ();
/* this means that we are responsible for placing ourselves appropriately on screen */
- if (widget && widget->window)
+ if (widget && (window = gtk_widget_get_window (widget)))
{
- XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window),
- GDK_WINDOW_XWINDOW (widget->window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (window),
atom_strut,
XA_CARDINAL, 32, PropModeReplace,
(guchar *) &struts, 4);
- XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window),
- GDK_WINDOW_XWINDOW (widget->window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (window),
atom_strut_partial,
XA_CARDINAL, 32, PropModeReplace,
(guchar *) &struts, 12);
@@ -2642,6 +2663,7 @@ void gok_main_store_window_center ()
gint winY;
gint winWidthCurrent;
gint winHeightCurrent;
+ GdkWindow *window;
/* don't store the window center if geometry is specified */
if (m_bUseGivenGeometry == TRUE)
@@ -2657,8 +2679,9 @@ void gok_main_store_window_center ()
}
/* get the center of the current window */
- gdk_window_get_position (m_pWindowMain->window, &winX, &winY);
- gdk_drawable_get_size (m_pWindowMain->window, &winWidthCurrent, &winHeightCurrent);
+ window = gtk_widget_get_window (m_pWindowMain);
+ gdk_window_get_position (window, &winX, &winY);
+ gdk_drawable_get_size (window, &winWidthCurrent, &winHeightCurrent);
winX += winWidthCurrent / 2;
winY += winHeightCurrent / 2;
@@ -2869,12 +2892,15 @@ gok_main_window_contains_pointer (void)
gint x=-1, y=-1, w=0, h=0;
gint px, py;
GtkWidget *widget = gok_main_get_main_window ();
+ GdkWindow *window;
+
gok_scanner_get_pointer_location (&px, &py);
- if (widget->window) {
- gdk_window_get_position (widget->window, &x, &y);
+ window = gtk_widget_get_window (widget);
+ if (window) {
+ gdk_window_get_position (window, &x, &y);
x = px-x;
y = py-y;
- gdk_drawable_get_size (widget->window, &w, &h);
+ gdk_drawable_get_size (window, &w, &h);
}
if (x < 0 || y < 0 || x > w || y > h)
return FALSE;
@@ -2885,8 +2911,10 @@ gok_main_window_contains_pointer (void)
Display *
gok_main_display (void)
{
- if (gok_main_get_main_window () != NULL)
- return GDK_WINDOW_XDISPLAY (gok_main_get_main_window ()->window);
+ GtkWidget *widget = gok_main_get_main_window ();
+ GdkWindow *window;
+ if (widget && (window = gtk_widget_get_window (widget)))
+ return GDK_WINDOW_XDISPLAY (window);
return GDK_DISPLAY ();
}
@@ -3029,11 +3057,10 @@ static gboolean
gok_main_check_sticky_keys (GtkWidget *widget)
{
int op_rtn, event_rtn, error_rtn;
- Display *display = GDK_WINDOW_XDISPLAY (widget->window);
+ Display *display = gok_main_display ();
GtkWidget *dialog;
gboolean xkb_ok = FALSE;
- g_assert (display);
if (XkbQueryExtension (display,
&op_rtn, &event_rtn, &error_rtn, NULL, NULL)) {
XkbDescRec *xkb;
@@ -3284,7 +3311,7 @@ gok_main_warn (gchar *message, gboolean always, GCallback cancelfunc, GCallback
if (!gok_main_get_use_corepointer() && ( always || gok_scanner_current_state_uses_corepointer() ))
{
- GtkWidget* button;
+ GtkWidget *button, *action_area;
if (opt_out && okfunc) (*okfunc) ();
@@ -3296,15 +3323,15 @@ gok_main_warn (gchar *message, gboolean always, GCallback cancelfunc, GCallback
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"%s", message);
-
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG(_corepointer_warning));
button = gtk_button_new_from_stock(GTK_STOCK_HELP);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(_corepointer_warning)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect (button, "clicked",
G_CALLBACK (gok_main_help_cb), NULL);
button = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(_corepointer_warning)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (gok_settingsdialog_show), NULL);
@@ -3312,13 +3339,13 @@ gok_main_warn (gchar *message, gboolean always, GCallback cancelfunc, GCallback
if (cancelfunc != NULL)
{
button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(_corepointer_warning)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
cancelfunc, _corepointer_warning);
}
button = gtk_button_new_from_stock(GTK_STOCK_OK);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(_corepointer_warning)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
(okfunc == NULL || opt_out) ? G_CALLBACK (gok_main_close_warning) : okfunc,
@@ -3346,7 +3373,7 @@ gok_main_check_accessibility ()
gok_gconf_get_bool ( client, GCONF_ACCESSIBILITY_KEY, &accessibility_on );
if (!accessibility_on) {
- GtkWidget* button;
+ GtkWidget *button, *action_area;
acd = gtk_message_dialog_new (
NULL,
@@ -3372,20 +3399,21 @@ gok_main_check_accessibility ()
"Close" "."
"\n\n"));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG(acd));
button = gtk_button_new_with_label(_("Enable and Log Out"));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(acd)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect(G_OBJECT (button), "clicked",
G_CALLBACK (check_accessibility_cb), (gpointer) "logout");
button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(acd)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect(G_OBJECT (button), "clicked",
G_CALLBACK (check_accessibility_cb), (gpointer) "quit");
button = gtk_button_new_with_label(_("Continue"));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(acd)->action_area),
+ gtk_container_add (GTK_CONTAINER (action_area),
button);
g_signal_connect(G_OBJECT (button), "clicked",
G_CALLBACK (check_accessibility_cb), (gpointer) "continue");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]