summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-01-29 00:58:14 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-28 18:20:29 -0800
commit37282176d5b3348beacda3622ca4726c4d1f41d7 (patch)
tree15a5e83f6e87726f682bcbd4a1d8576c46c17d27 /info.c
parente142a0f94cd0180f8f3efe1a947c10aaaef0a227 (diff)
downloadsubsurface-37282176d5b3348beacda3622ca4726c4d1f41d7.tar.gz
GPS location map input
On 28 January 2013 23:26, Dirk Hohndel <dirk@hohndel.org> wrote: > > Just pushed out Linus' Gtk3 readiness changes plus my change that allows > the user to not only type in GPS coordinates but also use a map widget > to pick the dive site. > > There were a few very odd Gtk things going on - when I opened the map > widget from the dive info dialog (by clicking the button), the widget > would be completely unresponsive. No panning, no zooming, no > right-click, nothing. > > Opening an equipent widget and immideately closing it again suddenly > made the map widget responsive. WTF? > > I worked around this by doing an explicit grab in the map widget, but > that seems like a hack and just to work around the underlying issue. > > If anyone can figure this out, patches welcome. > > The other shortcomings (besides the uglyness of the UI) are that it may > be non-obvious to the user that it takes a right click to get a menu > item that allows you to "mark location here" - I'm sure there's a more > intuitive way to do this, but since left click is used for panning, this > was the best idea I could come up with... > > Please test - I wouldn't be surprised if there are a few bugs still > hidden in this code. > here an fix to make this work on win32 and also solve a potential issue of type: (subsurface.bin:19441): Gtk-CRITICAL **: IA__gtk_entry_set_text: assertion `GTK_IS_ENTRY (entry)' failed my commit message is explicit on the reasons: ------------------------ When called from the "dive edit" dialog the, map windows seems inactive on Windows. It cannot accept focus and is also behind all other application windows. There are a couple of important new calls in gps.c:show_map(): gtk_window_set_transient_for(GTK_WINDOW(*window), GTK_WINDOW(main_window)); (^ docs say gtk "may" call this one for us, on what condition - not specified) gtk_window_set_modal(GTK_WINDOW(*window), TRUE); (^ broken on ubuntu 12.04, but needed on Win32)) Making the window transient for the main window and also modal for the entire application's window stack (or at least try). Older versions of gtk+2 and also in the most recently tested libgtk2.0-0 2.24.10-0ubuntu6, seem not to recognize the significance of gtk_window_set_modal() and the call does not work as expected. This forces us to check if the dialog from which the call originated exists, since its possible to close it _while_ the map widget is active. More specifically, we check in info.c if the location_update.entry pointer was set to NULL before performing actions with in the update_gps_entry() callback. ------------------------ also removed the gtk_window_present() call as it seemed redundant post these changes (?). ------- on a side note: looks like i'm above 100 commits... cheers everyone <has a sip of some late beer> :0 ~ c|_| lubomir -- From fe9967c7ad2ec3b93ad336c2c6bed492a5ad0d8b Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" <neolit123@gmail.com> Date: Tue, 29 Jan 2013 00:24:21 +0200 Subject: [PATCH] Fix a "stacking" issue with the map-window on Windows When called from the "dive edit" dialog the, map windows seems inactive on Windows. It cannot accept focus and is also behind all other application windows. There are a couple of important new calls in gps.c:show_map(): gtk_window_set_transient_for(GTK_WINDOW(*window), GTK_WINDOW(main_window)); (^ docs say gtk "may" call this one for us, on what condition - not specified) gtk_window_set_modal(GTK_WINDOW(*window), TRUE); (^ broken on ubuntu 12.04, but needed on Win32)) Making the window transient for the main window and also modal for the entire application's window stack (or at least try). Older versions of gtk+2 and also in the most recently tested libgtk2.0-0 2.24.10-0ubuntu6, seem not to recognize the significance of gtk_window_set_modal() and the call does not work as expected. This forces us to check if the dialog from which the call originated exists, since its possible to close it _while_ the map widget is active. More specifically, we check in info.c if the location_update.entry pointer was set to NULL before performing actions with in the update_gps_entry() callback. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/info.c b/info.c
index 15e15d6cd..d6e2182ce 100644
--- a/info.c
+++ b/info.c
@@ -642,8 +642,10 @@ void update_gps_entry(float lat, float lon)
{
char gps_text[45];
- print_gps_coordinates(gps_text, 45, lat, lon);
- gtk_entry_set_text(location_update.entry, gps_text);
+ if (location_update.entry) {
+ print_gps_coordinates(gps_text, 45, lat, lon);
+ gtk_entry_set_text(location_update.entry, gps_text);
+ }
}
#if HAVE_OSM_GPS_MAP
@@ -959,6 +961,7 @@ int edit_multi_dive_info(struct dive *single_dive)
update_dive(master);
}
gtk_widget_destroy(dialog);
+ location_update.entry = NULL;
return success;
}