[dasher] Fixes nearly all issues with -DGSEAL_ENABLE. See bug 614995.
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Fixes nearly all issues with -DGSEAL_ENABLE. See bug 614995.
- Date: Mon, 17 May 2010 14:37:36 +0000 (UTC)
commit f66ff44381171f3f7a06e1e30abea461600c5107
Author: Andre Klapper <a9016009 gmx de>
Date: Sat Apr 17 13:28:28 2010 +0200
Fixes nearly all issues with -DGSEAL_ENABLE. See bug 614995.
Src/Gtk2/Canvas.cpp | 8 ++++++++
Src/Gtk2/DasherControl.cpp | 14 +++++++++++++-
Src/Gtk2/Preferences.cpp | 28 ++++++++++++++++------------
Src/Gtk2/dasher_maemo_helper.cpp | 8 ++++++++
Src/Gtk2/module_settings_window.cpp | 4 ++++
5 files changed, 49 insertions(+), 13 deletions(-)
---
diff --git a/Src/Gtk2/Canvas.cpp b/Src/Gtk2/Canvas.cpp
index 51c8950..65b5dc3 100644
--- a/Src/Gtk2/Canvas.cpp
+++ b/Src/Gtk2/Canvas.cpp
@@ -167,7 +167,11 @@ void CCanvas::Display() {
#if WITH_CAIRO
cairo_t *widget_cr;
+#if GTK_CHECK_VERSION (2,14,0)
+ widget_cr = gdk_cairo_create(gtk_widget_get_window(m_pCanvas));
+#else
widget_cr = gdk_cairo_create(m_pCanvas->window);
+#endif
cairo_set_source_surface(widget_cr, m_pDecorationSurface, 0, 0);
cairo_rectangle(widget_cr, 0, 0, m_iWidth, m_iHeight);
cairo_fill(widget_cr);
@@ -509,7 +513,11 @@ bool CCanvas::GetCanvasSize(GdkRectangle *pRectangle)
int iX = 0;
int iY = 0;
+#if GTK_CHECK_VERSION (2,14,0)
+ gdk_window_get_position(gtk_widget_get_window(m_pCanvas), &iX, &iY);
+#else
gdk_window_get_position(m_pCanvas->window, &iX, &iY);
+#endif
pRectangle->x = iX;
pRectangle->y = iY;
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index 2c3cf66..6f692b2 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -68,8 +68,12 @@ void CDasherControl::CreateModules() {
void CDasherControl::SetupUI() {
m_pCanvas = gtk_drawing_area_new();
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_focus(m_pCanvas, TRUE);
+#else
GTK_WIDGET_SET_FLAGS(m_pCanvas, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS(m_pCanvas, GTK_DOUBLE_BUFFERED);
+#endif
+ gtk_widget_set_double_buffered(m_pCanvas, FALSE);
GtkWidget *pFrame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(pFrame), GTK_SHADOW_IN);
@@ -402,7 +406,11 @@ void CDasherControl::HandleParameterNotification(int iParameter) {
int CDasherControl::TimerEvent() {
int x, y;
+#if GTK_CHECK_VERSION (2,14,0)
+ gdk_window_get_pointer(gtk_widget_get_window(m_pCanvas), &x, &y, NULL);
+#else
gdk_window_get_pointer(m_pCanvas->window, &x, &y, NULL);
+#endif
m_pMouseInput->SetCoordinates(x, y);
gdk_window_get_pointer(gdk_get_default_root_window(), &x, &y, NULL);
@@ -429,7 +437,11 @@ int CDasherControl::TimerEvent() {
GdkRectangle sWindowRect;
GdkRectangle sCanvasRect;
+#if GTK_CHECK_VERSION (2,14,0)
+ gdk_window_get_frame_extents(gtk_widget_get_window(m_pCanvas), &sWindowRect);
+#else
gdk_window_get_frame_extents(m_pCanvas->window, &sWindowRect);
+#endif
pUserLog->AddWindowSize(sWindowRect.y,
sWindowRect.x,
diff --git a/Src/Gtk2/Preferences.cpp b/Src/Gtk2/Preferences.cpp
index a0db8a3..a198180 100644
--- a/Src/Gtk2/Preferences.cpp
+++ b/Src/Gtk2/Preferences.cpp
@@ -379,8 +379,12 @@ void dasher_preferences_dialogue_refresh_widget(DasherPreferencesDialogue *pSelf
pUserData[0] = dasher_app_settings_get_string(pPrivate->pAppSettings, sStringTranslationTable[i].iParameter);
pUserData[1] = GTK_TREE_VIEW(sStringTranslationTable[i].pWidget);
pUserData[2] = pSelf;
-
+
+#if GTK_CHECK_VERSION (2,20,0)
+ if(sStringTranslationTable[i].pWidget && gtk_widget_get_realized(sStringTranslationTable[i].pWidget))
+#else
if(sStringTranslationTable[i].pWidget && GTK_WIDGET_REALIZED(sStringTranslationTable[i].pWidget))
+#endif
gtk_tree_model_foreach(pModel, dasher_preferences_refresh_foreach_function, pUserData);
}
}
@@ -395,9 +399,9 @@ static void dasher_preferences_dialogue_refresh_parameter(DasherPreferencesDialo
for(int i(0); i < iNumBoolEntries; ++i) {
if((pWidget == NULL) || (sBoolTranslationTable[i].pWidget == pWidget)) {
- if(GTK_TOGGLE_BUTTON(sBoolTranslationTable[i].pWidget)->active != dasher_app_settings_get_bool(pPrivate->pAppSettings, sBoolTranslationTable[i].iParameter)) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sBoolTranslationTable[i].pWidget)) != dasher_app_settings_get_bool(pPrivate->pAppSettings, sBoolTranslationTable[i].iParameter)) {
- dasher_app_settings_set_bool(pPrivate->pAppSettings, sBoolTranslationTable[i].iParameter, GTK_TOGGLE_BUTTON(sBoolTranslationTable[i].pWidget)->active);
+ dasher_app_settings_set_bool(pPrivate->pAppSettings, sBoolTranslationTable[i].iParameter, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sBoolTranslationTable[i].pWidget)));
}
}
}
@@ -751,7 +755,7 @@ extern "C" void OnMousePosStyleChanged(GtkWidget *widget, gpointer user_data) {
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
// FIXME - duplicate code from extern "C" void startonmousepos
- if((pPrivate->pMousePosButton)->active) {
+ if(gtk_toggle_button_get_active(pPrivate->pMousePosButton)) {
int iIndex;
iIndex = gtk_combo_box_get_active(pPrivate->pMousePosStyle);
@@ -770,7 +774,7 @@ extern "C" void startonmousepos(GtkWidget *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- if(GTK_TOGGLE_BUTTON(widget)->active) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
int iIndex;
iIndex = gtk_combo_box_get_active(pPrivate->pMousePosStyle);
@@ -805,7 +809,7 @@ extern "C" void orientation(GtkRadioButton *widget, gpointer user_data) {
return;
// Again, this could be neater.
- if(GTK_TOGGLE_BUTTON(widget)->active == TRUE) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == TRUE) {
if(!strcmp(gtk_widget_get_name(GTK_WIDGET(widget)), "radiobutton1")) {
dasher_app_settings_set_long(pPrivate->pAppSettings, LP_ORIENTATION, Dasher::Opts::Alphabet);
@@ -867,7 +871,7 @@ extern "C" void ThickLineClicked(GtkWidget *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- if(GTK_TOGGLE_BUTTON(widget)->active)
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
dasher_app_settings_set_long(pPrivate->pAppSettings, LP_LINE_WIDTH, 3);
else
dasher_app_settings_set_long(pPrivate->pAppSettings, LP_LINE_WIDTH, 1);
@@ -877,14 +881,14 @@ extern "C" void autocolour_clicked(GtkWidget *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- dasher_app_settings_set_bool(pPrivate->pAppSettings, BP_PALETTE_CHANGE, !GTK_TOGGLE_BUTTON(widget)->active);
+ dasher_app_settings_set_bool(pPrivate->pAppSettings, BP_PALETTE_CHANGE, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
}
extern "C" void mouseposstart_y_changed(GtkRange *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- int mouseposstartdist=int(widget->adjustment->value);
+ int mouseposstartdist=int(gtk_adjustment_get_value(gtk_range_get_adjustment(widget)));
dasher_app_settings_set_long(pPrivate->pAppSettings, LP_MOUSEPOSDIST, mouseposstartdist);
}
@@ -892,7 +896,7 @@ extern "C" void languagemodel(GtkRadioButton *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- if (GTK_TOGGLE_BUTTON(widget)->active==TRUE) {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))==TRUE) {
if( !strcmp( gtk_widget_get_name( GTK_WIDGET(widget) ), "radiobutton6" ) ) {
dasher_app_settings_set_long(pPrivate->pAppSettings, LP_LANGUAGE_MODEL_ID, 0 );
} else if (!strcmp( gtk_widget_get_name( GTK_WIDGET(widget) ), "radiobutton7" )) {
@@ -910,7 +914,7 @@ extern "C" void uniform_changed(GtkHScale *hscale) {
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- int iValue = (int)(GTK_RANGE(hscale)->adjustment->value * 10);
+ int iValue = (int)(gtk_adjustment_get_value(gtk_range_get_adjustment(GTK_RANGE(hscale))) * 10);
if(iValue < 50) {
iValue = 50;
@@ -929,7 +933,7 @@ extern "C" void on_appstyle_changed(GtkWidget *widget, gpointer user_data) {
// DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(pSelf);
DasherPreferencesDialoguePrivate *pPrivate = DASHER_PREFERENCES_DIALOGUE_PRIVATE(g_pPreferencesDialogue); // TODO: Fix NULL
- if(GTK_TOGGLE_BUTTON(widget)->active) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
if(!strcmp(gtk_widget_get_name(GTK_WIDGET(widget)), "appstyle_classic"))
dasher_app_settings_set_long(pPrivate->pAppSettings, APP_LP_STYLE, 0);
else if(!strcmp(gtk_widget_get_name(GTK_WIDGET(widget)), "appstyle_compose"))
diff --git a/Src/Gtk2/dasher_maemo_helper.cpp b/Src/Gtk2/dasher_maemo_helper.cpp
index f8603c9..66d5738 100644
--- a/Src/Gtk2/dasher_maemo_helper.cpp
+++ b/Src/Gtk2/dasher_maemo_helper.cpp
@@ -79,7 +79,11 @@ DasherMaemoHelper *dasher_maemo_helper_new(GtkWindow *pWindow) {
void dasher_maemo_helper_setup_window(DasherMaemoHelper *pSelf) {
DasherMaemoHelperPrivate *pPrivate = (DasherMaemoHelperPrivate *)(pSelf->private_data);
+#if GTK_CHECK_VERSION (2,14,0)
+ gdk_window_add_filter(GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(pPrivate->pWindow))), peek_filter, pSelf);
+#else
gdk_window_add_filter(GDK_WINDOW(GTK_WIDGET(pPrivate->pWindow)->window), peek_filter, pSelf);
+#endif
}
// TODO: Make better use of the GDK X11 wrapper functions
@@ -102,7 +106,11 @@ GdkFilterReturn dasher_maemo_helper_handle_xevent(DasherMaemoHelper *pSelf, GdkX
g_FWindow = (Window)xev->xclient.data.l[1];
g_pFocusWindow = gdk_window_foreign_new(g_FWindow);
g_pRandomWindow = gdk_window_foreign_new(g_FRandomWindow);
+#if GTK_CHECK_VERSION (2,14,0)
+ gdk_window_set_transient_for(GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(pPrivate->pWindow))), g_pFocusWindow);
+#else
gdk_window_set_transient_for(GDK_WINDOW(GTK_WIDGET(pPrivate->pWindow)->window), g_pFocusWindow);
+#endif
}
else if((xev->xclient.data.l[3] == 0x11) || (xev->xclient.data.l[3] == 0x12)) {
diff --git a/Src/Gtk2/module_settings_window.cpp b/Src/Gtk2/module_settings_window.cpp
index e8a82d2..bc42ac4 100644
--- a/Src/Gtk2/module_settings_window.cpp
+++ b/Src/Gtk2/module_settings_window.cpp
@@ -97,7 +97,11 @@ module_settings_window_new(DasherAppSettings *pAppSettings, const gchar *szName,
g_free(szFrameTitle);
+#if GTK_CHECK_VERSION (2,14,0)
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(&(pDasherControl->window))), pFrame);
+#else
gtk_container_add(GTK_CONTAINER(pDasherControl->window.vbox), pFrame);
+#endif
g_object_set(G_OBJECT(pFrame), "border-width", 8, NULL);
GtkWidget *pTable = gtk_table_new(iCount, 2, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]