drop support for win32/osx

master-1.22
monsta 2015-08-25 16:00:41 +03:00 committed by infirit
parent 589ab9b7ce
commit 80c5e88588
11 changed files with 55 additions and 805 deletions

View File

@ -60,23 +60,12 @@ case "$with_gtk" in
VTE_PC_VERSION=
;;
3.0) GTK_API_VERSION=3.0
GTK_REQUIRED=2.91.1
GTK_REQUIRED=3.0.0
GDK_TARGETS="$($PKG_CONFIG --variable targets gdk-$GTK_API_VERSION)"
VTE_PC_VERSION=-2.90
;;
esac
PLATFORM_DEPS=
for target in $GDK_TARGETS; do
case "$target" in
x11) PLATFORM_DEPS="x11" ;;
broadway) ;;
wayland) ;;
win32|quartz) AC_MSG_WARN([unsupported GDK backend $target]) ;;
*) AC_MSG_WARN([unknown GDK backend $target]) ;;
esac
done
PKG_CHECK_MODULES([TERM],
[vte$VTE_PC_VERSION >= $VTE_REQUIRED
glib-2.0 >= $GLIB_REQUIRED
@ -84,38 +73,15 @@ PKG_CHECK_MODULES([TERM],
gio-2.0 >= $GIO_REQUIRED
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED
$PLATFORM_DEPS])
x11])
# ********
# smclient
# ********
SMCLIENT_PKGS=
AC_MSG_CHECKING([which smclient backend to use])
AC_ARG_WITH([smclient],
[AS_HELP_STRING([--with-smclient-backend],[which smclient backend to use (xsmp/win32/quartz)])],
[],
[case "$PLATFORM_DEPS" in
x11) with_smclient=xsmp SMCLIENT_PKGS="sm" ;;
win32|quartz) with_smclient=$PLATFORM_DEPS ;;
*) with_smclient=no ;;
esac])
AC_MSG_RESULT([$with_smclient])
if test "$with_smclient" != "no"; then
AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled])
fi
if test -n "$SMCLIENT_PKGS"; then
PKG_CHECK_MODULES([SMCLIENT],[$SMCLIENT_PKGS])
PKG_CHECK_MODULES(SMCLIENT, sm >= 1.0.0)
AC_SUBST([SMCLIENT_CFLAGS])
AC_SUBST([SMCLIENT_LIBS])
fi
AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"])
AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"])
# *****
# GSettings
@ -179,6 +145,5 @@ echo "
source code location: ${srcdir}
compiler: ${CC}
using smclient: ${with_smclient}
s/key support: ${enable_skey}
"

View File

@ -89,30 +89,18 @@ mate_terminal_LDADD = \
skey/libskey.la \
$(TERM_LIBS)
if WITH_SMCLIENT
mate_terminal_SOURCES += \
eggsmclient.c \
eggsmclient.h \
eggsmclient-private.h \
$(NULL)
mate_terminal_CFLAGS += $(SMCLIENT_CFLAGS)
mate_terminal_LDADD += $(SMCLIENT_LIBS)
if WITH_SMCLIENT_XSMP
mate_terminal_SOURCES += \
eggdesktopfile.c \
eggdesktopfile.h \
eggsmclient.c \
eggsmclient.h \
eggsmclient-private.h \
eggsmclient-xsmp.c \
$(NULL)
mate_terminal_CFLAGS += $(SMCLIENT_CFLAGS)
mate_terminal_CPPFLAGS += -DEGG_SM_CLIENT_BACKEND_XSMP
endif
if WITH_SMCLIENT_WIN32
mate_terminal_SOURCES += eggsmclient-win32.c
endif
if WITH_SMCLIENT_QUARTZ
mate_terminal_SOURCES += eggsmclient-osx.c
endif
endif
mate_terminal_LDADD += $(SMCLIENT_LIBS)
TYPES_H_FILES = \
terminal-profile.h \

View File

@ -40,9 +40,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifndef G_OS_WIN32
#include <pwd.h>
#endif
#include <glib.h>
@ -57,7 +55,6 @@
char *
egg_shell (const char *shell)
{
#ifndef G_OS_WIN32
struct passwd *pw;
int i;
static const char shells [][14] =
@ -105,18 +102,4 @@ egg_shell (const char *shell)
/* Placate compiler. */
return NULL;
#else
/* g_find_program_in_path() always looks also in the Windows
* and System32 directories, so it should always find either cmd.exe
* or command.com.
*/
char *retval = g_find_program_in_path ("cmd.exe");
if (retval == NULL)
retval = g_find_program_in_path ("command.com");
g_assert (retval != NULL);
return retval;
#endif
}

