Commit def55655 authored by Nick Schermer's avatar Nick Schermer

Use the gdk extension from libxfce4ui.

parent 8990efaf
......@@ -36,6 +36,8 @@
#include <time.h>
#endif
#include <libxfce4ui/libxfce4ui.h>
#include <thunar/thunar-application.h>
#include <thunar/thunar-browser.h>
#include <thunar/thunar-dialogs.h>
......@@ -563,7 +565,7 @@ thunar_application_drive_eject (GVolumeMonitor *volume_monitor,
argv[3] = NULL;
/* locate the currently active screen (the one with the pointer) */
screen = thunar_gdk_screen_get_active ();
screen = xfce_gdk_screen_get_active (NULL);
/* try to spawn the volume_monitor on the active screen */
if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err))
......@@ -614,7 +616,7 @@ thunar_application_volman_idle (gpointer user_data)
application->volman_udis = g_slist_delete_link (application->volman_udis, application->volman_udis);
/* locate the currently active screen (the one with the pointer) */
screen = thunar_gdk_screen_get_active ();
screen = xfce_gdk_screen_get_active (NULL);
/* try to spawn the volman on the active screen */
if (gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, &err))
......
......@@ -37,10 +37,6 @@
#include <thunar/thunar-gdk-extensions.h>
#include <thunar/thunar-private.h>
#if defined(GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
#endif
/**
......@@ -132,61 +128,3 @@ thunar_gdk_screen_open (const gchar *display_name,
return screen;
}
/**
* thunar_gdk_screen_get_active:
*
* Returns the currently active #GdkScreen, that is the
* screen, which currently contains the pointer.
*
* Return value: the currently active #GdkScreen.
**/
GdkScreen*
thunar_gdk_screen_get_active (void)
{
#if defined(GDK_WINDOWING_X11)
GdkScreen *screen;
Window child;
Window root;
GSList *displays;
GSList *lp;
guint xmask;
gint rootx, rooty;
gint winx, winy;
gint n;
/* determine the list of active displays */
displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
for (lp = displays; lp != NULL; lp = lp->next)
{
/* check all screens on this display */
for (n = 0; n < gdk_display_get_n_screens (lp->data); ++n)
{
/* check if this screen contains the pointer */
screen = gdk_display_get_screen (lp->data, n);
if (XQueryPointer (GDK_SCREEN_XDISPLAY (screen),
GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen)),
&root, &child, &rootx, &rooty, &winx, &winy, &xmask))
{
/* yap, this screen contains the pointer, hence it's the active screen */
goto out;
}
}
}
/* fallback to the default screen */
screen = gdk_screen_get_default ();
out:
/* release the displays */
g_slist_free (displays);
return screen;
#else
/* dunno what to do on non-X11 window systems */
return gdk_screen_get_default ();
#endif
}
......@@ -27,8 +27,6 @@ G_BEGIN_DECLS;
GdkScreen *thunar_gdk_screen_open (const gchar *display_name,
GError **error);
GdkScreen *thunar_gdk_screen_get_active (void);
G_END_DECLS;
#endif /* !__THUNAR_GDK_EXTENSIONS_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment