Make GdkAppLaunchContext display-dependent
Add a GdkDisplay::get_app_launch_context vfunc, and a gdk_display_get_app_launch_context that for X11 returns a subclass. For win32 and quartz, the implementations were trivial, so we just return a new GdkAppLaunchContext without subclassing. Since the type of the context now depends on the display, gdk_app_launch_context_set_display is deprecated.
This commit is contained in:
@ -23,10 +23,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkapplaunchcontext.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkx.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
#include <glib.h>
|
||||
@ -258,10 +258,10 @@ add_startup_timeout (GdkScreen *screen,
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
|
||||
GAppInfo *info,
|
||||
GList *files)
|
||||
static char *
|
||||
gdk_app_launch_context_x11_get_startup_notify_id (GAppLaunchContext *context,
|
||||
GAppInfo *info,
|
||||
GList *files)
|
||||
{
|
||||
static int sequence = 0;
|
||||
GdkAppLaunchContextPrivate *priv;
|
||||
@ -281,21 +281,11 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
|
||||
|
||||
priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
|
||||
|
||||
display = priv->display;
|
||||
if (priv->screen)
|
||||
{
|
||||
screen = priv->screen;
|
||||
display = gdk_screen_get_display (priv->screen);
|
||||
}
|
||||
else if (priv->display)
|
||||
{
|
||||
display = priv->display;
|
||||
screen = gdk_display_get_default_screen (display);
|
||||
}
|
||||
screen = priv->screen;
|
||||
else
|
||||
{
|
||||
display = gdk_display_get_default ();
|
||||
screen = gdk_display_get_default_screen (display);
|
||||
}
|
||||
screen = gdk_display_get_default_screen (priv->display);
|
||||
|
||||
fileinfo = NULL;
|
||||
|
||||
@ -398,9 +388,9 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gdk_windowing_launch_failed (GAppLaunchContext *context,
|
||||
const char *startup_notify_id)
|
||||
static void
|
||||
gdk_app_launch_context_x11_launch_failed (GAppLaunchContext *context,
|
||||
const char *startup_notify_id)
|
||||
{
|
||||
GdkAppLaunchContextPrivate *priv;
|
||||
GdkScreen *screen;
|
||||
@ -412,10 +402,8 @@ _gdk_windowing_launch_failed (GAppLaunchContext *context,
|
||||
|
||||
if (priv->screen)
|
||||
screen = priv->screen;
|
||||
else if (priv->display)
|
||||
screen = gdk_display_get_default_screen (priv->display);
|
||||
else
|
||||
screen = gdk_display_get_default_screen (gdk_display_get_default ());
|
||||
screen = gdk_display_get_default_screen (priv->display);
|
||||
|
||||
data = g_object_get_data (G_OBJECT (screen), "appinfo-startup-data");
|
||||
|
||||
@ -441,3 +429,33 @@ _gdk_windowing_launch_failed (GAppLaunchContext *context,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct GdkAppLaunchContext GdkAppLaunchContextX11;
|
||||
typedef struct GdkAppLaunchContextClass GdkAppLaunchContextX11Class;
|
||||
|
||||
G_DEFINE_TYPE (GdkAppLaunchContextX11, _gdk_app_launch_context_x11, GDK_TYPE_APP_LAUNCH_CONTEXT)
|
||||
|
||||
static void
|
||||
_gdk_app_launch_context_x11_class_init (GdkAppLaunchContextX11Class *klass)
|
||||
{
|
||||
GAppLaunchContextClass *ctx_class = G_APP_LAUNCH_CONTEXT_CLASS (klass);
|
||||
|
||||
ctx_class->get_startup_notify_id = gdk_app_launch_context_x11_get_startup_notify_id;
|
||||
ctx_class->launch_failed = gdk_app_launch_context_x11_launch_failed;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_app_launch_context_x11_init (GdkAppLaunchContextX11 *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
GdkAppLaunchContext *
|
||||
_gdk_x11_display_get_app_launch_context (GdkDisplay *display)
|
||||
{
|
||||
GdkAppLaunchContext *ctx;
|
||||
|
||||
ctx = g_object_new (_gdk_app_launch_context_x11_get_type (), NULL);
|
||||
gdk_app_launch_context_set_display (ctx, display);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@ -2703,6 +2703,8 @@ gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display)
|
||||
gdk_x11_display_error_trap_pop_internal (display, FALSE);
|
||||
}
|
||||
|
||||
extern GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
|
||||
|
||||
static void
|
||||
_gdk_display_x11_class_init (GdkDisplayX11Class * class)
|
||||
{
|
||||
@ -2730,5 +2732,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
|
||||
display_class->list_devices = gdk_x11_display_list_devices;
|
||||
display_class->send_client_message = gdk_x11_display_send_client_message;
|
||||
display_class->add_client_message_filter = gdk_x11_display_add_client_message_filter;
|
||||
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user