View File

@ -1,236 +0,0 @@
/*
* Copyright (C) 2007 Novell, Inc.
* Copyright (C) 2008 Red Hat, Inc.
*
* 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 3 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/* EggSMClientOSX
*
* For details on the OS X logout process, see:
* http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/BootProcess.html#//apple_ref/doc/uid/20002130-114618
*
* EggSMClientOSX registers for the kAEQuitApplication AppleEvent; the
* handler we register (quit_requested()) will be invoked from inside
* the quartz event-handling code (specifically, from inside
* [NSApplication nextEventMatchingMask]) when an AppleEvent arrives.
* We use AESuspendTheCurrentEvent() and AEResumeTheCurrentEvent() to
* allow asynchronous / non-main-loop-reentering processing of the
* quit request. (These are part of the Carbon framework; it doesn't
* seem to be possible to handle AppleEvents asynchronously from
* Cocoa.)
*/
#include "config.h"
#include "eggsmclient-private.h"
#include <gdk/gdkquartz.h>
#include <Carbon/Carbon.h>
#include <CoreServices/CoreServices.h>
#define EGG_TYPE_SM_CLIENT_OSX (egg_sm_client_osx_get_type ())
#define EGG_SM_CLIENT_OSX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_OSX, EggSMClientOSX))
#define EGG_SM_CLIENT_OSX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_OSX, EggSMClientOSXClass))
#define EGG_IS_SM_CLIENT_OSX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_OSX))
#define EGG_IS_SM_CLIENT_OSX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_OSX))
#define EGG_SM_CLIENT_OSX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_OSX, EggSMClientOSXClass))
typedef struct _EggSMClientOSX EggSMClientOSX;
typedef struct _EggSMClientOSXClass EggSMClientOSXClass;
struct _EggSMClientOSX
{
EggSMClient parent;
AppleEvent quit_event, quit_reply;
gboolean quit_requested, quitting;
};
struct _EggSMClientOSXClass
{
EggSMClientClass parent_class;
};
static void sm_client_osx_startup (EggSMClient *client,
const char *client_id);
static void sm_client_osx_will_quit (EggSMClient *client,
gboolean will_quit);
static gboolean sm_client_osx_end_session (EggSMClient *client,
EggSMClientEndStyle style,
gboolean request_confirmation);
static pascal OSErr quit_requested (const AppleEvent *, AppleEvent *, long);
G_DEFINE_TYPE (EggSMClientOSX, egg_sm_client_osx, EGG_TYPE_SM_CLIENT)
static void
egg_sm_client_osx_init (EggSMClientOSX *osx)
{
;
}
static void
egg_sm_client_osx_class_init (EggSMClientOSXClass *klass)
{
EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
sm_client_class->startup = sm_client_osx_startup;
sm_client_class->will_quit = sm_client_osx_will_quit;
sm_client_class->end_session = sm_client_osx_end_session;
}
EggSMClient *
egg_sm_client_osx_new (void)
{
return g_object_new (EGG_TYPE_SM_CLIENT_OSX, NULL);
}
static void
sm_client_osx_startup (EggSMClient *client,
const char *client_id)
{
AEInstallEventHandler (kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerUPP (quit_requested),
(long)GPOINTER_TO_SIZE (client), false);
}
static gboolean
idle_quit_requested (gpointer client)
{
egg_sm_client_quit_requested (client);
return FALSE;
}
static pascal OSErr
quit_requested (const AppleEvent *aevt, AppleEvent *reply, long refcon)
{
EggSMClient *client = GSIZE_TO_POINTER ((gsize)refcon);
EggSMClientOSX *osx = GSIZE_TO_POINTER ((gsize)refcon);
g_return_val_if_fail (!osx->quit_requested, userCanceledErr);
/* FIXME AEInteractWithUser? */
osx->quit_requested = TRUE;
AEDuplicateDesc (aevt, &osx->quit_event);
AEDuplicateDesc (reply, &osx->quit_reply);
AESuspendTheCurrentEvent (aevt);
/* Don't emit the "quit_requested" signal immediately, since we're
* called from a weird point in the guts of gdkeventloop-quartz.c
*/
g_idle_add (idle_quit_requested, client);
return noErr;
}
static pascal OSErr
quit_requested_resumed (const AppleEvent *aevt, AppleEvent *reply, long refcon)
{
EggSMClientOSX *osx = GSIZE_TO_POINTER ((gsize)refcon);
osx->quit_requested = FALSE;
return osx->quitting ? noErr : userCanceledErr;
}
static gboolean
idle_will_quit (gpointer client)
{
EggSMClientOSX *osx = (EggSMClientOSX *)client;
/* Resume the event with a new handler that will return a value to
* the system.
*/
AEResumeTheCurrentEvent (&osx->quit_event, &osx->quit_reply,
NewAEEventHandlerUPP (quit_requested_resumed),
(long)GPOINTER_TO_SIZE (client));
AEDisposeDesc (&osx->quit_event);
AEDisposeDesc (&osx->quit_reply);
if (osx->quitting)
egg_sm_client_quit (client);
return FALSE;
}
static void
sm_client_osx_will_quit (EggSMClient *client,
gboolean will_quit)
{
EggSMClientOSX *osx = (EggSMClientOSX *)client;
g_return_if_fail (osx->quit_requested);
osx->quitting = will_quit;
/* Finish in an idle handler since the caller might have called
* egg_sm_client_will_quit() from inside the "quit_requested" signal
* handler, but may not expect the "quit" signal to arrive during
* the _will_quit() call.
*/
g_idle_add (idle_will_quit, client);
}
static gboolean
sm_client_osx_end_session (EggSMClient *client,
EggSMClientEndStyle style,
gboolean request_confirmation)
{
static const ProcessSerialNumber loginwindow_psn = { 0, kSystemProcess };
AppleEvent event = { typeNull, NULL }, reply = { typeNull, NULL };
AEAddressDesc target;
AEEventID id;
OSErr err;
switch (style)
{
case EGG_SM_CLIENT_END_SESSION_DEFAULT:
case EGG_SM_CLIENT_LOGOUT:
id = request_confirmation ? kAELogOut : kAEReallyLogOut;
break;
case EGG_SM_CLIENT_REBOOT:
id = request_confirmation ? kAEShowRestartDialog : kAERestart;
break;
case EGG_SM_CLIENT_SHUTDOWN:
id = request_confirmation ? kAEShowShutdownDialog : kAEShutDown;
break;
}
err = AECreateDesc (typeProcessSerialNumber, &loginwindow_psn,
sizeof (loginwindow_psn), &target);
if (err != noErr)
{
g_warning ("Could not create descriptor for loginwindow: %d", err);
return FALSE;
}
err = AECreateAppleEvent (kCoreEventClass, id, &target,
kAutoGenerateReturnID, kAnyTransactionID,
&event);
AEDisposeDesc (&target);
if (err != noErr)
{
g_warning ("Could not create logout AppleEvent: %d", err);
return FALSE;
}
err = AESend (&event, &reply, kAENoReply, kAENormalPriority,
kAEDefaultTimeout, NULL, NULL);
AEDisposeDesc (&event);
if (err == noErr)
AEDisposeDesc (&reply);
return err == noErr;
}

