Commit c456e988 authored by Alexander Larsson's avatar Alexander Larsson

Remove X use from broadway backend

parent dffa6e0d
......@@ -1189,247 +1189,7 @@ else
fi
if test "x$gdktarget" = "xbroadway" ; then
X_PACKAGES=fontconfig
#
# We use fontconfig very peripherally when decoding the default
# settings.
#
if $PKG_CONFIG --exists fontconfig; then : ; else
AC_MSG_ERROR([
*** fontconfig (http://www.fontconfig.org) is required by the X11 backend.])
fi
#
# Check for basic X packages; we use pkg-config if available
#
if $PKG_CONFIG --exists x11 xext; then
have_base_x_pc=true
X_PACKAGES="$X_PACKAGES x11 xext"
x_libs="`$PKG_CONFIG --libs x11 xext`"
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext`"
# Strip out any .la files that pkg-config might give us (this happens
# with -uninstalled.pc files)
x_libs_for_checks=
for I in $x_libs ; do
case $I in
*.la) ;;
*) x_libs_for_checks="$x_libs_for_checks $I" ;;
esac
done
GTK_PACKAGES_FOR_X="x11"
else
have_base_x_pc=false
AC_PATH_XTRA
if test x$no_x = xyes ; then
AC_MSG_ERROR([X development libraries not found])
fi
x_cflags="$X_CFLAGS"
x_libs_for_checks="$X_LIBS -lXext -lX11 $X_EXTRA_LIBS"
GTK_DEP_LIBS_FOR_X="$X_LIBS -lX11 $X_EXTRA_LIBS"
fi
# Extra libraries found during checks (-lXinerama, etc), not from pkg-config.
x_extra_libs=
gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
gtk_save_LIBS=$LIBS
LIBS="$x_libs_for_checks $LIBS"
# Sanity check for the X11 and Xext libraries. While everything we need from
# Xext is optional, the chances a system has *none* of these things is so
# small that we just unconditionally require it.
AC_CHECK_FUNC(XOpenDisplay, :,
AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]))
AC_CHECK_FUNC(XextFindDisplay, :,
AC_MSG_ERROR([*** libXext not found. Check 'config.log' for more details.]))
# Check for xReply
AC_MSG_CHECKING([if <X11/extensions/XIproto.h> is needed for xReply])
AC_TRY_COMPILE([#include <X11/Xlibint.h>],
[xReply *rep;],
[AC_MSG_RESULT([no])],
[AC_TRY_COMPILE([#include <X11/extensions/XIproto.h>
#include <X11/Xlibint.h>],
[xReply *rep;],
[AC_MSG_RESULT([yes])
AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], 1,
[Define if <X11/extensions/XIproto.h> needed for xReply])],
[AC_MSG_RESULT([unknown])
AC_MSG_ERROR([xReply type unavailable. X11 is too old])])])
# Check for XConvertCase, XInternAtoms (X11R6 specific)
AC_CHECK_FUNCS(XConvertCase XInternAtoms)
# Generic X11R6 check needed for XIM support; we could
# probably use this to replace the above, but we'll
# leave the separate checks for XConvertCase and XInternAtoms
# for clarity
have_x11r6=false
AC_CHECK_FUNC(XAddConnectionWatch,
have_x11r6=true)
if $have_x11r6; then
AC_DEFINE(HAVE_X11R6, 1, [Define if we have X11R6])
fi
AM_CONDITIONAL(HAVE_X11R6, $have_x11r6)
# Check for XKB support.
if test "x$enable_xkb" = "xyes"; then
AC_MSG_WARN(XKB support explicitly enabled)
AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
elif test "x$enable_xkb" = "xmaybe"; then
AC_CHECK_FUNC(XkbQueryExtension,
AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]))
else
AC_MSG_WARN(XKB support explicitly disabled)
fi
# Check for shaped window extension
AC_CHECK_FUNC(XShapeCombineMask, :,
[AC_MSG_ERROR([Shape extension not found, check your development headers])])
# X SYNC check
gtk_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $x_cflags"
AC_CHECK_FUNC(XSyncQueryExtension,
[AC_CHECK_HEADER(X11/extensions/sync.h,
AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library]),
:, [#include <X11/Xlib.h>])])
CFLAGS="$gtk_save_CFLAGS"
if test "x$enable_xinerama" = "xyes"; then
# Check for Xinerama extension (Solaris impl or Xfree impl)
gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $x_cflags"
# Check for XFree
AC_MSG_CHECKING(for Xinerama support on XFree86)
have_xfree_xinerama=false
if $PKG_CONFIG --exists xinerama ; then
have_xfree_xinerama=true
X_PACKAGES="$X_PACKAGES xinerama"
else
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
[AC_CHECK_HEADER(X11/extensions/Xinerama.h,
[GTK_ADD_LIB(x_extra_libs,Xinerama)
have_xfree_xinerama=true], :,
[#include <X11/Xlib.h>])])
fi
if $have_xfree_xinerama ; then
AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
[Define to 1 if XFree Xinerama is available])
AC_DEFINE(HAVE_XINERAMA, 1,
[Define to 1 is Xinerama is available])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
case "$host" in
*-*-solaris*)
# Check for solaris
AC_MSG_CHECKING(for Xinerama support on Solaris)
have_solaris_xinerama=false
AC_CHECK_FUNC(XineramaGetInfo,
[AC_CHECK_HEADER(X11/extensions/xinerama.h,
[have_solaris_xinerama=true], :,
[#include <X11/Xlib.h>])])
if $have_solaris_xinerama ; then
AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
[Define to 1 if solaris xinerama is available])
AC_DEFINE(HAVE_XINERAMA, 1,
[Define to 1 if xinerama is available])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
;;
*)
;;
esac
fi
fi
AC_DEFINE(XINPUT_NONE, 1, [Define to 1 if no XInput should be used])
AM_CONDITIONAL(XINPUT_XFREE, false)
AM_CONDITIONAL(XINPUT_2, false)
# Check for the RANDR extension
if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
X_PACKAGES="$X_PACKAGES xrandr"
fi
# Checks for Xcursor library
if $PKG_CONFIG --exists xcursor ; then
AC_DEFINE(HAVE_XCURSOR, 1, [Have the Xcursor library])
X_PACKAGES="$X_PACKAGES xcursor"
fi
# Checks for XFixes extension
if $PKG_CONFIG --exists xfixes ; then
AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
X_PACKAGES="$X_PACKAGES xfixes"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
fi
# Checks for Xcomposite extension
if $PKG_CONFIG --exists xcomposite ; then
AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
X_PACKAGES="$X_PACKAGES xcomposite"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcomposite"
fi
# Checks for Xdamage extension
if $PKG_CONFIG --exists xdamage ; then
AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
X_PACKAGES="$X_PACKAGES xdamage"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xdamage"
fi
if $have_base_x_pc ; then
GDK_EXTRA_LIBS="$x_extra_libs"
else
GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs -lXext -lX11 $GDK_EXTRA_LIBS"
fi
CPPFLAGS="$gtk_save_cppflags"
LIBS="$gtk_save_libs"
AM_CONDITIONAL(USE_X11, true)
else
XPACKAGES=
AM_CONDITIONAL(XINPUT_XFREE, false)
AM_CONDITIONAL(XINPUT_2, false)
AM_CONDITIONAL(USE_X11, false)
AM_CONDITIONAL(HAVE_X11R6, false)
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz"
fi
# Check for Pango flags
......
......@@ -17,10 +17,7 @@ LDADDS = $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = libgdk-broadway.la
libgdk_broadway_la_SOURCES = \
MwmUtil.h \
gdkapplaunchcontext-broadway.c \
gdkasync.c \
gdkasync.h \
gdkcursor-broadway.c \
gdkdevice-broadway.h \
gdkdevice-broadway.c \
......@@ -33,7 +30,6 @@ libgdk_broadway_la_SOURCES = \
gdkdrawable-broadway.h \
gdkeventsource.c \
gdkeventsource.h \
gdkgeometry-broadway.c \
gdkglobals-broadway.c \
gdkim-broadway.c \
gdkinput.c \
......@@ -48,22 +44,6 @@ libgdk_broadway_la_SOURCES = \
gdkvisual-broadway.c \
gdkwindow-broadway.c \
gdkwindow-broadway.h \
gdkxftdefaults.c \
gdkxid.c \
gdkx.h \
gdkprivate-broadway.h \
xsettings-client.h \
xsettings-client.c \
xsettings-common.h \
xsettings-common.c
libgdkinclude_HEADERS = \
gdkx.h
# We need to include all these C files here since the conditionals
# don't seem to be correctly expanded for the dist files.
EXTRA_DIST += \
gdksettings.c
gdkprivate-broadway.h
-include $(top_srcdir)/git.mk
/**
*
* $Id$
*
* Copyright (C) 1995 Free Software Foundation, Inc.
*
* This file is part of the GNU LessTif Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*
* * Feb 21 1999 - George Lebl (jirka@5z.com)
* Owen Taylor (otaylor@redhat.com)
*
* Modified so that the MotifWmHints structure defined here
* is suitable for client side use on 64-bit architectures.
* X expects fields with a format of 32 to be longs, even
* when sizeof(long) == 8.
**/
#ifndef MWMUTIL_H_INCLUDED
#define MWMUTIL_H_INCLUDED
#include <X11/Xmd.h>
G_BEGIN_DECLS
typedef struct {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
} MotifWmHints, MwmHints;
#define MWM_HINTS_FUNCTIONS (1L << 0)
#define MWM_HINTS_DECORATIONS (1L << 1)
#define MWM_HINTS_INPUT_MODE (1L << 2)
#define MWM_HINTS_STATUS (1L << 3)
#define MWM_FUNC_ALL (1L << 0)
#define MWM_FUNC_RESIZE (1L << 1)
#define MWM_FUNC_MOVE (1L << 2)
#define MWM_FUNC_MINIMIZE (1L << 3)
#define MWM_FUNC_MAXIMIZE (1L << 4)
#define MWM_FUNC_CLOSE (1L << 5)
#define MWM_DECOR_ALL (1L << 0)
#define MWM_DECOR_BORDER (1L << 1)
#define MWM_DECOR_RESIZEH (1L << 2)
#define MWM_DECOR_TITLE (1L << 3)
#define MWM_DECOR_MENU (1L << 4)
#define MWM_DECOR_MINIMIZE (1L << 5)
#define MWM_DECOR_MAXIMIZE (1L << 6)
#define MWM_INPUT_MODELESS 0
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
#define MWM_INPUT_SYSTEM_MODAL 2
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
#define MWM_TEAROFF_WINDOW (1L<<0)
/*
* atoms
*/
#define _XA_MOTIF_BINDINGS "_MOTIF_BINDINGS"
#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
#define _XA_MOTIF_WM_MESSAGES "_MOTIF_WM_MESSAGES"
#define _XA_MOTIF_WM_OFFSET "_MOTIF_WM_OFFSET"
#define _XA_MOTIF_WM_MENU "_MOTIF_WM_MENU"
#define _XA_MOTIF_WM_INFO "_MOTIF_WM_INFO"
#define _XA_MWM_HINTS _XA_MOTIF_WM_HINTS
#define _XA_MWM_MESSAGES _XA_MOTIF_WM_MESSAGES
#define _XA_MWM_MENU _XA_MOTIF_WM_MENU
#define _XA_MWM_INFO _XA_MOTIF_WM_INFO
/*
* _MWM_INFO property
*/
typedef struct {
long flags;
Window wm_window;
} MotifWmInfo;
typedef MotifWmInfo MwmInfo;
#define MWM_INFO_STARTUP_STANDARD (1L<<0)
#define MWM_INFO_STARTUP_CUSTOM (1L<<1)
/*
* _MWM_HINTS property
*/
typedef struct {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
} PropMotifWmHints;
typedef PropMotifWmHints PropMwmHints;
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
#define PROP_MWM_HINTS_ELEMENTS PROP_MOTIF_WM_HINTS_ELEMENTS
/*
* _MWM_INFO property, slight return
*/
typedef struct {
unsigned long flags;
unsigned long wmWindow;
} PropMotifWmInfo;
typedef PropMotifWmInfo PropMwmInfo;
#define PROP_MOTIF_WM_INFO_ELEMENTS 2
#define PROP_MWM_INFO_ELEMENTS PROP_MOTIF_WM_INFO_ELEMENTS
G_END_DECLS
#endif /* MWMUTIL_H_INCLUDED */
......@@ -24,7 +24,6 @@
#include "gdkapplaunchcontext.h"
#include "gdkx.h"
#include "gdkscreen.h"
#include "gdkinternals.h"
#include "gdkintl.h"
......@@ -35,406 +34,17 @@
#include <string.h>
#include <unistd.h>
static char *
get_display_name (GFile *file)
{
GFileInfo *info;
char *name, *tmp;
/* This does sync I/O, which isn't ideal.
* It should probably use the NautilusFile machinery
*/
name = NULL;
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, 0, NULL, NULL);
if (info)
{
name = g_strdup (g_file_info_get_display_name (info));
g_object_unref (info);
}
if (name == NULL)
{
name = g_file_get_basename (file);
if (!g_utf8_validate (name, -1, NULL))
{
tmp = name;
name =
g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH,
TRUE);
g_free (tmp);
}
}
return name;
}
static GIcon *
get_icon (GFile *file)
{
GFileInfo *info;
GIcon *icon;
icon = NULL;
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_ICON, 0, NULL, NULL);
if (info)
{
icon = g_file_info_get_icon (info);
if (icon)
g_object_ref (icon);
g_object_unref (info);
}
return icon;
}
static char *
gicon_to_string (GIcon *icon)
{
GFile *file;
const char *const *names;
if (G_IS_FILE_ICON (icon))
{
file = g_file_icon_get_file (G_FILE_ICON (icon));
if (file)
return g_file_get_path (file);
}
else if (G_IS_THEMED_ICON (icon))
{
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names)
return g_strdup (names[0]);
}
else if (G_IS_EMBLEMED_ICON (icon))
{
GIcon *base;
base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
return gicon_to_string (base);
}
return NULL;
}
static void
end_startup_notification (GdkDisplay *display,
const char *startup_id)
{
gdk_x11_display_broadcast_startup_message (display, "remove",
"ID", startup_id,
NULL);
}
/* This should be fairly long, as it's confusing to users if a startup
* ends when it shouldn't (it appears that the startup failed, and
* they have to relaunch the app). Also the timeout only matters when
* there are bugs and apps don't end their own startup sequence.
*
* This timeout is a "last resort" timeout that ignores whether the
* startup sequence has shown activity or not. Metacity and the
* tasklist have smarter, and correspondingly able-to-be-shorter
* timeouts. The reason our timeout is dumb is that we don't monitor
* the sequence (don't use an SnMonitorContext)
*/
#define STARTUP_TIMEOUT_LENGTH_SECONDS 30
#define STARTUP_TIMEOUT_LENGTH (STARTUP_TIMEOUT_LENGTH_SECONDS * 1000)
typedef struct
{
GdkDisplay *display;
char *startup_id;
GTimeVal time;
} StartupNotificationData;
static void
free_startup_notification_data (gpointer data)
{
StartupNotificationData *sn_data = data;
g_object_unref (sn_data->display);
g_free (sn_data->startup_id);
g_free (sn_data);
}
typedef struct
{
GSList *contexts;
guint timeout_id;
} StartupTimeoutData;
static void
free_startup_timeout (void *data)
{
StartupTimeoutData *std;
std = data;
g_slist_foreach (std->contexts, (GFunc) free_startup_notification_data, NULL);
g_slist_free (std->contexts);
if (std->timeout_id != 0)
{
g_source_remove (std->timeout_id);
std->timeout_id = 0;
}
g_free (std);
}
static gboolean
startup_timeout (void *data)
{
StartupTimeoutData *std;
GSList *tmp;
GTimeVal now;
int min_timeout;
std = data;
min_timeout = STARTUP_TIMEOUT_LENGTH;
g_get_current_time (&now);
tmp = std->contexts;
while (tmp != NULL)
{
StartupNotificationData *sn_data;
GSList *next;
double elapsed;
sn_data = tmp->data;
next = tmp->next;
elapsed =
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
if (elapsed >= STARTUP_TIMEOUT_LENGTH)
{
std->contexts = g_slist_remove (std->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
}
else
{
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
tmp = next;
}
if (std->contexts == NULL)
std->timeout_id = 0;
else
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
/* always remove this one, but we may have reinstalled another one. */
return FALSE;
}
static void
add_startup_timeout (GdkScreen *screen,
const char *startup_id)
{
StartupTimeoutData *data;
StartupNotificationData *sn_data;
data = g_object_get_data (G_OBJECT (screen), "appinfo-startup-data");
if (data == NULL)
{
data = g_new (StartupTimeoutData, 1);
data->contexts = NULL;
data->timeout_id = 0;
g_object_set_data_full (G_OBJECT (screen), "appinfo-startup-data",
data, free_startup_timeout);
}
sn_data = g_new (StartupNotificationData, 1);
sn_data->display = g_object_ref (gdk_screen_get_display (screen));
sn_data->startup_id = g_strdup (startup_id);
g_get_current_time (&sn_data->time);
data->contexts = g_slist_prepend (data->contexts, sn_data);
if (data->timeout_id == 0)
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
}
char *
_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GAppInfo *info,
GList *files)
{
static int sequence = 0;
GdkAppLaunchContextPrivate *priv;
GdkDisplay *display;
GdkScreen *screen;
int files_count;
char *description;
char *icon_name;
const char *binary_name;
const char *application_id;
char *screen_str;
char *workspace_str;
GIcon *icon;
guint32 timestamp;
char *startup_id;
priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
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);
}
else
{
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
}
files_count = g_list_length (files);
if (files_count == 0)
description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info));
else if (files_count == 1)
{
gchar *display_name = get_display_name (files->data);
description = g_strdup_printf (_("Opening %s"), display_name);
g_free (display_name);
}
else
description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
"Opening %d Item",
"Opening %d Items",
files_count), files_count);
icon_name = NULL;
if (priv->icon_name)
icon_name = g_strdup (priv->icon_name);
else
{
icon = NULL;
if (priv->icon != NULL)
icon = g_object_ref (priv->icon);
else if (files_count == 1)
icon = get_icon (files->data);
if (icon == NULL)
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);