diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-05 20:02:05 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-05 20:04:36 +0100 |
commit | f0b7fc1ecb80cb34a45e60d07e9c53745b251686 (patch) | |
tree | fd492257cd76b856d9f9282e6bd69c650aea9797 /src/location-geoclue2.c | |
parent | Consistently use (locally defined) WINDOWS macro over mixing __WIN32__ and _WIN32 (diff) | |
download | redshift-ng-f0b7fc1ecb80cb34a45e60d07e9c53745b251686.tar.gz redshift-ng-f0b7fc1ecb80cb34a45e60d07e9c53745b251686.tar.bz2 redshift-ng-f0b7fc1ecb80cb34a45e60d07e9c53745b251686.tar.xz |
Just use double, no mixing in float
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r-- | src/location-geoclue2.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c index 835b4c4..329348e 100644 --- a/src/location-geoclue2.c +++ b/src/location-geoclue2.c @@ -34,8 +34,7 @@ struct location_state { int pipe_fd_write; int available; int error; - float latitude; - float longitude; + struct location location; }; @@ -104,11 +103,11 @@ geoclue_client_signal_cb(GDBusProxy *client, gchar *sender_name, /* Read location properties */ GVariant *lat_v = g_dbus_proxy_get_cached_property( location, "Latitude"); - state->latitude = g_variant_get_double(lat_v); + state->location.lat = g_variant_get_double(lat_v); GVariant *lon_v = g_dbus_proxy_get_cached_property( location, "Longitude"); - state->longitude = g_variant_get_double(lon_v); + state->location.lon = g_variant_get_double(lon_v); state->available = 1; @@ -344,8 +343,8 @@ location_geoclue2_start(struct location_state *state) state->available = 0; state->error = 0; - state->latitude = 0; - state->longitude = 0; + state->location.lat = 0; + state->location.lon = 0; int pipefds[2]; int r = pipeutils_create_nonblocking(pipefds); @@ -408,13 +407,14 @@ location_geoclue2_handle( struct location_state *state, struct location *location, int *available) { + int error; + pipeutils_handle_signal(state->pipe_fd_read); g_mutex_lock(&state->lock); - int error = state->error; - location->lat = state->latitude; - location->lon = state->longitude; + error = state->error; + *location = state->location; *available = state->available; g_mutex_unlock(&state->lock); |