View File

@ -33,22 +33,8 @@ void egg_sm_client_quit_requested (EggSMClient *client);
void egg_sm_client_quit_cancelled (EggSMClient *client);
void egg_sm_client_quit (EggSMClient *client);
#if defined (GDK_WINDOWING_X11)
# ifdef EGG_SM_CLIENT_BACKEND_XSMP
GType egg_sm_client_xsmp_get_type (void);
EggSMClient *egg_sm_client_xsmp_new (void);
# endif
# ifdef EGG_SM_CLIENT_BACKEND_DBUS
GType egg_sm_client_dbus_get_type (void);
EggSMClient *egg_sm_client_dbus_new (void);
# endif
#elif defined (GDK_WINDOWING_WIN32)
GType egg_sm_client_win32_get_type (void);
EggSMClient *egg_sm_client_win32_new (void);
#elif defined (GDK_WINDOWING_QUARTZ)
GType egg_sm_client_osx_get_type (void);
EggSMClient *egg_sm_client_osx_new (void);
#endif
G_END_DECLS

View File

@ -1,356 +0,0 @@
/*
* Copyright (C) 2007 Novell, Inc.
*
* 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 3 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/* EggSMClientWin32
*
* For details on the Windows XP logout process, see:
* http://msdn.microsoft.com/en-us/library/aa376876.aspx.
*
* Vista adds some new APIs which EggSMClient does not make use of; see
* http://msdn.microsoft.com/en-us/library/ms700677(VS.85).aspx
*
* When shutting down, Windows sends every top-level window a
* WM_QUERYENDSESSION event, which the application must respond to
* synchronously, saying whether or not it will quit. To avoid main
* loop re-entrancy problems (and to avoid having to muck about too
* much with the guts of the gdk-win32 main loop), we watch for this
* event in a separate thread, which then signals the main thread and
* waits for the main thread to handle the event. Since we don't want
* to require g_thread_init() to be called, we do this all using
* Windows-specific thread methods.
*
* After the application handles the WM_QUERYENDSESSION event,
* Windows then sends it a WM_ENDSESSION event with a TRUE or FALSE
* parameter indicating whether the session is or is not actually
* going to end now. We handle this from the other thread as well.
*
* As mentioned above, Vista introduces several additional new APIs
* that don't fit into the (current) EggSMClient API. Windows also has
* an entirely separate shutdown-notification scheme for non-GUI apps,
* which we also don't handle here.
*/
#include "config.h"
#include "eggsmclient-private.h"
#include <gdk/gdk.h>
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#include <windows.h>
#include <process.h>
#define EGG_TYPE_SM_CLIENT_WIN32 (egg_sm_client_win32_get_type ())
#define EGG_SM_CLIENT_WIN32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_WIN32, EggSMClientWin32))
#define EGG_SM_CLIENT_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_WIN32, EggSMClientWin32Class))
#define EGG_IS_SM_CLIENT_WIN32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_WIN32))
#define EGG_IS_SM_CLIENT_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_WIN32))
#define EGG_SM_CLIENT_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_WIN32, EggSMClientWin32Class))
typedef struct _EggSMClientWin32 EggSMClientWin32;
typedef struct _EggSMClientWin32Class EggSMClientWin32Class;
struct _EggSMClientWin32
{
EggSMClient parent;
HANDLE message_event, response_event;
volatile GSourceFunc event;
volatile gboolean will_quit;
};
struct _EggSMClientWin32Class
{
EggSMClientClass parent_class;
};
static void sm_client_win32_startup (EggSMClient *client,
const char *client_id);
static void sm_client_win32_will_quit (EggSMClient *client,
gboolean will_quit);
static gboolean sm_client_win32_end_session (EggSMClient *client,
EggSMClientEndStyle style,
gboolean request_confirmation);
static GSource *g_win32_handle_source_add (HANDLE handle, GSourceFunc callback,
gpointer user_data);
static gboolean got_message (gpointer user_data);
static void sm_client_thread (gpointer data);
G_DEFINE_TYPE (EggSMClientWin32, egg_sm_client_win32, EGG_TYPE_SM_CLIENT)
static void
egg_sm_client_win32_init (EggSMClientWin32 *win32)
{
;
}
static void
egg_sm_client_win32_class_init (EggSMClientWin32Class *klass)
{
EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
sm_client_class->startup = sm_client_win32_startup;
sm_client_class->will_quit = sm_client_win32_will_quit;
sm_client_class->end_session = sm_client_win32_end_session;
}
EggSMClient *
egg_sm_client_win32_new (void)
{
return g_object_new (EGG_TYPE_SM_CLIENT_WIN32, NULL);
}
static void
sm_client_win32_startup (EggSMClient *client,
const char *client_id)
{
EggSMClientWin32 *win32 = (EggSMClientWin32 *)client;
win32->message_event = CreateEvent (NULL, FALSE, FALSE, NULL);
win32->response_event = CreateEvent (NULL, FALSE, FALSE, NULL);
g_win32_handle_source_add (win32->message_event, got_message, win32);
_beginthread (sm_client_thread, 0, client);
}
static void
sm_client_win32_will_quit (EggSMClient *client,
gboolean will_quit)
{
EggSMClientWin32 *win32 = (EggSMClientWin32 *)client;
win32->will_quit = will_quit;
SetEvent (win32->response_event);
}
static gboolean
sm_client_win32_end_session (EggSMClient *client,
EggSMClientEndStyle style,
gboolean request_confirmation)
{
UINT uFlags = EWX_LOGOFF;
switch (style)
{
case EGG_SM_CLIENT_END_SESSION_DEFAULT:
case EGG_SM_CLIENT_LOGOUT:
uFlags = EWX_LOGOFF;
break;
case EGG_SM_CLIENT_REBOOT:
uFlags = EWX_REBOOT;
break;
case EGG_SM_CLIENT_SHUTDOWN:
uFlags = EWX_POWEROFF;
break;
}
/* There's no way to make ExitWindowsEx() show a logout dialog, so
* we ignore @request_confirmation.
*/
#ifdef SHTDN_REASON_FLAG_PLANNED
ExitWindowsEx (uFlags, SHTDN_REASON_FLAG_PLANNED);
#else
ExitWindowsEx (uFlags, 0);
#endif
return TRUE;
}
/* callbacks from logout-listener thread */
static gboolean
emit_quit_requested (gpointer smclient)
{
gdk_threads_enter ();
egg_sm_client_quit_requested (smclient);
gdk_threads_leave ();
return FALSE;
}
static gboolean
emit_quit (gpointer smclient)
{
EggSMClientWin32 *win32 = smclient;
gdk_threads_enter ();
egg_sm_client_quit (smclient);
gdk_threads_leave ();
SetEvent (win32->response_event);
return FALSE;
}
static gboolean
emit_quit_cancelled (gpointer smclient)
{
EggSMClientWin32 *win32 = smclient;
gdk_threads_enter ();
egg_sm_client_quit_cancelled (smclient);
gdk_threads_leave ();
SetEvent (win32->response_event);
return FALSE;
}
static gboolean
got_message (gpointer smclient)
{
EggSMClientWin32 *win32 = smclient;
win32->event (win32);
return TRUE;
}
/* Windows HANDLE GSource */
typedef struct
{
GSource source;
GPollFD pollfd;
} GWin32HandleSource;
static gboolean
g_win32_handle_source_prepare (GSource *source, gint *timeout)
{
*timeout = -1;
return FALSE;
}
static gboolean
g_win32_handle_source_check (GSource *source)
{
GWin32HandleSource *hsource = (GWin32HandleSource *)source;
return hsource->pollfd.revents;
}
static gboolean
g_win32_handle_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
{
return (*callback) (user_data);
}
static void
g_win32_handle_source_finalize (GSource *source)
{
;
}
GSourceFuncs g_win32_handle_source_funcs =
{
g_win32_handle_source_prepare,
g_win32_handle_source_check,
g_win32_handle_source_dispatch,
g_win32_handle_source_finalize
};
static GSource *
g_win32_handle_source_add (HANDLE handle, GSourceFunc callback, gpointer user_data)
{
GWin32HandleSource *hsource;
GSource *source;
source = g_source_new (&g_win32_handle_source_funcs, sizeof (GWin32HandleSource));
hsource = (GWin32HandleSource *)source;
hsource->pollfd.fd = (int)handle;
hsource->pollfd.events = G_IO_IN;
hsource->pollfd.revents = 0;
g_source_add_poll (source, &hsource->pollfd);
g_source_set_callback (source, callback, user_data, NULL);
g_source_attach (source, NULL);
return source;
}
/* logout-listener thread */
LRESULT CALLBACK
sm_client_win32_window_procedure (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
EggSMClientWin32 *win32 =
(EggSMClientWin32 *)GetWindowLongPtr (hwnd, GWLP_USERDATA);
switch (message)
{
case WM_QUERYENDSESSION:
win32->event = emit_quit_requested;
SetEvent (win32->message_event);
WaitForSingleObject (win32->response_event, INFINITE);
return win32->will_quit;
case WM_ENDSESSION:
if (wParam)
{
/* The session is ending */
win32->event = emit_quit;
}
else
{
/* Nope, the session *isn't* ending */
win32->event = emit_quit_cancelled;
}
SetEvent (win32->message_event);
WaitForSingleObject (win32->response_event, INFINITE);
return 0;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
}
static void
sm_client_thread (gpointer smclient)
{
HINSTANCE instance;
WNDCLASSEXW wcl;
ATOM klass;
HWND window;
MSG msg;
instance = GetModuleHandle (NULL);
memset (&wcl, 0, sizeof (WNDCLASSEX));
wcl.cbSize = sizeof (WNDCLASSEX);
wcl.lpfnWndProc = sm_client_win32_window_procedure;
wcl.hInstance = instance;
wcl.lpszClassName = L"EggSmClientWindow";
klass = RegisterClassEx (&wcl);
window = CreateWindowEx (0, MAKEINTRESOURCE (klass),
L"EggSmClientWindow", 0,
10, 10, 50, 50, GetDesktopWindow (),
NULL, instance, NULL);
SetWindowLongPtr (window, GWLP_USERDATA, (LONG_PTR)smclient);
/* main loop */
while (GetMessage (&msg, NULL, 0, 0))
DispatchMessage (&msg);
}

View File

@ -333,23 +333,7 @@ egg_sm_client_get (void)
if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
!sm_client_disable)
{
#if defined (GDK_WINDOWING_WIN32)
global_client = egg_sm_client_win32_new ();
#elif defined (GDK_WINDOWING_QUARTZ)
global_client = egg_sm_client_osx_new ();
#else
/* If both D-Bus and XSMP are compiled in, try XSMP first
* (since it supports state saving) and fall back to D-Bus
* if XSMP isn't available.
*/
# ifdef EGG_SM_CLIENT_BACKEND_XSMP
global_client = egg_sm_client_xsmp_new ();
# endif
# ifdef EGG_SM_CLIENT_BACKEND_DBUS
if (!global_client)
global_client = egg_sm_client_dbus_new ();
# endif
#endif
}
/* Fallback: create a dummy client, so that callers don't have

View File

@ -42,12 +42,8 @@
#include <stdlib.h>
#include <time.h>
#ifdef WITH_SMCLIENT
#include "eggsmclient.h"
#ifdef GDK_WINDOWING_X11
#include "eggdesktopfile.h"
#endif
#endif
#define FALLBACK_PROFILE_ID "default"
@ -1305,8 +1301,6 @@ terminal_app_manage_profiles (TerminalApp *app,
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
}
#ifdef WITH_SMCLIENT
static void
terminal_app_save_state_cb (EggSMClient *client,
GKeyFile *key_file,
@ -1322,8 +1316,6 @@ terminal_app_client_quit_cb (EggSMClient *client,
g_signal_emit (app, signals[QUIT], 0);
}
#endif /* WITH_SMCLIENT */
/* Class implementation */
G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
@ -1403,10 +1395,7 @@ terminal_app_init (TerminalApp *app)
terminal_accels_init ();
#ifdef WITH_SMCLIENT
{
EggSMClient *sm_client;
#ifdef GDK_WINDOWING_X11
char *desktop_file;
desktop_file = g_build_filename (TERM_DATADIR,
@ -1415,7 +1404,6 @@ terminal_app_init (TerminalApp *app)
NULL);
egg_set_desktop_file_without_defaults (desktop_file);
g_free (desktop_file);
#endif /* GDK_WINDOWING_X11 */
sm_client = egg_sm_client_get ();
g_signal_connect (sm_client, "save-state",
@ -1423,21 +1411,18 @@ terminal_app_init (TerminalApp *app)
g_signal_connect (sm_client, "quit",
G_CALLBACK (terminal_app_client_quit_cb), app);
}
#endif
}
static void
terminal_app_finalize (GObject *object)
{
TerminalApp *app = TERMINAL_APP (object);
#ifdef WITH_SMCLIENT
EggSMClient *sm_client;
sm_client = egg_sm_client_get ();
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, app);
#endif
g_signal_handlers_disconnect_by_func (app->settings_global,
G_CALLBACK(terminal_app_profile_list_notify_cb),
app);
@ -1682,8 +1667,6 @@ terminal_app_handle_options (TerminalApp *app,
/* fall-through on success */
}
#ifdef WITH_SMCLIENT
{
EggSMClient *sm_client;
sm_client = egg_sm_client_get ();
@ -1697,8 +1680,6 @@ terminal_app_handle_options (TerminalApp *app,
!terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
return FALSE;
}
}
#endif
/* Make sure we open at least one window */
terminal_options_ensure_window (options);

View File

@ -28,13 +28,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#ifndef GDK_IS_X11_DISPLAY
#define GDK_IS_X11_DISPLAY(display) 1
#endif
#endif
#include "terminal-accels.h"
#include "terminal-app.h"
@ -1409,14 +1403,9 @@ get_child_environment (TerminalScreen *screen,
g_hash_table_replace (env_table, g_strdup ("COLORTERM"), g_strdup (EXECUTABLE_NAME));
g_hash_table_replace (env_table, g_strdup ("TERM"), g_strdup ("xterm")); /* FIXME configurable later? */
#ifdef GDK_WINDOWING_X11
/* FIXME: moving the tab between windows, or the window between displays will make the next two invalid... */
if (GDK_IS_X11_DISPLAY(display))
{
g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XID (gtk_widget_get_window (window))));
g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (display)));
}
#endif
list_schemas = g_settings_list_schemas();
schema_exists = FALSE;

View File

@ -22,12 +22,7 @@
#include <string.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#ifndef GDK_IS_X11_DISPLAY
#define GDK_IS_X11_DISPLAY(display) 1
#endif
#endif
#include <gdk/gdkkeysyms.h>
#include <libmate-desktop/mate-aboutdialog.h>
@ -1748,16 +1743,11 @@ terminal_window_screen_update (TerminalWindow *window,
{
TerminalApp *app;
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
{
terminal_window_window_manager_changed_cb (screen, window);
g_signal_connect (screen, "window-manager-changed",
G_CALLBACK (terminal_window_window_manager_changed_cb), window);
g_signal_connect (screen, "composited-changed",
G_CALLBACK (terminal_window_composited_changed_cb), window);
}
#endif
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
return;
@ -1791,9 +1781,6 @@ terminal_window_screen_changed (GtkWidget *widget,
return;
if (previous_screen)
{
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (previous_screen)))
{
g_signal_handlers_disconnect_by_func (previous_screen,
G_CALLBACK (terminal_window_window_manager_changed_cb),
@ -1802,8 +1789,6 @@ terminal_window_screen_changed (GtkWidget *widget,
G_CALLBACK (terminal_window_composited_changed_cb),
window);
}
#endif
}
if (!screen)
return;
@ -2344,9 +2329,6 @@ terminal_window_dispose (GObject *object)
screen = gtk_widget_get_screen (GTK_WIDGET (object));
if (screen)
{
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
{
g_signal_handlers_disconnect_by_func (screen,
G_CALLBACK (terminal_window_window_manager_changed_cb),
@ -2355,8 +2337,6 @@ terminal_window_dispose (GObject *object)
G_CALLBACK (terminal_window_composited_changed_cb),
window);
}
#endif
}
G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object);
}

View File

@ -32,17 +32,9 @@
#include <gio/gio.h>
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#ifndef GDK_IS_X11_DISPLAY
#define GDK_IS_X11_DISPLAY(display) 1
#endif
#endif
#ifdef WITH_SMCLIENT
#include "eggsmclient.h"
#endif
#include "terminal-accels.h"
#include "terminal-app.h"
@ -442,7 +434,6 @@ name_lost_cb (GDBusConnection *connection,
*
*/
#ifdef GDK_WINDOWING_X11
/* Copied from libcaja/caja-program-choosing.c; Needed in case
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
*/
@ -493,7 +484,6 @@ slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
return event.xproperty.time;
}
#endif
static char *
get_factory_name_for_display (const char *display_name)
@ -588,9 +578,7 @@ main (int argc, char **argv)
&argc, &argv,
&error,
gtk_get_option_group (TRUE),
#ifdef WITH_SMCLIENT
egg_sm_client_get_option_group (),
#endif
NULL);
g_free (working_directory);
@ -615,8 +603,7 @@ main (int argc, char **argv)
display_name = gdk_display_get_name (display);
options->display_name = g_strdup (display_name);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY(display) && options->startup_id == NULL)
if (options->startup_id == NULL)
{
/* Create a fake one containing a timestamp that we can use */
Time timestamp;
@ -625,7 +612,6 @@ main (int argc, char **argv)
options->startup_id = g_strdup_printf ("_TIME%lu", timestamp);
}
#endif
if (options->use_factory)
{