summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-10-20 17:55:08 +0000
committerHavoc Pennington <hp@redhat.com>2002-10-20 17:55:08 +0000
commitee9a28bcc3aaba3496e08ac2dd9147102ea54e7b (patch)
tree2bc6df55ba7509d8b46c40ae1c12edbd7fc13b3f
parent58144125e0fe2b43bcb6aad75f258c8042b70feb (diff)
Massively rename everything from liblf to libsn, and reimport to CVS.
-rw-r--r--ChangeLog5
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.in10
-rw-r--r--libsn-1.0.pc.in6
-rw-r--r--libsn/Makefile.am48
-rw-r--r--libsn/sn-common.c94
-rw-r--r--libsn/sn-common.h50
-rw-r--r--libsn/sn-internals.h40
-rw-r--r--libsn/sn-launchee.c94
-rw-r--r--libsn/sn-launchee.h34
-rw-r--r--libsn/sn-launcher.c440
-rw-r--r--libsn/sn-launcher.h94
-rw-r--r--libsn/sn-list.c74
-rw-r--r--libsn/sn-list.h34
-rw-r--r--libsn/sn-monitor.c516
-rw-r--r--libsn/sn-monitor.h100
-rw-r--r--libsn/sn-util.c110
-rw-r--r--libsn/sn-util.h84
-rw-r--r--libsn/sn-xmessages.c182
-rw-r--r--libsn/sn-xmessages.h30
-rw-r--r--libsn/sn-xutils.c158
-rw-r--r--libsn/sn-xutils.h40
-rw-r--r--test/Makefile.am12
-rw-r--r--test/test-boilerplate.h4
-rw-r--r--test/test-launchee.c22
-rw-r--r--test/test-launcher.c46
-rw-r--r--test/test-monitor.c92
-rw-r--r--test/test-send-xmessage.c12
-rw-r--r--test/test-watch-xmessages.c24
30 files changed, 1232 insertions, 1227 deletions
diff --git a/ChangeLog b/ChangeLog
index f257a05..31037b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-20 Havoc Pennington <hp@pobox.com>
+
+ * Massively rename everything from liblf to libsn, and reimport
+ to CVS.
+
2002-09-20 Havoc Pennington <hp@pobox.com>
* liblf/lf-monitor.c: implement support for xmessage-based
diff --git a/Makefile.am b/Makefile.am
index b831b63..99ace4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS=liblf test
+SUBDIRS=libsn test
diff --git a/autogen.sh b/autogen.sh
index 6fdf952..6a98e9b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,7 +9,7 @@ cd $srcdir
PROJECT=launchfeedback
TEST_TYPE=-f
-FILE=liblf-1.0.pc.in
+FILE=libsn-1.0.pc.in
DIE=0
diff --git a/configure.in b/configure.in
index 3ad8285..92f0f18 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-AC_INIT(liblf/lf-launchee.c)
+AC_INIT(libsn/sn-launchee.c)
AM_CONFIG_HEADER(config.h)
@@ -34,11 +34,11 @@ fi
dnl (check from glib)
dnl ok, here we try to check whether the systems prototypes for
dnl malloc and friends actually match the prototypes provided
-dnl by lf-common.h (keep in sync). i currently only know how to check
+dnl by sn-common.h (keep in sync). i currently only know how to check
dnl this reliably with gcc (-Werror), improvements for other
dnl compilers are appreciated.
SANE_MALLOC_PROTOS=no
-AC_MSG_CHECKING([if malloc() and friends prototypes are lf-util.h compatible])
+AC_MSG_CHECKING([if malloc() and friends prototypes are sn-util.h compatible])
lf_save_CFLAGS=$CFLAGS
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Werror"
@@ -83,7 +83,7 @@ AC_SUBST(LIBLF_LIBS)
AC_OUTPUT([
Makefile
-liblf/Makefile
+libsn/Makefile
test/Makefile
-liblf-1.0.pc
+libsn-1.0.pc
])
diff --git a/libsn-1.0.pc.in b/libsn-1.0.pc.in
index d980bab..91021dc 100644
--- a/libsn-1.0.pc.in
+++ b/libsn-1.0.pc.in
@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: liblf
+Name: libsn
Description: Launch feedback library
Version: @VERSION@
-Libs: -L${libdir} -llf-1
-Cflags: -I${includedir}/liblf-1.0
+Libs: -L${libdir} -lsn-1
+Cflags: -I${includedir}/libsn-1.0
diff --git a/libsn/Makefile.am b/libsn/Makefile.am
index bfe4e45..eff10a1 100644
--- a/libsn/Makefile.am
+++ b/libsn/Makefile.am
@@ -1,31 +1,31 @@
-INCLUDES=-I$(top_srcdir) $(LIBLF_CFLAGS)
+INCLUDES=-I$(top_srcdir) $(LIBSN_CFLAGS)
-liblfincludedir=$(includedir)/liblf-1.0/liblf
+libsnincludedir=$(includedir)/libsn-1.0/libsn
-lib_LTLIBRARIES=liblf-1.la
+lib_LTLIBRARIES=libsn-1.la
-liblfinclude_HEADERS= \
+libsninclude_HEADERS= \
lf.h \
- lf-common.h \
- lf-launchee.h \
- lf-launcher.h \
- lf-monitor.h \
- lf-util.h
+ sn-common.h \
+ sn-launchee.h \
+ sn-launcher.h \
+ sn-monitor.h \
+ sn-util.h
-liblf_1_la_SOURCES= \
- lf-common.c \
- lf-internals.c \
- lf-internals.h \
- lf-launchee.c \
- lf-launcher.c \
- lf-list.c \
- lf-list.h \
- lf-monitor.c \
- lf-util.c \
- lf-xmessages.c \
- lf-xmessages.h \
- lf-xutils.c \
- lf-xutils.h
+libsn_1_la_SOURCES= \
+ sn-common.c \
+ sn-internals.c \
+ sn-internals.h \
+ sn-launchee.c \
+ sn-launcher.c \
+ sn-list.c \
+ sn-list.h \
+ sn-monitor.c \
+ sn-util.c \
+ sn-xmessages.c \
+ sn-xmessages.h \
+ sn-xutils.c \
+ sn-xutils.h
-liblf_1_la_LIBADD= $(LIBLF_LIBS)
+libsn_1_la_LIBADD= $(LIBSN_LIBS)
diff --git a/libsn/sn-common.c b/libsn/sn-common.c
index f14141f..b6c449e 100644
--- a/libsn/sn-common.c
+++ b/libsn/sn-common.c
@@ -23,27 +23,27 @@
*/
#include <config.h>
-#include "lf-common.h"
-#include "lf-internals.h"
+#include "sn-common.h"
+#include "sn-internals.h"
-struct LfDisplay
+struct SnDisplay
{
int refcount;
Display *xdisplay;
int n_screens;
Screen **screens;
- LfDisplayErrorTrapPush push_trap_func;
- LfDisplayErrorTrapPop pop_trap_func;
+ SnDisplayErrorTrapPush push_trap_func;
+ SnDisplayErrorTrapPop pop_trap_func;
};
/**
- * lf_display_new:
+ * sn_display_new:
* @xdisplay: an X window system display
* @push_trap_func: function to push an X error trap
* @pop_trap_func: function to pop an X error trap
*
- * Creates a new #LfDisplay object, containing
- * data that liblf associates with an X display.
+ * Creates a new #SnDisplay object, containing
+ * data that libsn associates with an X display.
*
* @push_trap_func should be a function that causes X errors to be
* ignored until @pop_trap_func is called as many times as
@@ -53,21 +53,21 @@ struct LfDisplay
* fact occurred. These functions are used to avoid X errors due to
* BadWindow and such.
*
- * Return value: the new #LfDisplay
+ * Return value: the new #SnDisplay
**/
-LfDisplay*
-lf_display_new (Display *xdisplay,
- LfDisplayErrorTrapPush push_trap_func,
- LfDisplayErrorTrapPop pop_trap_func)
+SnDisplay*
+sn_display_new (Display *xdisplay,
+ SnDisplayErrorTrapPush push_trap_func,
+ SnDisplayErrorTrapPop pop_trap_func)
{
- LfDisplay *display;
+ SnDisplay *display;
int i;
- display = lf_new0 (LfDisplay, 1);
+ display = sn_new0 (SnDisplay, 1);
display->xdisplay = xdisplay;
display->n_screens = ScreenCount (xdisplay);
- display->screens = lf_new (Screen*, display->n_screens);
+ display->screens = sn_new (Screen*, display->n_screens);
display->refcount = 1;
display->push_trap_func = push_trap_func;
@@ -80,53 +80,53 @@ lf_display_new (Display *xdisplay,
}
/**
- * lf_display_ref:
- * @display: an #LfDisplay
+ * sn_display_ref:
+ * @display: an #SnDisplay
*
* Increment the reference count for @display
**/
void
-lf_display_ref (LfDisplay *display)
+sn_display_ref (SnDisplay *display)
{
display->refcount += 1;
}
/**
- * lf_display_unref:
- * @display: an #LfDisplay
+ * sn_display_unref:
+ * @display: an #SnDisplay
*
* Decrement the reference count for @display, freeing
* display if the reference count reaches zero.
**/
void
-lf_display_unref (LfDisplay *display)
+sn_display_unref (SnDisplay *display)
{
display->refcount -= 1;
if (display->refcount == 0)
{
- lf_free (display->screens);
- lf_free (display);
+ sn_free (display->screens);
+ sn_free (display);
}
}
/**
- * lf_display_get_x_display:
- * @display: an #LfDisplay
+ * sn_display_get_x_display:
+ * @display: an #SnDisplay
*
*
*
- * Return value: X display for this #LfDisplay
+ * Return value: X display for this #SnDisplay
**/
Display*
-lf_display_get_x_display (LfDisplay *display)
+sn_display_get_x_display (SnDisplay *display)
{
return display->xdisplay;
}
/**
- * lf_display_get_x_screen:
- * @display: an #LfDisplay
+ * sn_display_get_x_screen:
+ * @display: an #SnDisplay
* @number: screen number to get
*
* Gets a screen by number; if the screen number
@@ -135,7 +135,7 @@ lf_display_get_x_display (LfDisplay *display)
* Return value: X screen or %NULL
**/
Screen*
-lf_display_get_x_screen (LfDisplay *display,
+sn_display_get_x_screen (SnDisplay *display,
int number)
{
if (number < 0 || number >= display->n_screens)
@@ -145,62 +145,62 @@ lf_display_get_x_screen (LfDisplay *display,
}
/**
- * lf_display_process_event:
+ * sn_display_process_event:
* @display: a display
* @xevent: X event
*
- * liblf should be given a chance to see all X events by passing them
+ * libsn should be given a chance to see all X events by passing them
* to this function. If the event was a property notify or client
* message related to the launch feedback protocol, the
- * lf_display_process_event() returns true. Calling
- * lf_display_process_event() is not currently required for launchees,
+ * sn_display_process_event() returns true. Calling
+ * sn_display_process_event() is not currently required for launchees,
* only launchers and launch feedback displayers. The function returns
* false for mapping, unmapping, window destruction, and selection
* events even if they were involved in launch feedback.
*
* Return value: true if the event was a property notify or client message involved in launch feedback
**/
-lf_bool_t
-lf_display_process_event (LfDisplay *display,
+sn_bool_t
+sn_display_process_event (SnDisplay *display,
XEvent *xevent)
{
- lf_bool_t retval;
+ sn_bool_t retval;
retval = FALSE;
- if (lf_internal_launcher_process_event (display, xevent))
+ if (sn_internal_launcher_process_event (display, xevent))
retval = TRUE;
- if (lf_internal_monitor_process_event (display, xevent))
+ if (sn_internal_monitor_process_event (display, xevent))
retval = TRUE;
- if (lf_internal_xmessage_process_event (display, xevent))
+ if (sn_internal_xmessage_process_event (display, xevent))
retval = TRUE;
return retval;
}
/**
- * lf_display_error_trap_push:
+ * sn_display_error_trap_push:
* @display: a display
*
- * Calls the push_trap_func from lf_display_new() if non-NULL.
+ * Calls the push_trap_func from sn_display_new() if non-NULL.
**/
void
-lf_display_error_trap_push (LfDisplay *display)
+sn_display_error_trap_push (SnDisplay *display)
{
if (display->push_trap_func)
(* display->push_trap_func) (display, display->xdisplay);
}
/**
- * lf_display_error_trap_pop:
+ * sn_display_error_trap_pop:
* @display: a display
*
- * Calls the pop_trap_func from lf_display_new() if non-NULL.
+ * Calls the pop_trap_func from sn_display_new() if non-NULL.
**/
void
-lf_display_error_trap_pop (LfDisplay *display)
+sn_display_error_trap_pop (SnDisplay *display)
{
if (display->pop_trap_func)
(* display->pop_trap_func) (display, display->xdisplay);
diff --git a/libsn/sn-common.h b/libsn/sn-common.h
index 57a1ba8..a5ba057 100644
--- a/libsn/sn-common.h
+++ b/libsn/sn-common.h
@@ -23,46 +23,46 @@
*/
-#ifndef __LF_COMMON_H__
-#define __LF_COMMON_H__
+#ifndef __SN_COMMON_H__
+#define __SN_COMMON_H__
-#include <liblf/lf-util.h>
+#include <libsn/sn-util.h>
#include <X11/Xlib.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef struct LfDisplay LfDisplay;
+typedef struct SnDisplay SnDisplay;
typedef enum
{
- LF_LAUNCH_TYPE_OTHER,
- LF_LAUNCH_TYPE_DOCK_ICON,
- LF_LAUNCH_TYPE_DESKTOP_ICON,
- LF_LAUNCH_TYPE_MENU,
- LF_LAUNCH_TYPE_KEY_SHORTCUT
+ SN_LAUNCH_TYPE_OTHER,
+ SN_LAUNCH_TYPE_DOCK_ICON,
+ SN_LAUNCH_TYPE_DESKTOP_ICON,
+ SN_LAUNCH_TYPE_MENU,
+ SN_LAUNCH_TYPE_KEY_SHORTCUT
-} LfLaunchType;
+} SnLaunchType;
-typedef void (* LfDisplayErrorTrapPush) (LfDisplay *display,
+typedef void (* SnDisplayErrorTrapPush) (SnDisplay *display,
Display *xdisplay);
-typedef void (* LfDisplayErrorTrapPop) (LfDisplay *display,
+typedef void (* SnDisplayErrorTrapPop) (SnDisplay *display,
Display *xdisplay);
-LfDisplay* lf_display_new (Display *xdisplay,
- LfDisplayErrorTrapPush push_trap_func,
- LfDisplayErrorTrapPop pop_trap_func);
-void lf_display_ref (LfDisplay *display);
-void lf_display_unref (LfDisplay *display);
-Display* lf_display_get_x_display (LfDisplay *display);
-Screen* lf_display_get_x_screen (LfDisplay *display,
+SnDisplay* sn_display_new (Display *xdisplay,
+ SnDisplayErrorTrapPush push_trap_func,
+ SnDisplayErrorTrapPop pop_trap_func);
+void sn_display_ref (SnDisplay *display);
+void sn_display_unref (SnDisplay *display);
+Display* sn_display_get_x_display (SnDisplay *display);
+Screen* sn_display_get_x_screen (SnDisplay *display,
int number);
-lf_bool_t lf_display_process_event (LfDisplay *display,
+sn_bool_t sn_display_process_event (SnDisplay *display,
XEvent *xevent);
-void lf_display_error_trap_push (LfDisplay *display);
-void lf_display_error_trap_pop (LfDisplay *display);
+void sn_display_error_trap_push (SnDisplay *display);
+void sn_display_error_trap_pop (SnDisplay *display);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_COMMON_H__ */
+#endif /* __SN_COMMON_H__ */
diff --git a/libsn/sn-internals.h b/libsn/sn-internals.h
index 4500e19..d4e2953 100644
--- a/libsn/sn-internals.h
+++ b/libsn/sn-internals.h
@@ -23,19 +23,19 @@
*/
-#ifndef __LF_INTERNALS_H__
-#define __LF_INTERNALS_H__
+#ifndef __SN_INTERNALS_H__
+#define __SN_INTERNALS_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <liblf/lf-list.h>
-#include <liblf/lf-xutils.h>
+#include <libsn/sn-list.h>
+#include <libsn/sn-xutils.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
#ifndef TRUE
#define TRUE 1
@@ -49,28 +49,28 @@ LF_BEGIN_DECLS
#define NULL ((void*) 0)
#endif
-/* --- From lf-launcher.c --- */
-lf_bool_t lf_internal_launcher_process_event (LfDisplay *display,
+/* --- From sn-launcher.c --- */
+sn_bool_t sn_internal_launcher_process_event (SnDisplay *display,
XEvent *xevent);
-/* --- From lf-monitor.c --- */
-lf_bool_t lf_internal_monitor_process_event (LfDisplay *display,
+/* --- From sn-monitor.c --- */
+sn_bool_t sn_internal_monitor_process_event (SnDisplay *display,
XEvent *xevent);
-/* --- From lf-util.c --- */
-lf_bool_t lf_internal_utf8_validate (const char *str,
+/* --- From sn-util.c --- */
+sn_bool_t sn_internal_utf8_validate (const char *str,
int max_len);
-char* lf_internal_strdup (const char *str);
-char* lf_internal_strndup (const char *str,
+char* sn_internal_strdup (const char *str);
+char* sn_internal_strndup (const char *str,
int n);
-void lf_internal_strfreev (char **strings);
+void sn_internal_strfreev (char **strings);
-unsigned long lf_internal_string_to_ulong (const char* str);
+unsigned long sn_internal_string_to_ulong (const char* str);
-/* --- From lf-xmessages.c --- */
-lf_bool_t lf_internal_xmessage_process_event (LfDisplay *display,
+/* --- From sn-xmessages.c --- */
+sn_bool_t sn_internal_xmessage_process_event (SnDisplay *display,
XEvent *xevent);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_INTERNALS_H__ */
+#endif /* __SN_INTERNALS_H__ */
diff --git a/libsn/sn-launchee.c b/libsn/sn-launchee.c
index 85e5e43..bade52c 100644
--- a/libsn/sn-launchee.c
+++ b/libsn/sn-launchee.c
@@ -21,21 +21,21 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "lf-launchee.h"
-#include "lf-internals.h"
+#include "sn-launchee.h"
+#include "sn-internals.h"
#include <errno.h>
-struct LfLauncheeContext
+struct SnLauncheeContext
{
int refcount;
- LfDisplay *display;
+ SnDisplay *display;
char *launch_id;
Window launch_window;
};
/**
- * lf_launchee_context_new:
- * @display: an #LfDisplay
+ * sn_launchee_context_new:
+ * @display: an #SnDisplay
* @launch_id: launch ID as in DESKTOP_LAUNCH_ID
* @launch_window: launch window as in DESKTOP_LAUNCH_WINDOW
*
@@ -44,21 +44,21 @@ struct LfLauncheeContext
*
* Return value: a new launchee context
**/
-LfLauncheeContext*
-lf_launchee_context_new (LfDisplay *display,
+SnLauncheeContext*
+sn_launchee_context_new (SnDisplay *display,
const char *launch_id,
Window launch_window)
{
- LfLauncheeContext *context;
+ SnLauncheeContext *context;
- context = lf_new0 (LfLauncheeContext, 1);
+ context = sn_new0 (SnLauncheeContext, 1);
context->refcount = 1;
context->display = display;
- lf_display_ref (context->display);
+ sn_display_ref (context->display);
- context->launch_id = lf_malloc (strlen (launch_id) + 1);
+ context->launch_id = sn_malloc (strlen (launch_id) + 1);
strcpy (context->launch_id, launch_id);
context->launch_window = launch_window;
@@ -67,18 +67,18 @@ lf_launchee_context_new (LfDisplay *display,
}
/**
- * lf_launchee_context_new_from_environment:
- * @display: an #LfDisplay
+ * sn_launchee_context_new_from_environment:
+ * @display: an #SnDisplay
*
- * Tries to create an #LfLauncheeContext given information in
+ * Tries to create an #SnLauncheeContext given information in
* the program's environment (DESKTOP_LAUNCH_ID and DESKTOP_LAUNCH_WINDOW
* environment variables). Returns %NULL if the env variables are not
* available or can't be parsed.
*
- * Return value: a new #LfLauncheeContext or %NULL
+ * Return value: a new #SnLauncheeContext or %NULL
**/
-LfLauncheeContext*
-lf_launchee_context_new_from_environment (LfDisplay *display)
+SnLauncheeContext*
+sn_launchee_context_new_from_environment (SnDisplay *display)
{
const char *id_str;
const char *window_str;
@@ -90,63 +90,63 @@ lf_launchee_context_new_from_environment (LfDisplay *display)
if (id_str == NULL || window_str == NULL)
return NULL;
- window = lf_internal_string_to_ulong (window_str);
+ window = sn_internal_string_to_ulong (window_str);
if (window == None)
return NULL;
- return lf_launchee_context_new (display, id_str, window);
+ return sn_launchee_context_new (display, id_str, window);
}
void
-lf_launchee_context_ref (LfLauncheeContext *context)
+sn_launchee_context_ref (SnLauncheeContext *context)
{
context->refcount += 1;
}
void
-lf_launchee_context_unref (LfLauncheeContext *context)
+sn_launchee_context_unref (SnLauncheeContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
- lf_free (context->launch_id);
+ sn_free (context->launch_id);
- lf_free (context);
+ sn_free (context);
}
}
Window
-lf_launchee_context_get_launch_window (LfLauncheeContext *context)
+sn_launchee_context_get_launch_window (SnLauncheeContext *context)
{
return context->launch_window;
}
const char*
-lf_launchee_context_get_launch_id (LfLauncheeContext *context)
+sn_launchee_context_get_launch_id (SnLauncheeContext *context)
{
return context->launch_id;
}
/**
- * lf_launchee_context_pulse:
- * @context: an #LfLauncheeContext
+ * sn_launchee_context_pulse:
+ * @context: an #SnLauncheeContext
*
* Notifies the launcher that progress is being made. Should be
* called regularly during a long launch operation.
*
**/
void
-lf_launchee_context_pulse (LfLauncheeContext *context)
+sn_launchee_context_pulse (SnLauncheeContext *context)
{
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
- xev.xclient.display = lf_display_get_x_display (context->display);
+ xev.xclient.display = sn_display_get_x_display (context->display);
xev.xclient.window = context->launch_window;
- xev.xclient.message_type = lf_internal_atom_get (context->display,
+ xev.xclient.message_type = sn_internal_atom_get (context->display,
"_NET_LAUNCH_PULSE");
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
@@ -154,53 +154,53 @@ lf_launchee_context_pulse (LfLauncheeContext *context)
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
- lf_display_error_trap_push (context->display);
- XSendEvent (lf_display_get_x_display (context->display),
+ sn_display_error_trap_push (context->display);
+ XSendEvent (sn_display_get_x_display (context->display),
context->launch_window,
False,
PropertyChangeMask,
&xev);
- XFlush (lf_display_get_x_display (context->display));
- lf_display_error_trap_pop (context->display);
+ XFlush (sn_display_get_x_display (context->display));
+ sn_display_error_trap_pop (context->display);
}
/**
- * lf_launchee_context_cancel:
- * @context: an #LfLauncheeContext
+ * sn_launchee_context_cancel:
+ * @context: an #SnLauncheeContext
*
* Called by the launchee application to cancel a launch (will
* probably cause the launcher to kill the launchee).
*
**/
void
-lf_launchee_context_cancel (LfLauncheeContext *context)
+sn_launchee_context_cancel (SnLauncheeContext *context)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_CANCELED",
0);
}
/**
- * lf_launchee_context_complete:
- * @context: an #LfLauncheeContext
+ * sn_launchee_context_complete:
+ * @context: an #SnLauncheeContext
*
* Called by the launchee application when it is fully started up
* and launch feedback should end.
*
**/
void
-lf_launchee_context_complete (LfLauncheeContext *context)
+sn_launchee_context_complete (SnLauncheeContext *context)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_COMPLETE",
0);
}
/**
- * lf_launchee_context_setup_window:
- * @context: a #LfLauncheeContext
+ * sn_launchee_context_setup_window:
+ * @context: a #SnLauncheeContext
* @xwindow: window to be set up
*
* Sets up @xwindow, marking it as launched by the launch sequence
@@ -212,10 +212,10 @@ lf_launchee_context_complete (LfLauncheeContext *context)
*
**/
void
-lf_launchee_context_setup_window (LfLauncheeContext *context,
+sn_launchee_context_setup_window (SnLauncheeContext *context,
Window xwindow)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
xwindow,
"_NET_LAUNCH_ID",
context->launch_id);
diff --git a/libsn/sn-launchee.h b/libsn/sn-launchee.h
index 4969dc3..ee9f189 100644
--- a/libsn/sn-launchee.h
+++ b/libsn/sn-launchee.h
@@ -24,29 +24,29 @@
*/
-#ifndef __LF_LAUNCHEE_H__
-#define __LF_LAUNCHEE_H__
+#ifndef __SN_LAUNCHEE_H__
+#define __SN_LAUNCHEE_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef struct LfLauncheeContext LfLauncheeContext;
+typedef struct SnLauncheeContext SnLauncheeContext;
-LfLauncheeContext* lf_launchee_context_new (LfDisplay *display,
+SnLauncheeContext* sn_launchee_context_new (SnDisplay *display,
const char *launch_id,
Window launch_window);
-LfLauncheeContext* lf_launchee_context_new_from_environment (LfDisplay *display);
-void lf_launchee_context_ref (LfLauncheeContext *context);
-void lf_launchee_context_unref (LfLauncheeContext *context);
-Window lf_launchee_context_get_launch_window (LfLauncheeContext *context);
-const char* lf_launchee_context_get_launch_id (LfLauncheeContext *context);
-void lf_launchee_context_pulse (LfLauncheeContext *context);
-void lf_launchee_context_cancel (LfLauncheeContext *context);
-void lf_launchee_context_complete (LfLauncheeContext *context);
-void lf_launchee_context_setup_window (LfLauncheeContext *context,
+SnLauncheeContext* sn_launchee_context_new_from_environment (SnDisplay *display);
+void sn_launchee_context_ref (SnLauncheeContext *context);
+void sn_launchee_context_unref (SnLauncheeContext *context);
+Window sn_launchee_context_get_launch_window (SnLauncheeContext *context);
+const char* sn_launchee_context_get_launch_id (SnLauncheeContext *context);
+void sn_launchee_context_pulse (SnLauncheeContext *context);
+void sn_launchee_context_cancel (SnLauncheeContext *context);
+void sn_launchee_context_complete (SnLauncheeContext *context);
+void sn_launchee_context_setup_window (SnLauncheeContext *context,
Window xwindow);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_LAUNCHEE_H__ */
+#endif /* __SN_LAUNCHEE_H__ */
diff --git a/libsn/sn-launcher.c b/libsn/sn-launcher.c
index f9803ff..520a342 100644
--- a/libsn/sn-launcher.c
+++ b/libsn/sn-launcher.c
@@ -21,24 +21,24 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "lf-launcher.h"
-#include "lf-internals.h"
+#include "sn-launcher.h"
+#include "sn-internals.h"
#include <sys/types.h>
#include <unistd.h>
-static LfList* context_list = NULL;
+static SnList* context_list = NULL;
-struct LfLauncherContext
+struct SnLauncherContext
{
int refcount;
- LfDisplay *display;
- LfLauncherEventFunc event_func;
+ SnDisplay *display;
+ SnLauncherEventFunc event_func;
void *event_func_data;
- LfFreeFunc free_data_func;
+ SnFreeFunc free_data_func;
char *launch_id;
Window launch_window;
- LfLaunchType type;
+ SnLaunchType type;
Window geometry_window;
char *name;
char *description;
@@ -57,8 +57,8 @@ struct LfLauncherContext
};
/**
- * lf_launcher_context_new:
- * @display: an #LfDisplay
+ * sn_launcher_context_new:
+ * @display: an #SnDisplay
* @event_func: function to be called when a notable event occurs
* @event_func_data: data to pass to @event_func
* @free_data_func: function to be called on @event_func_data when freeing the context
@@ -68,82 +68,82 @@ struct LfLauncherContext
* create a launcher context when the user double-clicks on
* an application icon.
*
- * Return value: a new #LfLauncherContext
+ * Return value: a new #SnLauncherContext
**/
-LfLauncherContext*
-lf_launcher_context_new (LfDisplay *display,
- LfLauncherEventFunc event_func,
+SnLauncherContext*
+sn_launcher_context_new (SnDisplay *display,
+ SnLauncherEventFunc event_func,
void *event_func_data,
- LfFreeFunc free_data_func)
+ SnFreeFunc free_data_func)
{
- LfLauncherContext *context;
+ SnLauncherContext *context;
if (context_list == NULL)
- context_list = lf_list_new ();
+ context_list = sn_list_new ();
- context = lf_new0 (LfLauncherContext, 1);
+ context = sn_new0 (SnLauncherContext, 1);
context->refcount = 1;
context->display = display;
- lf_display_ref (context->display);
+ sn_display_ref (context->display);
context->event_func = event_func;
context->event_func_data = event_func_data;
context->free_data_func = free_data_func;
context->workspace = -1;
context->pid = -1;
- context->type = LF_LAUNCH_TYPE_OTHER;
+ context->type = SN_LAUNCH_TYPE_OTHER;
- lf_list_prepend (context_list, context);
+ sn_list_prepend (context_list, context);
return context;
}
/**
- * lf_launcher_context_ref:
- * @context: a #LfLauncherContext
+ * sn_launcher_context_ref:
+ * @context: a #SnLauncherContext
*
* Increments the reference count of @context
**/
void
-lf_launcher_context_ref (LfLauncherContext *context)
+sn_launcher_context_ref (SnLauncherContext *context)
{
context->refcount += 1;
}
/**
- * lf_launcher_context_unref:
- * @context: a #LfLauncherContext
+ * sn_launcher_context_unref:
+ * @context: a #SnLauncherContext
*
* Decrements the reference count of @context and frees the
* context if the count reaches zero.
**/
void
-lf_launcher_context_unref (LfLauncherContext *context)
+sn_launcher_context_unref (SnLauncherContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
- lf_list_remove (context_list, context);
+ sn_list_remove (context_list, context);
if (context->free_data_func)
(* context->free_data_func) (context->event_func_data);
- lf_free (context->launch_id);
+ sn_free (context->launch_id);
if (context->launch_window != None)
{
- lf_display_error_trap_push (context->display);
+ sn_display_error_trap_push (context->display);
- XDestroyWindow (lf_display_get_x_display (context->display),
+ XDestroyWindow (sn_display_get_x_display (context->display),
context->launch_window);
- lf_display_error_trap_pop (context->display);
+ sn_display_error_trap_pop (context->display);
}
- lf_display_unref (context->display);
- lf_free (context);
+ sn_display_unref (context->display);
+ sn_free (context);
}
}
@@ -153,7 +153,7 @@ strip_slashes (const char *src)
char *canonicalized_name;
char *s;
- canonicalized_name = lf_internal_strdup (src);
+ canonicalized_name = sn_internal_strdup (src);
s = canonicalized_name;
while (*s)
@@ -167,8 +167,8 @@ strip_slashes (const char *src)
}
/**
- * lf_launcher_context_initiate:
- * @context: an #LfLaunchContext
+ * sn_launcher_context_initiate:
+ * @context: an #SnLaunchContext
* @launcher_name: name of the launcher app, suitable for debug output
* @launchee_name: name of the launchee app, suitable for debug output
* @timestamp: X timestamp of event causing the launch
@@ -178,13 +178,13 @@ strip_slashes (const char *src)
* initiating the sequence.
**/
void
-lf_launcher_context_initiate (LfLauncherContext *context,
+sn_launcher_context_initiate (SnLauncherContext *context,
const char *launcher_name,
const char *launchee_name,
Time timestamp)
{
static int sequence_number = 0;
- static lf_bool_t have_hostname = FALSE;
+ static sn_bool_t have_hostname = FALSE;
static char hostbuf[257];
char *s;
int len;
@@ -195,7 +195,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->launch_id != NULL)
{
- fprintf (stderr, "%s called twice for the same LfLaunchContext\n",
+ fprintf (stderr, "%s called twice for the same SnLaunchContext\n",
__FUNCTION__);
return;
}
@@ -215,18 +215,18 @@ lf_launcher_context_initiate (LfLauncherContext *context,
len = strlen (launcher_name) + strlen (launchee_name) +
256; /* 256 is longer than a couple %d and some slashes */
- s = lf_malloc (len + 3);
+ s = sn_malloc (len + 3);
snprintf (s, len, "%s/%s/%lu/%d-%d-%s",
canonicalized_launcher, canonicalized_launchee, (unsigned long) timestamp,
(int) getpid (), (int) sequence_number, hostbuf);
++sequence_number;
- lf_free (canonicalized_launcher);
- lf_free (canonicalized_launchee);
+ sn_free (canonicalized_launcher);
+ sn_free (canonicalized_launchee);
context->launch_id = s;
- xdisplay = lf_display_get_x_display (context->display);
+ xdisplay = sn_display_get_x_display (context->display);
{
XSetWindowAttributes attrs;
@@ -249,43 +249,43 @@ lf_launcher_context_initiate (LfLauncherContext *context,
/* push outer error to allow avoiding XSync after every
* property set
*/
- lf_display_error_trap_push (context->display);
+ sn_display_error_trap_push (context->display);
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_ID",
context->launch_id);
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_HOSTNAME",
hostbuf);
switch (context->type)
{
- case LF_LAUNCH_TYPE_OTHER:
- atoms[0] = lf_internal_atom_get (context->display,
+ case SN_LAUNCH_TYPE_OTHER:
+ atoms[0] = sn_internal_atom_get (context->display,
"_NET_LAUNCH_TYPE_OTHER");
break;
- case LF_LAUNCH_TYPE_DOCK_ICON:
- atoms[0] = lf_internal_atom_get (context->display,
+ case SN_LAUNCH_TYPE_DOCK_ICON:
+ atoms[0] = sn_internal_atom_get (context->display,
"_NET_LAUNCH_TYPE_DOCK_ICON");
break;
- case LF_LAUNCH_TYPE_DESKTOP_ICON:
- atoms[0] = lf_internal_atom_get (context->display,
+ case SN_LAUNCH_TYPE_DESKTOP_ICON:
+ atoms[0] = sn_internal_atom_get (context->display,
"_NET_LAUNCH_TYPE_DESKTOP_ICON");
break;
- case LF_LAUNCH_TYPE_MENU:
- atoms[0] = lf_internal_atom_get (context->display,
+ case SN_LAUNCH_TYPE_MENU:
+ atoms[0] = sn_internal_atom_get (context->display,
"_NET_LAUNCH_TYPE_MENU");
break;
- case LF_LAUNCH_TYPE_KEY_SHORTCUT:
- atoms[0] = lf_internal_atom_get (context->display,
+ case SN_LAUNCH_TYPE_KEY_SHORTCUT:
+ atoms[0] = sn_internal_atom_get (context->display,
"_NET_LAUNCH_TYPE_KEY_SHORTCUT");
break;
}
- lf_internal_set_atom_list (context->display,
+ sn_internal_set_atom_list (context->display,
context->launch_window,
"_NET_LAUNCH_TYPE",
atoms, 1);
@@ -299,7 +299,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
cardinals[2] = context->width;
cardinals[3] = context->height;
- lf_internal_set_cardinal_list (context->display,
+ sn_internal_set_cardinal_list (context->display,
context->launch_window,
"_NET_LAUNCH_GEOMETRY",
cardinals, 4);
@@ -307,7 +307,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->geometry_window != None)
{
- lf_internal_set_window (context->display,
+ sn_internal_set_window (context->display,
context->launch_window,
"_NET_LAUNCH_GEOMETRY_WINDOW",
context->geometry_window);
@@ -315,7 +315,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->supports_cancel)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_SUPPORTS_CANCEL",
context->supports_cancel);
@@ -323,7 +323,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->name)
{
- lf_internal_set_utf8_string (context->display,
+ sn_internal_set_utf8_string (context->display,
context->launch_window,
"_NET_LAUNCH_NAME",
context->name);
@@ -331,7 +331,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->description)
{
- lf_internal_set_utf8_string (context->display,
+ sn_internal_set_utf8_string (context->display,
context->launch_window,
"_NET_LAUNCH_DESCRIPTION",
context->description);
@@ -339,7 +339,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->workspace >= 0)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_DESKTOP",
context->workspace);
@@ -347,7 +347,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->pid >= 0)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_PID",
context->pid);
@@ -355,7 +355,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->binary_name)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_BINARY_NAME",
context->binary_name);
@@ -363,7 +363,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->icon_name)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_ICON_NAME",
context->icon_name);
@@ -371,7 +371,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->resource_class)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_LEGACY_RESOURCE_CLASS",
context->resource_class);
@@ -379,7 +379,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->resource_name)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_LEGACY_RESOURCE_NAME",
context->resource_name);
@@ -387,13 +387,13 @@ lf_launcher_context_initiate (LfLauncherContext *context,
if (context->window_title)
{
- lf_internal_set_string (context->display,
+ sn_internal_set_string (context->display,
context->launch_window,
"_NET_LAUNCH_LEGACY_NAME",
context->window_title);
}
- lf_display_error_trap_pop (context->display);
+ sn_display_error_trap_pop (context->display);
/* Sync to server (so the launch window ID exists for example) */
XFlush (xdisplay);
@@ -407,7 +407,7 @@ lf_launcher_context_initiate (LfLauncherContext *context,
xev.xclient.send_event = True;
xev.xclient.display = xdisplay;
xev.xclient.window = context->launch_window;
- xev.xclient.message_type = lf_internal_atom_get (context->display,
+ xev.xclient.message_type = sn_internal_atom_get (context->display,
"_NET_LAUNCH_INITIATE");
xev.xclient.format = 32;
xev.xclient.data.l[0] = timestamp;
@@ -415,87 +415,87 @@ lf_launcher_context_initiate (LfLauncherContext *context,
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
- lf_internal_send_event_all_screens (context->display,
+ sn_internal_send_event_all_screens (context->display,
PropertyChangeMask,
&xev);
}
}
Window
-lf_launcher_context_get_launch_window (LfLauncherContext *context)
+sn_launcher_context_get_launch_window (SnLauncherContext *context)
{
return context->launch_window;
}
const char*
-lf_launcher_context_get_launch_id (LfLauncherContext *context)
+sn_launcher_context_get_launch_id (SnLauncherContext *context)
{
return context->launch_id;
}
-lf_bool_t
-lf_launcher_context_get_initiated (LfLauncherContext *context)
+sn_bool_t
+sn_launcher_context_get_initiated (SnLauncherContext *context)
{
return context->launch_id != NULL;
}
-lf_bool_t
-lf_launcher_context_get_canceled (LfLauncherContext *context)
+sn_bool_t
+sn_launcher_context_get_canceled (SnLauncherContext *context)
{
return context->canceled;
}
/**
- * lf_launcher_context_get_completed:
- * @context: an #LfLauncherContext
+ * sn_launcher_context_get_completed:
+ * @context: an #SnLauncherContext
*
* Returns %TRUE if _NET_LAUNCH_COMPLETE has been set or the
* launch sequence window has been destroyed.
*
* Return value: %TRUE if the launch sequence has been completed
**/
-lf_bool_t
-lf_launcher_context_get_completed (LfLauncherContext *context)
+sn_bool_t
+sn_launcher_context_get_completed (SnLauncherContext *context)
{
return context->completed;
}
/**
- * lf_launcher_context_cancel:
- * @context: an #LfLauncherContext
+ * sn_launcher_context_cancel:
+ * @context: an #SnLauncherContext
*
* Marks the launch canceled by setting the _NET_LAUNCH_CANCELED
* property on the launch window. May not be called if the launch has
- * not been initiated. An #LF_LAUNCHER_EVENT_CANCELED event should be
+ * not been initiated. An #SN_LAUNCHER_EVENT_CANCELED event should be
* received in response to the cancellation, under normal
* circumstances.
*
- * lf_launcher_context_cancel() should be called to request a
+ * sn_launcher_context_cancel() should be called to request a
* cancellation. Normally the launcher process is the process that
* performs the cancellation as well, in response to an
- * #LF_LAUNCHER_EVENT_CANCELED event.
+ * #SN_LAUNCHER_EVENT_CANCELED event.
*
**/
void
-lf_launcher_context_cancel (LfLauncherContext *context)
+sn_launcher_context_cancel (SnLauncherContext *context)
{
if (context->launch_id == NULL)
{
- fprintf (stderr, "%s called for an LfLauncherContext that hasn't been initiated\n",
+ fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
__FUNCTION__);
return;
}
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_CANCELED",
0);
}
/**
- * lf_launcher_context_complete:
- * @context: an #LfLauncherContext
+ * sn_launcher_context_complete:
+ * @context: an #SnLauncherContext
*
* Marks @context as completed. Normally the launchee process marks a
* launch sequence completed, however the launcher has to do it
@@ -503,24 +503,24 @@ lf_launcher_context_cancel (LfLauncherContext *context)
*
**/
void
-lf_launcher_context_complete (LfLauncherContext *context)
+sn_launcher_context_complete (SnLauncherContext *context)
{
if (context->launch_id == NULL)
{
- fprintf (stderr, "%s called for an LfLauncherContext that hasn't been initiated\n",
+ fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
__FUNCTION__);
return;
}
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_COMPLETE",
0);
}
/**
- * lf_launcher_context_setup_child_process:
- * @context: an #LfLauncherContext
+ * sn_launcher_context_setup_child_process:
+ * @context: an #SnLauncherContext
*
* This function should be called after forking, but before exec(), in
* the child process being launched. It sets up the environment variables
@@ -530,7 +530,7 @@ lf_launcher_context_complete (LfLauncherContext *context)
*
**/
void
-lf_launcher_context_setup_child_process (LfLauncherContext *context)
+sn_launcher_context_setup_child_process (SnLauncherContext *context)
{
char *launch_id;
char *s;
@@ -538,20 +538,20 @@ lf_launcher_context_setup_child_process (LfLauncherContext *context)
if (context->launch_id == NULL)
{
- fprintf (stderr, "%s called for an LfLauncherContext that hasn't been initiated\n",
+ fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
__FUNCTION__);
return;
}
/* Man we need glib here */
- launch_id = lf_malloc (strlen (context->launch_id) + strlen ("DESKTOP_LAUNCH_ID") + 3);
+ launch_id = sn_malloc (strlen (context->launch_id) + strlen ("DESKTOP_LAUNCH_ID") + 3);
strcpy (launch_id, "DESKTOP_LAUNCH_ID=");
strcat (launch_id, context->launch_id);
putenv (launch_id);
- launch_window = lf_malloc (strlen ("DESKTOP_LAUNCH_WINDOW") + 128);
+ launch_window = sn_malloc (strlen ("DESKTOP_LAUNCH_WINDOW") + 128);
strcpy (launch_window, "DESKTOP_LAUNCH_WINDOW=");
s = launch_window;
while (*s)
@@ -565,14 +565,14 @@ lf_launcher_context_setup_child_process (LfLauncherContext *context)
}
#define WARN_ALREADY_INITIATED(context) do { if ((context)->launch_id != NULL) { \
- fprintf (stderr, "%s called for an LfLauncherContext that has already been initiated\n", \
+ fprintf (stderr, "%s called for an SnLauncherContext that has already been initiated\n", \
__FUNCTION__); \
return; \
} } while (0)
void
-lf_launcher_context_set_launch_type (LfLauncherContext *context,
- LfLaunchType type)
+sn_launcher_context_set_launch_type (SnLauncherContext *context,
+ SnLaunchType type)
{
WARN_ALREADY_INITIATED (context);
@@ -580,7 +580,7 @@ lf_launcher_context_set_launch_type (LfLauncherContext *context,
}
void
-lf_launcher_context_set_geometry_window (LfLauncherContext *context,
+sn_launcher_context_set_geometry_window (SnLauncherContext *context,
Window xwindow)
{
WARN_ALREADY_INITIATED (context);
@@ -589,8 +589,8 @@ lf_launcher_context_set_geometry_window (LfLauncherContext *context,
}
void
-lf_launcher_context_set_supports_cancel (LfLauncherContext *context,
- lf_bool_t supports_cancel)
+sn_launcher_context_set_supports_cancel (SnLauncherContext *context,
+ sn_bool_t supports_cancel)
{
WARN_ALREADY_INITIATED (context);
@@ -598,27 +598,27 @@ lf_launcher_context_set_supports_cancel (LfLauncherContext *context,
}
void
-lf_launcher_context_set_launch_name (LfLauncherContext *context,
+sn_launcher_context_set_launch_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->name);
- context->name = lf_internal_strdup (name);
+ sn_free (context->name);
+ context->name = sn_internal_strdup (name);
}
void
-lf_launcher_context_set_launch_description (LfLauncherContext *context,
+sn_launcher_context_set_launch_description (SnLauncherContext *context,
const char *description)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->description);
- context->description = lf_internal_strdup (description);
+ sn_free (context->description);
+ context->description = sn_internal_strdup (description);
}
void
-lf_launcher_context_set_launch_workspace (LfLauncherContext *context,
+sn_launcher_context_set_launch_workspace (SnLauncherContext *context,
int workspace)
{
WARN_ALREADY_INITIATED (context);
@@ -627,47 +627,47 @@ lf_launcher_context_set_launch_workspace (LfLauncherContext *context,
}
void
-lf_launcher_context_set_legacy_resource_class (LfLauncherContext *context,
+sn_launcher_context_set_legacy_resource_class (SnLauncherContext *context,
const char *klass)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->resource_class);
- context->resource_class = lf_internal_strdup (klass);
+ sn_free (context->resource_class);
+ context->resource_class = sn_internal_strdup (klass);
}
void
-lf_launcher_context_set_legacy_resource_name (LfLauncherContext *context,
+sn_launcher_context_set_legacy_resource_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->resource_name);
- context->resource_name = lf_internal_strdup (name);
+ sn_free (context->resource_name);
+ context->resource_name = sn_internal_strdup (name);
}
void
-lf_launcher_context_set_legacy_window_title (LfLauncherContext *context,
+sn_launcher_context_set_legacy_window_title (SnLauncherContext *context,
const char *title)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->window_title);
- context->window_title = lf_internal_strdup (title);
+ sn_free (context->window_title);
+ context->window_title = sn_internal_strdup (title);
}
void
-lf_launcher_context_set_binary_name (LfLauncherContext *context,
+sn_launcher_context_set_binary_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->binary_name);
- context->binary_name = lf_internal_strdup (name);
+ sn_free (context->binary_name);
+ context->binary_name = sn_internal_strdup (name);
}
void
-lf_launcher_context_set_pid (LfLauncherContext *context,
+sn_launcher_context_set_pid (SnLauncherContext *context,
int pid)
{
context->pid = pid;
@@ -675,7 +675,7 @@ lf_launcher_context_set_pid (LfLauncherContext *context,
/* set the X property if launch window already exists */
if (context->launch_id != NULL)
{
- lf_internal_set_cardinal (context->display,
+ sn_internal_set_cardinal (context->display,
context->launch_window,
"_NET_LAUNCH_PID",
context->pid);
@@ -683,114 +683,114 @@ lf_launcher_context_set_pid (LfLauncherContext *context,
}
void
-lf_launcher_context_set_icon_name (LfLauncherContext *context,
+sn_launcher_context_set_icon_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
- lf_free (context->icon_name);
- context->icon_name = lf_internal_strdup (name);
+ sn_free (context->icon_name);
+ context->icon_name = sn_internal_strdup (name);
}
-struct LfLauncherEvent
+struct SnLauncherEvent
{
int refcount;
- LfLauncherEventType type;
+ SnLauncherEventType type;
Time timestamp;
- LfLauncherContext *context;
+ SnLauncherContext *context;
};
/**
- * lf_launcher_event_copy:
+ * sn_launcher_event_copy:
* @event: event to copy
*
* Creates a copy of @event, the copy has a reference count of one.
*
- * Return value: a new #LfLauncherEvent that's a copy of @event
+ * Return value: a new #SnLauncherEvent that's a copy of @event
**/
-LfLauncherEvent*
-lf_launcher_event_copy (LfLauncherEvent *event)
+SnLauncherEvent*
+sn_launcher_event_copy (SnLauncherEvent *event)
{
- LfLauncherEvent *copy;
+ SnLauncherEvent *copy;
- copy = lf_new (LfLauncherEvent, 1);
+ copy = sn_new (SnLauncherEvent, 1);
copy->refcount = 1;
copy->type = event->type;
copy->timestamp = event->timestamp;
copy->context = event->context;
if (copy->context)
- lf_launcher_context_ref (copy->context);
+ sn_launcher_context_ref (copy->context);
return copy;
}
/**
- * lf_launcher_event_ref:
- * @event: a #LfLauncherEvent
+ * sn_launcher_event_ref:
+ * @event: a #SnLauncherEvent
*
* Increments @event's reference count.
**/
void
-lf_launcher_event_ref (LfLauncherEvent *event)
+sn_launcher_event_ref (SnLauncherEvent *event)
{
event->refcount += 1;
}
/**
- * lf_launcher_event_unref:
- * @event: a #LfLauncherEvent
+ * sn_launcher_event_unref:
+ * @event: a #SnLauncherEvent
*
* Decrements @event's reference count and frees @event
* if the count reaches zero.
**/
void
-lf_launcher_event_unref (LfLauncherEvent *event)
+sn_launcher_event_unref (SnLauncherEvent *event)
{
event->refcount -= 1;
if (event->refcount == 0)
{
if (event->context)
- lf_launcher_context_unref (event->context);
- lf_free (event);
+ sn_launcher_context_unref (event->context);
+ sn_free (event);
}
}
/**
- * lf_launcher_event_get_type:
- * @event: a #LfLauncherEvent
+ * sn_launcher_event_get_type:
+ * @event: a #SnLauncherEvent
*
* Gets the type of the launcher event.
*
* Return value: the type of event
**/
-LfLauncherEventType
-lf_launcher_event_get_type (LfLauncherEvent *event)
+SnLauncherEventType
+sn_launcher_event_get_type (SnLauncherEvent *event)
{
return event->type;
}
/**
- * lf_launcher_event_get_context:
- * @event: a #LfLauncherEvent
+ * sn_launcher_event_get_context:
+ * @event: a #SnLauncherEvent
*
* Gets the context associated with @event. The
* returned context is owned by the event, i.e.
- * the caller of lf_launcher_event_get_context() should
+ * the caller of sn_launcher_event_get_context() should
* not unref the context.
*
* Return value: the context for this event
**/
-LfLauncherContext*
-lf_launcher_event_get_context (LfLauncherEvent *event)
+SnLauncherContext*
+sn_launcher_event_get_context (SnLauncherEvent *event)
{
return event->context;
}
/**
- * lf_launcher_event_get_time:
- * @event: a #LfLauncherEvent
+ * sn_launcher_event_get_time:
+ * @event: a #SnLauncherEvent
*
* Gets the X Window System timestamp associated with this launcher
* event.
@@ -798,40 +798,40 @@ lf_launcher_event_get_context (LfLauncherEvent *event)
* Return value: timestamp for the event, or CurrentTime if none available
**/
Time
-lf_launcher_event_get_time (LfLauncherEvent *event)
+sn_launcher_event_get_time (SnLauncherEvent *event)
{
return event->timestamp;
}
-static lf_bool_t
-check_cardinal_exists (LfDisplay *display,
+static sn_bool_t
+check_cardinal_exists (SnDisplay *display,
Window xwindow,
const char *property)
{
int val;
- return lf_internal_get_cardinal (display, xwindow, property,
+ return sn_internal_get_cardinal (display, xwindow, property,
&val);
}
typedef struct
{
- LfDisplay *display;
+ SnDisplay *display;
Window launch_window;
- lf_bool_t result;
+ sn_bool_t result;
} HaveContextsData;
-static lf_bool_t
+static sn_bool_t
have_active_contexts_foreach (void *value,
void *data)
{
- LfLauncherContext *context = value;
+ SnLauncherContext *context = value;
HaveContextsData *hcd = data;
if (!context->completed &&
context->launch_window == hcd->launch_window &&
- lf_display_get_x_display (context->display) ==
- lf_display_get_x_display (hcd->display))
+ sn_display_get_x_display (context->display) ==
+ sn_display_get_x_display (hcd->display))
{
hcd->result = TRUE;
return FALSE;
@@ -842,63 +842,63 @@ have_active_contexts_foreach (void *value,
typedef struct
{
- LfDisplay *display;
+ SnDisplay *display;
Window launch_window;
- LfList *contexts;
+ SnList *contexts;
} FindContextsData;
-static lf_bool_t
+static sn_bool_t
find_active_contexts_foreach (void *value,
void *data)
{
- LfLauncherContext *context = value;
+ SnLauncherContext *context = value;
FindContextsData *fcd = data;
if (!context->completed &&
context->launch_window == fcd->launch_window &&
- lf_display_get_x_display (context->display) ==
- lf_display_get_x_display (fcd->display))
- lf_list_prepend (fcd->contexts, context);
+ sn_display_get_x_display (context->display) ==
+ sn_display_get_x_display (fcd->display))
+ sn_list_prepend (fcd->contexts, context);
return TRUE;
}
typedef struct
{
- LfLauncherEvent *base_event;
- LfList *events;
+ SnLauncherEvent *base_event;
+ SnList *events;
} CreateEventsData;
-static lf_bool_t
+static sn_bool_t
create_events_foreach (void *value,
void *data)
{
- LfLauncherContext *context = value;
+ SnLauncherContext *context = value;
CreateEventsData *ced = data;
- LfLauncherEvent *event;
+ SnLauncherEvent *event;
- event = lf_launcher_event_copy (ced->base_event);
+ event = sn_launcher_event_copy (ced->base_event);
event->context = context;
- lf_launcher_context_ref (context);
+ sn_launcher_context_ref (context);
- lf_list_prepend (ced->events, event);
+ sn_list_prepend (ced->events, event);
return TRUE;
}
-static lf_bool_t
+static sn_bool_t
dispatch_events_foreach (void *value,
void *data)
{
- LfLauncherEvent *event = value;
+ SnLauncherEvent *event = value;
/* Filter out duplicate events and update flags */
switch (event->type)
{
- case LF_LAUNCHER_EVENT_CANCELED:
+ case SN_LAUNCHER_EVENT_CANCELED:
if (event->context->canceled)
{
- lf_launcher_event_unref (event);
+ sn_launcher_event_unref (event);
event = NULL;
}
else
@@ -906,10 +906,10 @@ dispatch_events_foreach (void *value,
event->context->canceled = TRUE;
}
break;
- case LF_LAUNCHER_EVENT_COMPLETED:
+ case SN_LAUNCHER_EVENT_COMPLETED:
if (event->context->completed)
{
- lf_launcher_event_unref (event);
+ sn_launcher_event_unref (event);
event = NULL;
}
else
@@ -927,16 +927,16 @@ dispatch_events_foreach (void *value,
if (event->context->event_func)
(* event->context->event_func) (event,
event->context->event_func_data);
- lf_launcher_event_unref (event);
+ sn_launcher_event_unref (event);
}
return TRUE;
}
static void
-dispatch_event (LfDisplay *display,
+dispatch_event (SnDisplay *display,
Window launch_window,
- LfLauncherEvent *event)
+ SnLauncherEvent *event)
{
/* Find all applicable contexts, create an event for each, and send
* the events out.
@@ -946,32 +946,32 @@ dispatch_event (LfDisplay *display,
fcd.display = display;
fcd.launch_window = launch_window;
- fcd.contexts = lf_list_new ();
+ fcd.contexts = sn_list_new ();
if (context_list != NULL)
- lf_list_foreach (context_list, find_active_contexts_foreach, &fcd);
+ sn_list_foreach (context_list, find_active_contexts_foreach, &fcd);
ced.base_event = event;
- ced.events = lf_list_new ();
- lf_list_foreach (fcd.contexts, create_events_foreach, &ced);
+ ced.events = sn_list_new ();
+ sn_list_foreach (fcd.contexts, create_events_foreach, &ced);
/* This unref's each event as it's dispatched */
- lf_list_foreach (ced.events, dispatch_events_foreach, NULL);
+ sn_list_foreach (ced.events, dispatch_events_foreach, NULL);
- lf_list_free (fcd.contexts);
- lf_list_free (ced.events);
+ sn_list_free (fcd.contexts);
+ sn_list_free (ced.events);
}
-lf_bool_t
-lf_internal_launcher_process_event (LfDisplay *display,
+sn_bool_t
+sn_internal_launcher_process_event (SnDisplay *display,
XEvent *xevent)
{
- lf_bool_t retval;
- LfLauncherEvent *event;
+ sn_bool_t retval;
+ SnLauncherEvent *event;
Window event_xwindow;
if (context_list == NULL ||
- lf_list_empty (context_list))
+ sn_list_empty (context_list))
return FALSE; /* no one cares */
event_xwindow = None;
@@ -982,17 +982,17 @@ lf_internal_launcher_process_event (LfDisplay *display,
{
case PropertyNotify:
if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_CANCELED"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_CANCELED"))
{
event_xwindow = xevent->xproperty.window;
if (check_cardinal_exists (display, event_xwindow,
"_NET_LAUNCH_CANCELED"))
{
- event = lf_new (LfLauncherEvent, 1);
+ event = sn_new (SnLauncherEvent, 1);
event->refcount = 1;
- event->type = LF_LAUNCHER_EVENT_CANCELED;
+ event->type = SN_LAUNCHER_EVENT_CANCELED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
}
@@ -1000,17 +1000,17 @@ lf_internal_launcher_process_event (LfDisplay *display,
retval = TRUE;
}
else if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_COMPLETE"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_COMPLETE"))
{
event_xwindow = xevent->xproperty.window;
if (check_cardinal_exists (display, event_xwindow,
"_NET_LAUNCH_COMPLETE"))
{
- event = lf_new (LfLauncherEvent, 1);
+ event = sn_new (SnLauncherEvent, 1);
event->refcount = 1;
- event->type = LF_LAUNCHER_EVENT_COMPLETED;
+ event->type = SN_LAUNCHER_EVENT_COMPLETED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
}
@@ -1021,15 +1021,15 @@ lf_internal_launcher_process_event (LfDisplay *display,
case ClientMessage:
if (xevent->xclient.message_type ==
- lf_internal_atom_get (display,
+ sn_internal_atom_get (display,
"_NET_LAUNCH_PULSE"))
{
event_xwindow = xevent->xclient.window;
- event = lf_new (LfLauncherEvent, 1);
+ event = sn_new (SnLauncherEvent, 1);
event->refcount = 1;
- event->type = LF_LAUNCHER_EVENT_PULSE;
+ event->type = SN_LAUNCHER_EVENT_PULSE;
event->timestamp = CurrentTime;
event->context = NULL;
@@ -1044,15 +1044,15 @@ lf_internal_launcher_process_event (LfDisplay *display,
hcd.launch_window = xevent->xdestroywindow.window;
hcd.result = FALSE;
if (context_list)
- lf_list_foreach (context_list, have_active_contexts_foreach, &hcd);
+ sn_list_foreach (context_list, have_active_contexts_foreach, &hcd);
if (hcd.result)
{
event_xwindow = hcd.launch_window;
- event = lf_new (LfLauncherEvent, 1);
+ event = sn_new (SnLauncherEvent, 1);
event->refcount = 1;
- event->type = LF_LAUNCHER_EVENT_COMPLETED;
+ event->type = SN_LAUNCHER_EVENT_COMPLETED;
event->timestamp = CurrentTime;
event->context = NULL;
}
@@ -1067,7 +1067,7 @@ lf_internal_launcher_process_event (LfDisplay *display,
{
dispatch_event (display, event_xwindow, event);
- lf_launcher_event_unref (event);
+ sn_launcher_event_unref (event);
}
return retval;
diff --git a/libsn/sn-launcher.h b/libsn/sn-launcher.h
index 5a805d6..bafeef1 100644
--- a/libsn/sn-launcher.h
+++ b/libsn/sn-launcher.h
@@ -24,80 +24,80 @@
*/
-#ifndef __LF_LAUNCHER_H__
-#define __LF_LAUNCHER_H__
+#ifndef __SN_LAUNCHER_H__
+#define __SN_LAUNCHER_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef struct LfLauncherContext LfLauncherContext;
-typedef struct LfLauncherEvent LfLauncherEvent;
+typedef struct SnLauncherContext SnLauncherContext;
+typedef struct SnLauncherEvent SnLauncherEvent;
-typedef void (* LfLauncherEventFunc) (LfLauncherEvent *event,
+typedef void (* SnLauncherEventFunc) (SnLauncherEvent *event,
void *user_data);
typedef enum
{
- LF_LAUNCHER_EVENT_CANCELED,
- LF_LAUNCHER_EVENT_COMPLETED,
- LF_LAUNCHER_EVENT_PULSE
-} LfLauncherEventType;
+ SN_LAUNCHER_EVENT_CANCELED,
+ SN_LAUNCHER_EVENT_COMPLETED,
+ SN_LAUNCHER_EVENT_PULSE
+} SnLauncherEventType;
-LfLauncherContext* lf_launcher_context_new (LfDisplay *display,
- LfLauncherEventFunc event_func,
+SnLauncherContext* sn_launcher_context_new (SnDisplay *display,
+ SnLauncherEventFunc event_func,
void *event_func_data,
- LfFreeFunc free_data_func);
-void lf_launcher_context_ref (LfLauncherContext *context);
-void lf_launcher_context_unref (LfLauncherContext *context);
+ SnFreeFunc free_data_func);
+void sn_launcher_context_ref (SnLauncherContext *context);
+void sn_launcher_context_unref (SnLauncherContext *context);
-void lf_launcher_context_initiate (LfLauncherContext *context,
+void sn_launcher_context_initiate (SnLauncherContext *context,
const char *launcher_name,
const char *launchee_name,
Time timestamp);
-Window lf_launcher_context_get_launch_window (LfLauncherContext *context);
-const char* lf_launcher_context_get_launch_id (LfLauncherContext *context);
-lf_bool_t lf_launcher_context_get_initiated (LfLauncherContext *context);
-lf_bool_t lf_launcher_context_get_canceled (LfLauncherContext *context);
-lf_bool_t lf_launcher_context_get_completed (LfLauncherContext *context);
-void lf_launcher_context_cancel (LfLauncherContext *context);
-void lf_launcher_context_complete (LfLauncherContext *context);
+Window sn_launcher_context_get_launch_window (SnLauncherContext *context);
+const char* sn_launcher_context_get_launch_id (SnLauncherContext *context);
+sn_bool_t sn_launcher_context_get_initiated (SnLauncherContext *context);
+sn_bool_t sn_launcher_context_get_canceled (SnLauncherContext *context);
+sn_bool_t sn_launcher_context_get_completed (SnLauncherContext *context);
+void sn_launcher_context_cancel (SnLauncherContext *context);
+void sn_launcher_context_complete (SnLauncherContext *context);
-void lf_launcher_context_setup_child_process (LfLauncherContext *context);
+void sn_launcher_context_setup_child_process (SnLauncherContext *context);
-void lf_launcher_context_set_launch_type (LfLauncherContext *context,
- LfLaunchType type);
-void lf_launcher_context_set_geometry_window (LfLauncherContext *context,
+void sn_launcher_context_set_launch_type (SnLauncherContext *context,
+ SnLaunchType type);
+void sn_launcher_context_set_geometry_window (SnLauncherContext *context,
Window xwindow);
-void lf_launcher_context_set_supports_cancel (LfLauncherContext *context,
- lf_bool_t supports_cancel);
-void lf_launcher_context_set_launch_name (LfLauncherContext *context,
+void sn_launcher_context_set_supports_cancel (SnLauncherContext *context,
+ sn_bool_t supports_cancel);
+void sn_launcher_context_set_launch_name (SnLauncherContext *context,
const char *name);
-void lf_launcher_context_set_launch_description (LfLauncherContext *context,
+void sn_launcher_context_set_launch_description (SnLauncherContext *context,
const char *description);
-void lf_launcher_context_set_launch_workspace (LfLauncherContext *context,
+void sn_launcher_context_set_launch_workspace (SnLauncherContext *context,
int workspace);
-void lf_launcher_context_set_legacy_resource_class (LfLauncherContext *context,
+void sn_launcher_context_set_legacy_resource_class (SnLauncherContext *context,
const char *klass);
-void lf_launcher_context_set_legacy_resource_name (LfLauncherContext *context,
+void sn_launcher_context_set_legacy_resource_name (SnLauncherContext *context,
const char *name);
-void lf_launcher_context_set_legacy_window_title (LfLauncherContext *context,
+void sn_launcher_context_set_legacy_window_title (SnLauncherContext *context,
const char *title);
-void lf_launcher_context_set_binary_name (LfLauncherContext *context,
+void sn_launcher_context_set_binary_name (SnLauncherContext *context,
const char *name);
-void lf_launcher_context_set_pid (LfLauncherContext *context,
+void sn_launcher_context_set_pid (SnLauncherContext *context,
int pid);
-void lf_launcher_context_set_icon_name (LfLauncherContext *context,
+void sn_launcher_context_set_icon_name (SnLauncherContext *context,
const char *name);
-LfLauncherEvent* lf_launcher_event_copy (LfLauncherEvent *event);
-void lf_launcher_event_ref (LfLauncherEvent *event);
-void lf_launcher_event_unref (LfLauncherEvent *event);
-LfLauncherEventType lf_launcher_event_get_type (LfLauncherEvent *event);
-LfLauncherContext* lf_launcher_event_get_context (LfLauncherEvent *event);
-Time lf_launcher_event_get_time (LfLauncherEvent *event);
+SnLauncherEvent* sn_launcher_event_copy (SnLauncherEvent *event);
+void sn_launcher_event_ref (SnLauncherEvent *event);
+void sn_launcher_event_unref (SnLauncherEvent *event);
+SnLauncherEventType sn_launcher_event_get_type (SnLauncherEvent *event);
+SnLauncherContext* sn_launcher_event_get_context (SnLauncherEvent *event);
+Time sn_launcher_event_get_time (SnLauncherEvent *event);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_LAUNCHER_H__ */
+#endif /* __SN_LAUNCHER_H__ */
diff --git a/libsn/sn-list.c b/libsn/sn-list.c
index dbbd0a2..b9f92bf 100644
--- a/libsn/sn-list.c
+++ b/libsn/sn-list.c
@@ -23,69 +23,69 @@
* SOFTWARE.
*/
-#include "lf-list.h"
-#include "lf-internals.h"
+#include "sn-list.h"
+#include "sn-internals.h"
-typedef struct LfListNode
+typedef struct SnListNode
{
void *data;
- struct LfListNode *next;
-} LfListNode;
+ struct SnListNode *next;
+} SnListNode;
-struct LfList
+struct SnList
{
- LfListNode *head;
+ SnListNode *head;
};
-static LfListNode*
-lf_list_node_alloc (void)
+static SnListNode*
+sn_list_node_alloc (void)
{
- return lf_new0 (LfListNode, 1);
+ return sn_new0 (SnListNode, 1);
}
-LfList*
-lf_list_new (void)
+SnList*
+sn_list_new (void)
{
- LfList *list;
+ SnList *list;
- list = lf_new (LfList, 1);
+ list = sn_new (SnList, 1);
list->head = NULL;
return list;
}
void
-lf_list_free (LfList *list)
+sn_list_free (SnList *list)
{
- LfListNode *node;
+ SnListNode *node;
node = list->head;
while (node != NULL)
{
- LfListNode *next = node->next;
+ SnListNode *next = node->next;
- lf_free (node);
+ sn_free (node);
node = next;
}
- lf_free (list);
+ sn_free (list);
}
void
-lf_list_prepend (LfList *list,
+sn_list_prepend (SnList *list,
void *data)
{
if (list->head == NULL)
{
- list->head = lf_list_node_alloc ();
+ list->head = sn_list_node_alloc ();
list->head->data = data;
}
else
{
- LfListNode *node;
+ SnListNode *node;
- node = lf_list_node_alloc ();
+ node = sn_list_node_alloc ();
node->data = data;
node->next = list->head;
list->head = node;
@@ -93,33 +93,33 @@ lf_list_prepend (LfList *list,
}
void
-lf_list_append (LfList *list,
+sn_list_append (SnList *list,
void *data)
{
if (list->head == NULL)
{
- list->head = lf_list_node_alloc ();
+ list->head = sn_list_node_alloc ();
list->head->data = data;
}
else
{
- LfListNode *node;
+ SnListNode *node;
node = list->head;
while (node->next != NULL)
node = node->next;
- node->next = lf_list_node_alloc ();
+ node->next = sn_list_node_alloc ();
node->next->data = data;
}
}
void
-lf_list_remove (LfList *list,
+sn_list_remove (SnList *list,
void *data)
{
- LfListNode *node;
- LfListNode *prev;
+ SnListNode *node;
+ SnListNode *prev;
prev = NULL;
node = list->head;
@@ -132,7 +132,7 @@ lf_list_remove (LfList *list,
else
list->head = node->next;
- lf_free (node);
+ sn_free (node);
return;
}
@@ -143,16 +143,16 @@ lf_list_remove (LfList *list,
}
void
-lf_list_foreach (LfList *list,
- LfListForeachFunc func,
+sn_list_foreach (SnList *list,
+ SnListForeachFunc func,
void *data)
{
- LfListNode *node;
+ SnListNode *node;
node = list->head;
while (node != NULL)
{
- LfListNode *next = node->next; /* reentrancy safety */
+ SnListNode *next = node->next; /* reentrancy safety */
if (!(* func) (node->data, data))
return;
@@ -161,8 +161,8 @@ lf_list_foreach (LfList *list,
}
}
-lf_bool_t
-lf_list_empty (LfList *list)
+sn_bool_t
+sn_list_empty (SnList *list)
{
return list->head == NULL;
}
diff --git a/libsn/sn-list.h b/libsn/sn-list.h
index 5a519bb..dfec5dd 100644
--- a/libsn/sn-list.h
+++ b/libsn/sn-list.h
@@ -24,32 +24,32 @@
*/
-#ifndef __LF_LIST_H__
-#define __LF_LIST_H__
+#ifndef __SN_LIST_H__
+#define __SN_LIST_H__
-#include <liblf/lf-util.h>
+#include <libsn/sn-util.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-/* FIXME use lf_internal prefix for all this */
+/* FIXME use sn_internal prefix for all this */
-typedef struct LfList LfList;
+typedef struct SnList SnList;
-typedef lf_bool_t (* LfListForeachFunc) (void *value, void *data);
+typedef sn_bool_t (* SnListForeachFunc) (void *value, void *data);
-LfList* lf_list_new (void);
-void lf_list_free (LfList *list);
-void lf_list_prepend (LfList *list,
+SnList* sn_list_new (void);
+void sn_list_free (SnList *list);
+void sn_list_prepend (SnList *list,
void *data);
-void lf_list_append (LfList *list,
+void sn_list_append (SnList *list,
void *data);
-void lf_list_remove (LfList *list,
+void sn_list_remove (SnList *list,
void *data);
-void lf_list_foreach (LfList *list,
- LfListForeachFunc func,
+void sn_list_foreach (SnList *list,
+ SnListForeachFunc func,
void *data);
-lf_bool_t lf_list_empty (LfList *list);
+sn_bool_t sn_list_empty (SnList *list);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_LIST_H__ */
+#endif /* __SN_LIST_H__ */
diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c
index 52a6134..c657114 100644
--- a/libsn/sn-monitor.c
+++ b/libsn/sn-monitor.c
@@ -21,40 +21,40 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "lf-monitor.h"
-#include "lf-internals.h"
-#include "lf-xmessages.h"
+#include "sn-monitor.h"
+#include "sn-internals.h"
+#include "sn-xmessages.h"
#define KDE_STARTUP_INFO_ATOM "_KDE_STARTUP_INFO"
-struct LfMonitorContext
+struct SnMonitorContext
{
int refcount;
- LfDisplay *display;
- LfMonitorEventFunc event_func;
+ SnDisplay *display;
+ SnMonitorEventFunc event_func;
void *event_func_data;
- LfFreeFunc free_data_func;
+ SnFreeFunc free_data_func;
/* a context doesn't get events for sequences
* started prior to context creation
*/
int creation_serial;
};
-struct LfMonitorEvent
+struct SnMonitorEvent
{
int refcount;
- LfMonitorEventType type;
- LfMonitorContext *context;
- LfLaunchSequence *sequence;
+ SnMonitorEventType type;
+ SnMonitorContext *context;
+ SnLaunchSequence *sequence;
Time timestamp;
};
-struct LfLaunchSequence
+struct SnLaunchSequence
{
int refcount;
char *id;
- LfDisplay *display;
+ SnDisplay *display;
/* launch_window is NULL for Xmessage-based launches */
Window launch_window;
@@ -85,44 +85,44 @@ struct LfLaunchSequence
int creation_serial;
};
-static LfList *context_list = NULL;
-static LfList *sequence_list = NULL;
+static SnList *context_list = NULL;
+static SnList *sequence_list = NULL;
static int next_sequence_serial = 0;
-static void xmessage_func (LfDisplay *display,
+static void xmessage_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data);
/**
- * lf_monitor_context_new:
- * @display: an #LfDisplay
+ * sn_monitor_context_new:
+ * @display: an #SnDisplay
* @event_func: function to call when an event is received
* @event_func_data: extra data to pass to @event_func
* @free_data_func: function to free @event_func_data when the context is freed
*
* Creates a new context for monitoring launch sequences. Normally
* only launch feedback indicator applications such as the window
- * manager or task manager would use #LfMonitorContext.
- * #LfLauncherContext and #LfLauncheeContext are more often used by
+ * manager or task manager would use #SnMonitorContext.
+ * #SnLauncherContext and #SnLauncheeContext are more often used by
* applications.
*
* To detect launch sequence initiations, PropertyChangeMask must be
- * selected on all root windows for a display. liblf does not do this
+ * selected on all root windows for a display. libsn does not do this
* for you because it's pretty likely to mess something up. So you
- * have to do it yourself in programs that use #LfMonitorContext.
+ * have to do it yourself in programs that use #SnMonitorContext.
*
- * Return value: a new #LfMonitorContext
+ * Return value: a new #SnMonitorContext
**/
-LfMonitorContext*
-lf_monitor_context_new (LfDisplay *display,
- LfMonitorEventFunc event_func,
+SnMonitorContext*
+sn_monitor_context_new (SnDisplay *display,
+ SnMonitorEventFunc event_func,
void *event_func_data,
- LfFreeFunc free_data_func)
+ SnFreeFunc free_data_func)
{
- LfMonitorContext *context;
+ SnMonitorContext *context;
- context = lf_new0 (LfMonitorContext, 1);
+ context = sn_new0 (SnMonitorContext, 1);
context->refcount = 1;
context->event_func = event_func;
@@ -130,18 +130,18 @@ lf_monitor_context_new (LfDisplay *display,
context->free_data_func = free_data_func;
context->display = display;
- lf_display_ref (context->display);
+ sn_display_ref (context->display);
if (context_list == NULL)
- context_list = lf_list_new ();
+ context_list = sn_list_new ();
- if (lf_list_empty (context_list))
- lf_internal_add_xmessage_func (display,
+ if (sn_list_empty (context_list))
+ sn_internal_add_xmessage_func (display,
KDE_STARTUP_INFO_ATOM,
xmessage_func,
NULL, NULL);
- lf_list_prepend (context_list, context);
+ sn_list_prepend (context_list, context);
/* We get events for serials >= creation_serial */
context->creation_serial = next_sequence_serial;
@@ -150,36 +150,36 @@ lf_monitor_context_new (LfDisplay *display,
}
/**
- * lf_monitor_context_ref:
- * @context: an #LfMonitorContext
+ * sn_monitor_context_ref:
+ * @context: an #SnMonitorContext
*
* Increments the reference count on @context.
*
**/
void
-lf_monitor_context_ref (LfMonitorContext *context)
+sn_monitor_context_ref (SnMonitorContext *context)
{
context->refcount += 1;
}
/**
- * lf_monitor_context_unref:
- * @context: an #LfMonitorContext
+ * sn_monitor_context_unref:
+ * @context: an #SnMonitorContext
*
* Decrements the reference count on @context and frees the
* context if the count reaches 0.
**/
void
-lf_monitor_context_unref (LfMonitorContext *context)
+sn_monitor_context_unref (SnMonitorContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
- lf_list_remove (context_list, context);
+ sn_list_remove (context_list, context);
- if (lf_list_empty (context_list))
- lf_internal_remove_xmessage_func (context->display,
+ if (sn_list_empty (context_list))
+ sn_internal_remove_xmessage_func (context->display,
KDE_STARTUP_INFO_ATOM,
xmessage_func,
NULL);
@@ -187,80 +187,80 @@ lf_monitor_context_unref (LfMonitorContext *context)
if (context->free_data_func)
(* context->free_data_func) (context->event_func_data);
- lf_display_unref (context->display);
- lf_free (context);
+ sn_display_unref (context->display);
+ sn_free (context);
}
}
void
-lf_monitor_event_ref (LfMonitorEvent *event)
+sn_monitor_event_ref (SnMonitorEvent *event)
{
event->refcount += 1;
}
void
-lf_monitor_event_unref (LfMonitorEvent *event)
+sn_monitor_event_unref (SnMonitorEvent *event)
{
event->refcount -= 1;
if (event->refcount == 0)
{
if (event->context)
- lf_monitor_context_unref (event->context);
+ sn_monitor_context_unref (event->context);
if (event->sequence)
- lf_launch_sequence_unref (event->sequence);
- lf_free (event);
+ sn_launch_sequence_unref (event->sequence);
+ sn_free (event);
}
}
-LfMonitorEvent*
-lf_monitor_event_copy (LfMonitorEvent *event)
+SnMonitorEvent*
+sn_monitor_event_copy (SnMonitorEvent *event)
{
- LfMonitorEvent *copy;
+ SnMonitorEvent *copy;
- copy = lf_new0 (LfMonitorEvent, 1);
+ copy = sn_new0 (SnMonitorEvent, 1);
copy->refcount = 1;
copy->type = event->type;
copy->context = event->context;
if (copy->context)
- lf_monitor_context_ref (copy->context);
+ sn_monitor_context_ref (copy->context);
copy->sequence = event->sequence;
if (copy->sequence)
- lf_launch_sequence_ref (copy->sequence);
+ sn_launch_sequence_ref (copy->sequence);
copy->timestamp = event->timestamp;
return copy;
}
-LfMonitorEventType
-lf_monitor_event_get_type (LfMonitorEvent *event)
+SnMonitorEventType
+sn_monitor_event_get_type (SnMonitorEvent *event)
{
return event->type;
}
-LfLaunchSequence*
-lf_monitor_event_get_launch_sequence (LfMonitorEvent *event)
+SnLaunchSequence*
+sn_monitor_event_get_launch_sequence (SnMonitorEvent *event)
{
return event->sequence;
}
-LfMonitorContext*
-lf_monitor_event_get_context (LfMonitorEvent *event)
+SnMonitorContext*
+sn_monitor_event_get_context (SnMonitorEvent *event)
{
return event->context;
}
Time
-lf_monitor_event_get_time (LfMonitorEvent *event)
+sn_monitor_event_get_time (SnMonitorEvent *event)
{
return event->timestamp;
}
static void
-update_geometry (LfLaunchSequence *sequence)
+update_geometry (SnLaunchSequence *sequence)
{
int *vals;
int n_vals;
@@ -269,7 +269,7 @@ update_geometry (LfLaunchSequence *sequence)
vals = NULL;
n_vals = 0;
- if (lf_internal_get_cardinal_list (sequence->display,
+ if (sn_internal_get_cardinal_list (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_GEOMETRY",
&vals, &n_vals) &&
@@ -281,29 +281,29 @@ update_geometry (LfLaunchSequence *sequence)
sequence->height = vals[3];
}
- lf_free (vals);
+ sn_free (vals);
}
static void
-update_pid (LfLaunchSequence *sequence)
+update_pid (SnLaunchSequence *sequence)
{
int val;
sequence->pid = -1;
val = -1;
- if (lf_internal_get_cardinal (sequence->display,
+ if (sn_internal_get_cardinal (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_PID",
&val))
sequence->pid = val;
}
-static LfLaunchSequence*
-lf_launch_sequence_new (LfDisplay *display,
+static SnLaunchSequence*
+sn_launch_sequence_new (SnDisplay *display,
Window launch_window)
{
- LfLaunchSequence *sequence;
+ SnLaunchSequence *sequence;
char *id;
int val;
@@ -314,21 +314,21 @@ lf_launch_sequence_new (LfDisplay *display,
*/
if (launch_window != None) /* launch_window may be NULL for xmessage sequence */
{
- lf_display_error_trap_push (display);
- XSelectInput (lf_display_get_x_display (display),
+ sn_display_error_trap_push (display);
+ XSelectInput (sn_display_get_x_display (display),
launch_window,
PropertyChangeMask | StructureNotifyMask);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
id = NULL;
- if (!lf_internal_get_string (display, launch_window,
+ if (!sn_internal_get_string (display, launch_window,
"_NET_LAUNCH_ID", &id))
{
return NULL;
}
}
- sequence = lf_new0 (LfLaunchSequence, 1);
+ sequence = sn_new0 (SnLaunchSequence, 1);
sequence->refcount = 1;
@@ -338,7 +338,7 @@ lf_launch_sequence_new (LfDisplay *display,
sequence->id = id;
sequence->launch_window = launch_window;
sequence->display = display;
- lf_display_ref (display);
+ sn_display_ref (display);
sequence->workspace = -1; /* not set */
sequence->pid = -1;
@@ -350,49 +350,49 @@ lf_launch_sequence_new (LfDisplay *display,
if (sequence->launch_window != None)
{
/* Grab all the stuff that can't be changed later */
- lf_internal_get_utf8_string (sequence->display,
+ sn_internal_get_utf8_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_NAME",
&sequence->name);
- lf_internal_get_utf8_string (sequence->display,
+ sn_internal_get_utf8_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_DESCRIPTION",
&sequence->description);
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_LEGACY_RESOURCE_CLASS",
&sequence->resource_class);
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_LEGACY_RESOURCE_NAME",
&sequence->resource_name);
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_LEGACY_NAME",
&sequence->window_title);
- if (lf_internal_get_cardinal (sequence->display,
+ if (sn_internal_get_cardinal (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_DESKTOP",
&val))
sequence->workspace = val;
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_BINARY_NAME",
&sequence->binary_name);
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_HOSTNAME",
&sequence->hostname);
- lf_internal_get_string (sequence->display,
+ sn_internal_get_string (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_ICON_NAME",
&sequence->icon_name);
- lf_internal_get_window (sequence->display,
+ sn_internal_get_window (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_GEOMETRY_WINDOW",
&sequence->geometry_window);
- if (lf_internal_get_cardinal (sequence->display,
+ if (sn_internal_get_cardinal (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_SUPPORTS_CANCEL",
&val))
@@ -403,48 +403,48 @@ lf_launch_sequence_new (LfDisplay *display,
}
void
-lf_launch_sequence_ref (LfLaunchSequence *sequence)
+sn_launch_sequence_ref (SnLaunchSequence *sequence)
{
sequence->refcount += 1;
}
void
-lf_launch_sequence_unref (LfLaunchSequence *sequence)
+sn_launch_sequence_unref (SnLaunchSequence *sequence)
{
sequence->refcount -= 1;
if (sequence->refcount == 0)
{
- lf_free (sequence->id);
-
- lf_free (sequence->name);
- lf_free (sequence->description);
- lf_free (sequence->resource_class);
- lf_free (sequence->resource_name);
- lf_free (sequence->window_title);
- lf_free (sequence->binary_name);
- lf_free (sequence->icon_name);
- lf_free (sequence->hostname);
+ sn_free (sequence->id);
+
+ sn_free (sequence->name);
+ sn_free (sequence->description);
+ sn_free (sequence->resource_class);
+ sn_free (sequence->resource_name);
+ sn_free (sequence->window_title);
+ sn_free (sequence->binary_name);
+ sn_free (sequence->icon_name);
+ sn_free (sequence->hostname);
- lf_display_unref (sequence->display);
- lf_free (sequence);
+ sn_display_unref (sequence->display);
+ sn_free (sequence);
}
}
const char*
-lf_launch_sequence_get_id (LfLaunchSequence *sequence)
+sn_launch_sequence_get_id (SnLaunchSequence *sequence)
{
return sequence->id;
}
Window
-lf_launch_sequence_get_window (LfLaunchSequence *sequence)
+sn_launch_sequence_get_window (SnLaunchSequence *sequence)
{
return sequence->launch_window;
}
-lf_bool_t
-lf_launch_sequence_get_geometry (LfLaunchSequence *sequence,
+sn_bool_t
+sn_launch_sequence_get_geometry (SnLaunchSequence *sequence,
int *x,
int *y,
int *width,
@@ -469,124 +469,124 @@ lf_launch_sequence_get_geometry (LfLaunchSequence *sequence,
}
Window
-lf_launch_sequence_get_geometry_window (LfLaunchSequence *sequence)
+sn_launch_sequence_get_geometry_window (SnLaunchSequence *sequence)
{
return sequence->geometry_window;
}
-lf_bool_t
-lf_launch_sequence_get_completed (LfLaunchSequence *sequence)
+sn_bool_t
+sn_launch_sequence_get_completed (SnLaunchSequence *sequence)
{
return sequence->completed;
}
-lf_bool_t
-lf_launch_sequence_get_canceled (LfLaunchSequence *sequence)
+sn_bool_t
+sn_launch_sequence_get_canceled (SnLaunchSequence *sequence)
{
return sequence->canceled;
}
const char*
-lf_launch_sequence_get_name (LfLaunchSequence *sequence)
+sn_launch_sequence_get_name (SnLaunchSequence *sequence)
{
return sequence->name;
}
const char*
-lf_launch_sequence_get_description (LfLaunchSequence *sequence)
+sn_launch_sequence_get_description (SnLaunchSequence *sequence)
{
return sequence->description;
}
int
-lf_launch_sequence_get_workspace (LfLaunchSequence *sequence)
+sn_launch_sequence_get_workspace (SnLaunchSequence *sequence)
{
return sequence->workspace;
}
const char*
-lf_launch_sequence_get_legacy_resource_class (LfLaunchSequence *sequence)
+sn_launch_sequence_get_legacy_resource_class (SnLaunchSequence *sequence)
{
return sequence->resource_class;
}
const char*
-lf_launch_sequence_get_legacy_resource_name (LfLaunchSequence *sequence)
+sn_launch_sequence_get_legacy_resource_name (SnLaunchSequence *sequence)
{
return sequence->resource_name;
}
const char*
-lf_launch_sequence_get_legacy_window_title (LfLaunchSequence *sequence)
+sn_launch_sequence_get_legacy_window_title (SnLaunchSequence *sequence)
{
return sequence->window_title;
}
-lf_bool_t
-lf_launch_sequence_get_supports_cancel (LfLaunchSequence *sequence)
+sn_bool_t
+sn_launch_sequence_get_supports_cancel (SnLaunchSequence *sequence)
{
return sequence->supports_cancel;
}
int
-lf_launch_sequence_get_pid (LfLaunchSequence *sequence)
+sn_launch_sequence_get_pid (SnLaunchSequence *sequence)
{
return sequence->pid;
}
const char*
-lf_launch_sequence_get_binary_name (LfLaunchSequence *sequence)
+sn_launch_sequence_get_binary_name (SnLaunchSequence *sequence)
{
return sequence->binary_name;
}
const char*
-lf_launch_sequence_get_hostname (LfLaunchSequence *sequence)
+sn_launch_sequence_get_hostname (SnLaunchSequence *sequence)
{
return sequence->hostname;
}
const char*
-lf_launch_sequence_get_icon_name (LfLaunchSequence *sequence)
+sn_launch_sequence_get_icon_name (SnLaunchSequence *sequence)
{
return sequence->icon_name;
}
void
-lf_launch_sequence_cancel (LfLaunchSequence *sequence)
+sn_launch_sequence_cancel (SnLaunchSequence *sequence)
{
if (sequence->supports_cancel)
- lf_internal_set_cardinal (sequence->display,
+ sn_internal_set_cardinal (sequence->display,
sequence->launch_window,
"_NET_LAUNCH_CANCELED",
0);
}
-static lf_bool_t
-check_cardinal_exists (LfDisplay *display,
+static sn_bool_t
+check_cardinal_exists (SnDisplay *display,
Window xwindow,
const char *property)
{
int val;
- return lf_internal_get_cardinal (display, xwindow, property,
+ return sn_internal_get_cardinal (display, xwindow, property,
&val);
}
typedef struct
{
- LfMonitorEvent *base_event;
- LfList *events;
+ SnMonitorEvent *base_event;
+ SnList *events;
} CreateContextEventsData;
-static lf_bool_t
+static sn_bool_t
create_context_events_foreach (void *value,
void *data)
{
/* Make a list of events holding a ref to the context they'll go to,
* for reentrancy robustness
*/
- LfMonitorContext *context = value;
+ SnMonitorContext *context = value;
CreateContextEventsData *ced = data;
/* Don't send events for launch sequences initiated before the
@@ -595,23 +595,23 @@ create_context_events_foreach (void *value,
if (ced->base_event->sequence->creation_serial >=
context->creation_serial)
{
- LfMonitorEvent *copy;
+ SnMonitorEvent *copy;
- copy = lf_monitor_event_copy (ced->base_event);
+ copy = sn_monitor_event_copy (ced->base_event);
copy->context = context;
- lf_monitor_context_ref (copy->context);
+ sn_monitor_context_ref (copy->context);
- lf_list_prepend (ced->events, copy);
+ sn_list_prepend (ced->events, copy);
}
return TRUE;
}
-static lf_bool_t
+static sn_bool_t
dispatch_event_foreach (void *value,
void *data)
{
- LfMonitorEvent *event = value;
+ SnMonitorEvent *event = value;
/* Dispatch and free events */
@@ -619,22 +619,22 @@ dispatch_event_foreach (void *value,
(* event->context->event_func) (event,
event->context->event_func_data);
- lf_monitor_event_unref (event);
+ sn_monitor_event_unref (event);
return TRUE;
}
-static lf_bool_t
-filter_event (LfMonitorEvent *event)
+static sn_bool_t
+filter_event (SnMonitorEvent *event)
{
- lf_bool_t retval;
+ sn_bool_t retval;
retval = FALSE;
/* Filter out duplicate events and update flags */
switch (event->type)
{
- case LF_MONITOR_EVENT_CANCELED:
+ case SN_MONITOR_EVENT_CANCELED:
if (event->sequence->canceled)
{
retval = TRUE;
@@ -644,7 +644,7 @@ filter_event (LfMonitorEvent *event)
event->sequence->canceled = TRUE;
}
break;
- case LF_MONITOR_EVENT_COMPLETED:
+ case SN_MONITOR_EVENT_COMPLETED:
if (event->sequence->completed)
{
retval = TRUE;
@@ -664,21 +664,21 @@ filter_event (LfMonitorEvent *event)
typedef struct
{
- LfDisplay *display;
+ SnDisplay *display;
Window launch_window;
- LfLaunchSequence *found;
+ SnLaunchSequence *found;
} FindSequenceData;
-static lf_bool_t
+static sn_bool_t
find_sequence_foreach (void *value,
void *data)
{
- LfLaunchSequence *sequence = value;
+ SnLaunchSequence *sequence = value;
FindSequenceData *fsd = data;
if (sequence->launch_window == fsd->launch_window &&
- lf_display_get_x_display (sequence->display) ==
- lf_display_get_x_display (fsd->display))
+ sn_display_get_x_display (sequence->display) ==
+ sn_display_get_x_display (fsd->display))
{
fsd->found = sequence;
return FALSE;
@@ -687,8 +687,8 @@ find_sequence_foreach (void *value,
return TRUE;
}
-static LfLaunchSequence*
-find_sequence_for_window (LfDisplay *display,
+static SnLaunchSequence*
+find_sequence_for_window (SnDisplay *display,
Window event_window)
{
FindSequenceData fsd;
@@ -700,44 +700,44 @@ find_sequence_for_window (LfDisplay *display,
fsd.launch_window = event_window;
fsd.found = NULL;
- lf_list_foreach (sequence_list, find_sequence_foreach, &fsd);
+ sn_list_foreach (sequence_list, find_sequence_foreach, &fsd);
return fsd.found;
}
-static LfLaunchSequence*
-add_sequence (LfDisplay *display,
+static SnLaunchSequence*
+add_sequence (SnDisplay *display,
Window event_xwindow)
{
- LfLaunchSequence *sequence;
+ SnLaunchSequence *sequence;
sequence =
- lf_launch_sequence_new (display, event_xwindow);
+ sn_launch_sequence_new (display, event_xwindow);
if (sequence)
{
- lf_launch_sequence_ref (sequence); /* ref held by sequence list */
+ sn_launch_sequence_ref (sequence); /* ref held by sequence list */
if (sequence_list == NULL)
- sequence_list = lf_list_new ();
- lf_list_prepend (sequence_list, sequence);
+ sequence_list = sn_list_new ();
+ sn_list_prepend (sequence_list, sequence);
}
return sequence;
}
static void
-remove_sequence (LfLaunchSequence *sequence)
+remove_sequence (SnLaunchSequence *sequence)
{
- lf_list_remove (sequence_list, sequence);
- lf_launch_sequence_unref (sequence);
+ sn_list_remove (sequence_list, sequence);
+ sn_launch_sequence_unref (sequence);
}
static void
-dispatch_monitor_event (LfDisplay *display,
- LfMonitorEvent *event,
+dispatch_monitor_event (SnDisplay *display,
+ SnMonitorEvent *event,
Window event_xwindow)
{
- if (event->type == LF_MONITOR_EVENT_INITIATED)
+ if (event->type == SN_MONITOR_EVENT_INITIATED)
{
if (event->sequence == NULL)
event->sequence = add_sequence (display, event_xwindow);
@@ -747,18 +747,18 @@ dispatch_monitor_event (LfDisplay *display,
event->sequence = find_sequence_for_window (display,
event_xwindow);
if (event->sequence)
- lf_launch_sequence_ref (event->sequence); /* ref held by event */
+ sn_launch_sequence_ref (event->sequence); /* ref held by event */
}
if (event->sequence != NULL)
{
switch (event->type)
{
- case LF_MONITOR_EVENT_GEOMETRY_CHANGED:
+ case SN_MONITOR_EVENT_GEOMETRY_CHANGED:
update_geometry (event->sequence);
break;
- case LF_MONITOR_EVENT_PID_CHANGED:
+ case SN_MONITOR_EVENT_PID_CHANGED:
update_pid (event->sequence);
break;
@@ -773,32 +773,32 @@ dispatch_monitor_event (LfDisplay *display,
CreateContextEventsData cced;
cced.base_event = event;
- cced.events = lf_list_new ();
+ cced.events = sn_list_new ();
- lf_list_foreach (context_list, create_context_events_foreach,
+ sn_list_foreach (context_list, create_context_events_foreach,
&cced);
- lf_list_foreach (cced.events, dispatch_event_foreach, NULL);
+ sn_list_foreach (cced.events, dispatch_event_foreach, NULL);
/* values in the events list freed on dispatch */
- lf_list_free (cced.events);
+ sn_list_free (cced.events);
/* remove from sequence list */
- if (event->type == LF_MONITOR_EVENT_COMPLETED)
+ if (event->type == SN_MONITOR_EVENT_COMPLETED)
remove_sequence (event->sequence);
}
}
-lf_bool_t
-lf_internal_monitor_process_event (LfDisplay *display,
+sn_bool_t
+sn_internal_monitor_process_event (SnDisplay *display,
XEvent *xevent)
{
- lf_bool_t retval;
- LfMonitorEvent *event;
+ sn_bool_t retval;
+ SnMonitorEvent *event;
Window event_xwindow;
if (context_list == NULL ||
- lf_list_empty (context_list))
+ sn_list_empty (context_list))
return FALSE; /* no one cares */
event_xwindow = None;
@@ -809,17 +809,17 @@ lf_internal_monitor_process_event (LfDisplay *display,
{
case PropertyNotify:
if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_CANCELED"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_CANCELED"))
{
event_xwindow = xevent->xproperty.window;
if (check_cardinal_exists (display, event_xwindow,
"_NET_LAUNCH_CANCELED"))
{
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_CANCELED;
+ event->type = SN_MONITOR_EVENT_CANCELED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
event->sequence = NULL;
@@ -828,17 +828,17 @@ lf_internal_monitor_process_event (LfDisplay *display,
}
}
else if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_COMPLETE"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_COMPLETE"))
{
event_xwindow = xevent->xproperty.window;
if (check_cardinal_exists (display, event_xwindow,
"_NET_LAUNCH_COMPLETE"))
{
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_COMPLETED;
+ event->type = SN_MONITOR_EVENT_COMPLETED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
event->sequence = NULL;
@@ -847,14 +847,14 @@ lf_internal_monitor_process_event (LfDisplay *display,
}
}
else if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_GEOMETRY"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_GEOMETRY"))
{
event_xwindow = xevent->xproperty.window;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_GEOMETRY_CHANGED;
+ event->type = SN_MONITOR_EVENT_GEOMETRY_CHANGED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
event->sequence = NULL;
@@ -862,14 +862,14 @@ lf_internal_monitor_process_event (LfDisplay *display,
retval = TRUE;
}
else if (xevent->xproperty.atom ==
- lf_internal_atom_get (display, "_NET_LAUNCH_PID"))
+ sn_internal_atom_get (display, "_NET_LAUNCH_PID"))
{
event_xwindow = xevent->xproperty.window;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_PID_CHANGED;
+ event->type = SN_MONITOR_EVENT_PID_CHANGED;
event->timestamp = xevent->xproperty.time;
event->context = NULL;
event->sequence = NULL;
@@ -880,15 +880,15 @@ lf_internal_monitor_process_event (LfDisplay *display,
case ClientMessage:
if (xevent->xclient.message_type ==
- lf_internal_atom_get (display,
+ sn_internal_atom_get (display,
"_NET_LAUNCH_PULSE"))
{
event_xwindow = xevent->xclient.window;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_PULSE;
+ event->type = SN_MONITOR_EVENT_PULSE;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = NULL;
@@ -896,10 +896,10 @@ lf_internal_monitor_process_event (LfDisplay *display,
retval = TRUE;
}
else if (xevent->xclient.message_type ==
- lf_internal_atom_get (display,
+ sn_internal_atom_get (display,
"_NET_LAUNCH_INITIATE"))
{
- LfLaunchSequence *sequence;
+ SnLaunchSequence *sequence;
/* Don't be fooled by duplicate initiate messages -
* check that the sequence doesn't exist yet
@@ -911,10 +911,10 @@ lf_internal_monitor_process_event (LfDisplay *display,
{
event_xwindow = xevent->xclient.window;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_INITIATED;
+ event->type = SN_MONITOR_EVENT_INITIATED;
event->timestamp = xevent->xclient.data.l[0];
event->context = NULL;
event->sequence = NULL;
@@ -926,7 +926,7 @@ lf_internal_monitor_process_event (LfDisplay *display,
case DestroyNotify:
{
- LfLaunchSequence *sequence;
+ SnLaunchSequence *sequence;
sequence = find_sequence_for_window (display,
xevent->xdestroywindow.window);
@@ -935,14 +935,14 @@ lf_internal_monitor_process_event (LfDisplay *display,
{
event_xwindow = xevent->xdestroywindow.window;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_COMPLETED;
+ event->type = SN_MONITOR_EVENT_COMPLETED;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = sequence;
- lf_launch_sequence_ref (sequence);
+ sn_launch_sequence_ref (sequence);
}
}
break;
@@ -955,7 +955,7 @@ lf_internal_monitor_process_event (LfDisplay *display,
{
dispatch_monitor_event (display, event, event_xwindow);
- lf_monitor_event_unref (event);
+ sn_monitor_event_unref (event);
}
return retval;
@@ -963,21 +963,21 @@ lf_internal_monitor_process_event (LfDisplay *display,
typedef struct
{
- LfDisplay *display;
+ SnDisplay *display;
const char *id;
- LfLaunchSequence *found;
+ SnLaunchSequence *found;
} FindSequenceByIdData;
-static lf_bool_t
+static sn_bool_t
find_sequence_by_id_foreach (void *value,
void *data)
{
- LfLaunchSequence *sequence = value;
+ SnLaunchSequence *sequence = value;
FindSequenceByIdData *fsd = data;
if (strcmp (sequence->id, fsd->id) == 0 &&
- lf_display_get_x_display (sequence->display) ==
- lf_display_get_x_display (fsd->display))
+ sn_display_get_x_display (sequence->display) ==
+ sn_display_get_x_display (fsd->display))
{
fsd->found = sequence;
return FALSE;
@@ -986,8 +986,8 @@ find_sequence_by_id_foreach (void *value,
return TRUE;
}
-static LfLaunchSequence*
-find_sequence_for_id (LfDisplay *display,
+static SnLaunchSequence*
+find_sequence_for_id (SnDisplay *display,
const char *id)
{
FindSequenceByIdData fsd;
@@ -999,33 +999,33 @@ find_sequence_for_id (LfDisplay *display,
fsd.id = id;
fsd.found = NULL;
- lf_list_foreach (sequence_list, find_sequence_by_id_foreach, &fsd);
+ sn_list_foreach (sequence_list, find_sequence_by_id_foreach, &fsd);
return fsd.found;
}
-static lf_bool_t
+static sn_bool_t
do_xmessage_event_foreach (void *value,
void *data)
{
- LfMonitorEvent *event = value;
- LfDisplay *display = data;
+ SnMonitorEvent *event = value;
+ SnDisplay *display = data;
dispatch_monitor_event (display, event, None);
return TRUE;
}
-static lf_bool_t
+static sn_bool_t
unref_event_foreach (void *value,
void *data)
{
- lf_monitor_event_unref (value);
+ sn_monitor_event_unref (value);
return TRUE;
}
static void
-xmessage_func (LfDisplay *display,
+xmessage_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data)
@@ -1036,13 +1036,13 @@ xmessage_func (LfDisplay *display,
char **values;
int i;
const char *launch_id;
- LfLaunchSequence *sequence;
- LfList *events;
+ SnLaunchSequence *sequence;
+ SnList *events;
prefix = NULL;
names = NULL;
values = NULL;
- if (!lf_internal_unserialize_message (message, &prefix, &names, &values))
+ if (!sn_internal_unserialize_message (message, &prefix, &names, &values))
return;
launch_id = NULL;
@@ -1057,7 +1057,7 @@ xmessage_func (LfDisplay *display,
++i;
}
- events = lf_list_new ();
+ events = sn_list_new ();
if (launch_id == NULL)
goto out;
@@ -1068,23 +1068,23 @@ xmessage_func (LfDisplay *display,
{
if (sequence == NULL)
{
- LfMonitorEvent *event;
+ SnMonitorEvent *event;
sequence = add_sequence (display, None);
if (sequence == NULL)
goto out;
- sequence->id = lf_internal_strdup (launch_id);
+ sequence->id = sn_internal_strdup (launch_id);
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_INITIATED;
+ event->type = SN_MONITOR_EVENT_INITIATED;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = sequence; /* ref from add_sequence goes here */
- lf_list_append (events, event);
+ sn_list_append (events, event);
}
}
@@ -1094,9 +1094,9 @@ xmessage_func (LfDisplay *display,
if (strcmp (prefix, "change") == 0 ||
strcmp (prefix, "new") == 0)
{
- lf_bool_t random_stuff_changed = FALSE;
- lf_bool_t pid_changed = FALSE;
- lf_bool_t workspace_changed = FALSE;
+ sn_bool_t random_stuff_changed = FALSE;
+ sn_bool_t pid_changed = FALSE;
+ sn_bool_t workspace_changed = FALSE;
i = 0;
while (names[i])
@@ -1105,7 +1105,7 @@ xmessage_func (LfDisplay *display,
{
if (sequence->binary_name == NULL)
{
- sequence->binary_name = lf_internal_strdup (values[i]);
+ sequence->binary_name = sn_internal_strdup (values[i]);
random_stuff_changed = TRUE;
}
}
@@ -1113,7 +1113,7 @@ xmessage_func (LfDisplay *display,
{
if (sequence->name == NULL)
{
- sequence->name = lf_internal_strdup (values[i]);
+ sequence->name = sn_internal_strdup (values[i]);
random_stuff_changed = TRUE;
}
}
@@ -1121,7 +1121,7 @@ xmessage_func (LfDisplay *display,
{
if (sequence->icon_name == NULL)
{
- sequence->icon_name = lf_internal_strdup (values[i]);
+ sequence->icon_name = sn_internal_strdup (values[i]);
random_stuff_changed = TRUE;
}
}
@@ -1129,7 +1129,7 @@ xmessage_func (LfDisplay *display,
{
int workspace;
- workspace = lf_internal_string_to_ulong (values[i]);
+ workspace = sn_internal_string_to_ulong (values[i]);
sequence->workspace = workspace;
workspace_changed = TRUE;
@@ -1138,7 +1138,7 @@ xmessage_func (LfDisplay *display,
{
if (sequence->resource_class == NULL)
{
- sequence->resource_class = lf_internal_strdup (values[i]);
+ sequence->resource_class = sn_internal_strdup (values[i]);
random_stuff_changed = TRUE;
}
}
@@ -1146,7 +1146,7 @@ xmessage_func (LfDisplay *display,
{
int pid;
- pid = lf_internal_string_to_ulong (values[i]);
+ pid = sn_internal_string_to_ulong (values[i]);
if (pid > 0)
{
@@ -1159,7 +1159,7 @@ xmessage_func (LfDisplay *display,
{
if (sequence->hostname == NULL)
{
- sequence->hostname = lf_internal_strdup (values[i]);
+ sequence->hostname = sn_internal_strdup (values[i]);
random_stuff_changed = TRUE;
}
}
@@ -1169,34 +1169,34 @@ xmessage_func (LfDisplay *display,
if (pid_changed)
{
- LfMonitorEvent *event;
+ SnMonitorEvent *event;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_PID_CHANGED;
+ event->type = SN_MONITOR_EVENT_PID_CHANGED;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = sequence;
- lf_launch_sequence_ref (sequence);
+ sn_launch_sequence_ref (sequence);
- lf_list_append (events, event);
+ sn_list_append (events, event);
}
if (workspace_changed)
{
- LfMonitorEvent *event;
+ SnMonitorEvent *event;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_WORKSPACE_CHANGED;
+ event->type = SN_MONITOR_EVENT_WORKSPACE_CHANGED;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = sequence;
- lf_launch_sequence_ref (sequence);
+ sn_launch_sequence_ref (sequence);
- lf_list_append (events, event);
+ sn_list_append (events, event);
}
if (random_stuff_changed)
@@ -1206,32 +1206,32 @@ xmessage_func (LfDisplay *display,
}
else if (strcmp (prefix, "remove") == 0)
{
- LfMonitorEvent *event;
+ SnMonitorEvent *event;
- event = lf_new (LfMonitorEvent, 1);
+ event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
- event->type = LF_MONITOR_EVENT_COMPLETED;
+ event->type = SN_MONITOR_EVENT_COMPLETED;
event->timestamp = CurrentTime;
event->context = NULL;
event->sequence = sequence;
- lf_launch_sequence_ref (sequence);
+ sn_launch_sequence_ref (sequence);
- lf_list_append (events, event);
+ sn_list_append (events, event);
}
- lf_list_foreach (events,
+ sn_list_foreach (events,
do_xmessage_event_foreach,
display);
out:
if (events != NULL)
{
- lf_list_foreach (events, unref_event_foreach, NULL);
- lf_list_free (events);
+ sn_list_foreach (events, unref_event_foreach, NULL);
+ sn_list_free (events);
}
- lf_free (prefix);
- lf_internal_strfreev (names);
- lf_internal_strfreev (values);
+ sn_free (prefix);
+ sn_internal_strfreev (names);
+ sn_internal_strfreev (values);
}
diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h
index e9efdd9..9f799c5 100644
--- a/libsn/sn-monitor.h
+++ b/libsn/sn-monitor.h
@@ -24,74 +24,74 @@
*/
-#ifndef __LF_MONITOR_H__
-#define __LF_MONITOR_H__
+#ifndef __SN_MONITOR_H__
+#define __SN_MONITOR_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef struct LfMonitorContext LfMonitorContext;
-typedef struct LfMonitorEvent LfMonitorEvent;
-typedef struct LfLaunchSequence LfLaunchSequence;
+typedef struct SnMonitorContext SnMonitorContext;
+typedef struct SnMonitorEvent SnMonitorEvent;
+typedef struct SnLaunchSequence SnLaunchSequence;
-typedef void (* LfMonitorEventFunc) (LfMonitorEvent *event,
+typedef void (* SnMonitorEventFunc) (SnMonitorEvent *event,
void *user_data);
typedef enum
{
- LF_MONITOR_EVENT_INITIATED,
- LF_MONITOR_EVENT_COMPLETED,
- LF_MONITOR_EVENT_CANCELED,
- LF_MONITOR_EVENT_PULSE,
- LF_MONITOR_EVENT_GEOMETRY_CHANGED,
- LF_MONITOR_EVENT_PID_CHANGED,
+ SN_MONITOR_EVENT_INITIATED,
+ SN_MONITOR_EVENT_COMPLETED,
+ SN_MONITOR_EVENT_CANCELED,
+ SN_MONITOR_EVENT_PULSE,
+ SN_MONITOR_EVENT_GEOMETRY_CHANGED,
+ SN_MONITOR_EVENT_PID_CHANGED,
/* only allowed with xmessages protocol */
- LF_MONITOR_EVENT_WORKSPACE_CHANGED
-} LfMonitorEventType;
+ SN_MONITOR_EVENT_WORKSPACE_CHANGED
+} SnMonitorEventType;
-LfMonitorContext* lf_monitor_context_new (LfDisplay *display,
- LfMonitorEventFunc event_func,
+SnMonitorContext* sn_monitor_context_new (SnDisplay *display,
+ SnMonitorEventFunc event_func,
void *event_func_data,
- LfFreeFunc free_data_func);
-void lf_monitor_context_ref (LfMonitorContext *context);
-void lf_monitor_context_unref (LfMonitorContext *context);
+ SnFreeFunc free_data_func);
+void sn_monitor_context_ref (SnMonitorContext *context);
+void sn_monitor_context_unref (SnMonitorContext *context);
-void lf_monitor_event_ref (LfMonitorEvent *event);
-void lf_monitor_event_unref (LfMonitorEvent *event);
-LfMonitorEvent* lf_monitor_event_copy (LfMonitorEvent *event);
-LfMonitorEventType lf_monitor_event_get_type (LfMonitorEvent *event);
-LfLaunchSequence* lf_monitor_event_get_launch_sequence (LfMonitorEvent *event);
-LfMonitorContext* lf_monitor_event_get_context (LfMonitorEvent *event);
-Time lf_monitor_event_get_time (LfMonitorEvent *event);
+void sn_monitor_event_ref (SnMonitorEvent *event);
+void sn_monitor_event_unref (SnMonitorEvent *event);
+SnMonitorEvent* sn_monitor_event_copy (SnMonitorEvent *event);
+SnMonitorEventType sn_monitor_event_get_type (SnMonitorEvent *event);
+SnLaunchSequence* sn_monitor_event_get_launch_sequence (SnMonitorEvent *event);
+SnMonitorContext* sn_monitor_event_get_context (SnMonitorEvent *event);
+Time sn_monitor_event_get_time (SnMonitorEvent *event);
-void lf_launch_sequence_ref (LfLaunchSequence *sequence);
-void lf_launch_sequence_unref (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_id (LfLaunchSequence *sequence);
-Window lf_launch_sequence_get_window (LfLaunchSequence *sequence);
-lf_bool_t lf_launch_sequence_get_geometry (LfLaunchSequence *sequence,
+void sn_launch_sequence_ref (SnLaunchSequence *sequence);
+void sn_launch_sequence_unref (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_id (SnLaunchSequence *sequence);
+Window sn_launch_sequence_get_window (SnLaunchSequence *sequence);
+sn_bool_t sn_launch_sequence_get_geometry (SnLaunchSequence *sequence,
int *x,
int *y,
int *width,
int *height);
-Window lf_launch_sequence_get_geometry_window (LfLaunchSequence *sequence);
-lf_bool_t lf_launch_sequence_get_completed (LfLaunchSequence *sequence);
-lf_bool_t lf_launch_sequence_get_canceled (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_name (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_description (LfLaunchSequence *sequence);
-int lf_launch_sequence_get_workspace (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_legacy_resource_class (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_legacy_resource_name (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_legacy_window_title (LfLaunchSequence *sequence);
-lf_bool_t lf_launch_sequence_get_supports_cancel (LfLaunchSequence *sequence);
-int lf_launch_sequence_get_pid (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_binary_name (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_hostname (LfLaunchSequence *sequence);
-const char* lf_launch_sequence_get_icon_name (LfLaunchSequence *sequence);
+Window sn_launch_sequence_get_geometry_window (SnLaunchSequence *sequence);
+sn_bool_t sn_launch_sequence_get_completed (SnLaunchSequence *sequence);
+sn_bool_t sn_launch_sequence_get_canceled (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_name (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_description (SnLaunchSequence *sequence);
+int sn_launch_sequence_get_workspace (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_legacy_resource_class (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_legacy_resource_name (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_legacy_window_title (SnLaunchSequence *sequence);
+sn_bool_t sn_launch_sequence_get_supports_cancel (SnLaunchSequence *sequence);
+int sn_launch_sequence_get_pid (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_binary_name (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_hostname (SnLaunchSequence *sequence);
+const char* sn_launch_sequence_get_icon_name (SnLaunchSequence *sequence);
-void lf_launch_sequence_cancel (LfLaunchSequence *sequence);
+void sn_launch_sequence_cancel (SnLaunchSequence *sequence);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_MONITOR_H__ */
+#endif /* __SN_MONITOR_H__ */
diff --git a/libsn/sn-util.c b/libsn/sn-util.c
index 7a07b26..89ef913 100644
--- a/libsn/sn-util.c
+++ b/libsn/sn-util.c
@@ -18,8 +18,8 @@
*/
#include <config.h>
-#include "lf-util.h"
-#include "lf-internals.h"
+#include "sn-util.h"
+#include "sn-internals.h"
#include <stdlib.h>
#include <stdio.h>
@@ -29,7 +29,7 @@
#ifndef REALLOC_0_WORKS
static void*
standard_realloc (void* mem,
- lf_size_t n_bytes)
+ sn_size_t n_bytes)
{
if (!mem)
return malloc (n_bytes);
@@ -49,14 +49,14 @@ standard_realloc (void* mem,
# define standard_try_realloc realloc
#else /* !SANE_MALLOC_PROTOS */
static void*
-standard_malloc (lf_size_t n_bytes)
+standard_malloc (sn_size_t n_bytes)
{
return malloc (n_bytes);
}
# ifdef REALLOC_0_WORKS
static void*
standard_realloc (void* mem,
- lf_size_t n_bytes)
+ sn_size_t n_bytes)
{
return realloc (mem, n_bytes);
}
@@ -67,8 +67,8 @@ standard_free (void* mem)
free (mem);
}
static void*
-standard_calloc (lf_size_t n_blocks,
- lf_size_t n_bytes)
+standard_calloc (sn_size_t n_blocks,
+ sn_size_t n_bytes)
{
return calloc (n_blocks, n_bytes);
}
@@ -78,7 +78,7 @@ standard_calloc (lf_size_t n_blocks,
/* --- variables --- */
-static LfMemVTable lf_mem_vtable = {
+static SnMemVTable sn_mem_vtable = {
standard_malloc,
standard_realloc,
standard_free,
@@ -92,18 +92,18 @@ static LfMemVTable lf_mem_vtable = {
/* --- functions --- */
void*
-lf_malloc (lf_size_t n_bytes)
+sn_malloc (sn_size_t n_bytes)
{
if (n_bytes)
{
void* mem;
- mem = lf_mem_vtable.malloc (n_bytes);
+ mem = sn_mem_vtable.malloc (n_bytes);
if (mem)
return mem;
fprintf (stderr,
- "liblf: failed to allocate %lu bytes",
+ "libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
@@ -111,18 +111,18 @@ lf_malloc (lf_size_t n_bytes)
}
void*
-lf_malloc0 (lf_size_t n_bytes)
+sn_malloc0 (sn_size_t n_bytes)
{
if (n_bytes)
{
void* mem;
- mem = lf_mem_vtable.calloc (1, n_bytes);
+ mem = sn_mem_vtable.calloc (1, n_bytes);
if (mem)
return mem;
fprintf (stderr,
- "liblf: failed to allocate %lu bytes",
+ "libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
@@ -130,61 +130,61 @@ lf_malloc0 (lf_size_t n_bytes)
}
void*
-lf_realloc (void *mem,
- lf_size_t n_bytes)
+sn_realloc (void *mem,
+ sn_size_t n_bytes)
{
if (n_bytes)
{
- mem = lf_mem_vtable.realloc (mem, n_bytes);
+ mem = sn_mem_vtable.realloc (mem, n_bytes);
if (mem)
return mem;
fprintf (stderr,
- "liblf: failed to allocate %lu bytes",
+ "libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
if (mem)
- lf_mem_vtable.free (mem);
+ sn_mem_vtable.free (mem);
return NULL;
}
void
-lf_free (void* mem)
+sn_free (void* mem)
{
if (mem)
- lf_mem_vtable.free (mem);
+ sn_mem_vtable.free (mem);
}
void*
-lf_try_malloc (lf_size_t n_bytes)
+sn_try_malloc (sn_size_t n_bytes)
{
if (n_bytes)
- return lf_mem_vtable.try_malloc (n_bytes);
+ return sn_mem_vtable.try_malloc (n_bytes);
else
return NULL;
}
void*
-lf_try_realloc (void *mem,
- lf_size_t n_bytes)
+sn_try_realloc (void *mem,
+ sn_size_t n_bytes)
{
if (n_bytes)
- return lf_mem_vtable.try_realloc (mem, n_bytes);
+ return sn_mem_vtable.try_realloc (mem, n_bytes);
if (mem)
- lf_mem_vtable.free (mem);
+ sn_mem_vtable.free (mem);
return NULL;
}
static void*
-fallback_calloc (lf_size_t n_blocks,
- lf_size_t n_block_bytes)
+fallback_calloc (sn_size_t n_blocks,
+ sn_size_t n_block_bytes)
{
- lf_size_t l = n_blocks * n_block_bytes;
- void* mem = lf_mem_vtable.malloc (l);
+ sn_size_t l = n_blocks * n_block_bytes;
+ void* mem = sn_mem_vtable.malloc (l);
if (mem)
memset (mem, 0, l);
@@ -192,52 +192,52 @@ fallback_calloc (lf_size_t n_blocks,
return mem;
}
-static lf_bool_t vtable_set = FALSE;
+static sn_bool_t vtable_set = FALSE;
-lf_bool_t
-lf_mem_is_system_malloc (void)
+sn_bool_t
+sn_mem_is_system_malloc (void)
{
return !vtable_set;
}
void
-lf_mem_set_vtable (LfMemVTable *vtable)
+sn_mem_set_vtable (SnMemVTable *vtable)
{
if (!vtable_set)
{
vtable_set = TRUE;
if (vtable->malloc && vtable->realloc && vtable->free)
{
- lf_mem_vtable.malloc = vtable->malloc;
- lf_mem_vtable.realloc = vtable->realloc;
- lf_mem_vtable.free = vtable->free;
- lf_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc;
- lf_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : lf_mem_vtable.malloc;
- lf_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : lf_mem_vtable.realloc;
+ sn_mem_vtable.malloc = vtable->malloc;
+ sn_mem_vtable.realloc = vtable->realloc;
+ sn_mem_vtable.free = vtable->free;
+ sn_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc;
+ sn_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : sn_mem_vtable.malloc;
+ sn_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : sn_mem_vtable.realloc;
}
else
{
fprintf (stderr,
- "liblf: memory allocation vtable lacks one of malloc(), realloc() or free()");
+ "libsn: memory allocation vtable lacks one of malloc(), realloc() or free()");
}
}
else
{
fprintf (stderr,
- "liblf: memory allocation vtable can only be set once at startup");
+ "libsn: memory allocation vtable can only be set once at startup");
}
}
-static LfUtf8ValidateFunc utf8_validator = NULL;
+static SnUtf8ValidateFunc utf8_validator = NULL;
void
-lf_set_utf8_validator (LfUtf8ValidateFunc validate_func)
+sn_set_utf8_validator (SnUtf8ValidateFunc validate_func)
{
utf8_validator = validate_func;
}
-lf_bool_t
-lf_internal_utf8_validate (const char *str,
+sn_bool_t
+sn_internal_utf8_validate (const char *str,
int max_len)
{
if (utf8_validator)
@@ -251,25 +251,25 @@ lf_internal_utf8_validate (const char *str,
}
char*
-lf_internal_strdup (const char *str)
+sn_internal_strdup (const char *str)
{
char *s;
- s = lf_malloc (strlen (str) + 1);
+ s = sn_malloc (strlen (str) + 1);
strcpy (s, str);
return s;
}
char*
-lf_internal_strndup (const char *str,
+sn_internal_strndup (const char *str,
int n)
{
char *new_str;
if (str)
{
- new_str = lf_new (char, n + 1);
+ new_str = sn_new (char, n + 1);
strncpy (new_str, str, n);
new_str[n] = '\0';
}
@@ -280,7 +280,7 @@ lf_internal_strndup (const char *str,
}
void
-lf_internal_strfreev (char **strings)
+sn_internal_strfreev (char **strings)
{
int i;
@@ -290,14 +290,14 @@ lf_internal_strfreev (char **strings)
i = 0;
while (strings[i])
{
- lf_free (strings[i]);
+ sn_free (strings[i]);
++i;
}
- lf_free (strings);
+ sn_free (strings);
}
unsigned long
-lf_internal_string_to_ulong (const char* str)
+sn_internal_string_to_ulong (const char* str)
{
unsigned long retval;
char *end;
diff --git a/libsn/sn-util.h b/libsn/sn-util.h
index 4da3c1e..e77444f 100644
--- a/libsn/sn-util.h
+++ b/libsn/sn-util.h
@@ -23,75 +23,75 @@
*/
-#ifndef __LF_UTIL_H__
-#define __LF_UTIL_H__
+#ifndef __SN_UTIL_H__
+#define __SN_UTIL_H__
/* Guard C code in headers, while including them from C++ */
#ifdef __cplusplus
-# define LF_BEGIN_DECLS extern "C" {
-# define LF_END_DECLS }
+# define SN_BEGIN_DECLS extern "C" {
+# define SN_END_DECLS }
#else
-# define LF_BEGIN_DECLS
-# define LF_END_DECLS
+# define SN_BEGIN_DECLS
+# define SN_END_DECLS
#endif
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef unsigned long lf_size_t;
-typedef int lf_bool_t;
+typedef unsigned long sn_size_t;
+typedef int sn_bool_t;
/* Padding in vtables */
-typedef void (* LfPaddingFunc) (void);
+typedef void (* SnPaddingFunc) (void);
/* Free data */
-typedef void (* LfFreeFunc) (void *data);
+typedef void (* SnFreeFunc) (void *data);
-void* lf_malloc (lf_size_t n_bytes);
-void* lf_malloc0 (lf_size_t n_bytes);
-void* lf_realloc (void *mem,
- lf_size_t n_bytes);
-void lf_free (void *mem);
-void* lf_try_malloc (lf_size_t n_bytes);
-void* lf_try_realloc (void *mem,
- lf_size_t n_bytes);
+void* sn_malloc (sn_size_t n_bytes);
+void* sn_malloc0 (sn_size_t n_bytes);
+void* sn_realloc (void *mem,
+ sn_size_t n_bytes);
+void sn_free (void *mem);
+void* sn_try_malloc (sn_size_t n_bytes);
+void* sn_try_realloc (void *mem,
+ sn_size_t n_bytes);
/* Convenience memory allocators
*/
-#define lf_new(struct_type, n_structs) \
- ((struct_type *) lf_malloc (((lf_size_t) sizeof (struct_type)) * ((lf_size_t) (n_structs))))
-#define lf_new0(struct_type, n_structs) \
- ((struct_type *) lf_malloc0 (((lf_size_t) sizeof (struct_type)) * ((lf_size_t) (n_structs))))
-#define lf_renew(struct_type, mem, n_structs) \
- ((struct_type *) lf_realloc ((mem), ((lf_size_t) sizeof (struct_type)) * ((lf_size_t) (n_structs))))
+#define sn_new(struct_type, n_structs) \
+ ((struct_type *) sn_malloc (((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
+#define sn_new0(struct_type, n_structs) \
+ ((struct_type *) sn_malloc0 (((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
+#define sn_renew(struct_type, mem, n_structs) \
+ ((struct_type *) sn_realloc ((mem), ((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
/* Memory allocation virtualization, so you can override memory
- * allocation behavior. lf_mem_set_vtable() has to be the very first
- * liblf function called if being used
+ * allocation behavior. sn_mem_set_vtable() has to be the very first
+ * libsn function called if being used
*/
typedef struct
{
- void* (*malloc) (lf_size_t n_bytes);
+ void* (*malloc) (sn_size_t n_bytes);
void* (*realloc) (void *mem,
- lf_size_t n_bytes);
+ sn_size_t n_bytes);
void (*free) (void *mem);
/* optional */
- void* (*calloc) (lf_size_t n_blocks,
- lf_size_t n_block_bytes);
- void* (*try_malloc) (lf_size_t n_bytes);
+ void* (*calloc) (sn_size_t n_blocks,
+ sn_size_t n_block_bytes);
+ void* (*try_malloc) (sn_size_t n_bytes);
void* (*try_realloc) (void *mem,
- lf_size_t n_bytes);
- LfPaddingFunc padding1;
- LfPaddingFunc padding2;
-} LfMemVTable;
+ sn_size_t n_bytes);
+ SnPaddingFunc padding1;
+ SnPaddingFunc padding2;
+} SnMemVTable;
-void lf_mem_set_vtable (LfMemVTable *vtable);
-lf_bool_t lf_mem_is_system_malloc (void);
+void sn_mem_set_vtable (SnMemVTable *vtable);
+sn_bool_t sn_mem_is_system_malloc (void);
-typedef lf_bool_t (* LfUtf8ValidateFunc) (const char *str,
+typedef sn_bool_t (* SnUtf8ValidateFunc) (const char *str,
int max_len);
-void lf_set_utf8_validator (LfUtf8ValidateFunc validate_func);
+void sn_set_utf8_validator (SnUtf8ValidateFunc validate_func);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_UTIL_H__ */
+#endif /* __SN_UTIL_H__ */
diff --git a/libsn/sn-xmessages.c b/libsn/sn-xmessages.c
index b195b49..249c15b 100644
--- a/libsn/sn-xmessages.c
+++ b/libsn/sn-xmessages.c
@@ -22,19 +22,19 @@
* SOFTWARE.
*/
-#include "lf-xmessages.h"
-#include "lf-list.h"
-#include "lf-internals.h"
+#include "sn-xmessages.h"
+#include "sn-list.h"
+#include "sn-internals.h"
typedef struct
{
Display *xdisplay;
Atom type_atom;
char *message_type;
- LfXmessageFunc func;
+ SnXmessageFunc func;
void *func_data;
- LfFreeFunc free_data_func;
-} LfXmessageHandler;
+ SnFreeFunc free_data_func;
+} SnXmessageHandler;
typedef struct
{
@@ -42,49 +42,49 @@ typedef struct
Window xwindow;
char *message;
int allocated;
-} LfXmessage;
+} SnXmessage;
-static LfList *xmessage_funcs = NULL;
-static LfList *pending_messages = NULL;
+static SnList *xmessage_funcs = NULL;
+static SnList *pending_messages = NULL;
void
-lf_internal_add_xmessage_func (LfDisplay *display,
+sn_internal_add_xmessage_func (SnDisplay *display,
const char *message_type,
- LfXmessageFunc func,
+ SnXmessageFunc func,
void *func_data,
- LfFreeFunc free_data_func)
+ SnFreeFunc free_data_func)
{
- LfXmessageHandler *handler;
+ SnXmessageHandler *handler;
if (xmessage_funcs == NULL)
- xmessage_funcs = lf_list_new ();
+ xmessage_funcs = sn_list_new ();
- handler = lf_new0 (LfXmessageHandler, 1);
+ handler = sn_new0 (SnXmessageHandler, 1);
- handler->xdisplay = lf_display_get_x_display (display);
- handler->type_atom = lf_internal_atom_get (display, message_type);
- handler->message_type = lf_internal_strdup (message_type);
+ handler->xdisplay = sn_display_get_x_display (display);
+ handler->type_atom = sn_internal_atom_get (display, message_type);
+ handler->message_type = sn_internal_strdup (message_type);
handler->func= func;
handler->func_data = func_data;
handler->free_data_func = free_data_func;
- lf_list_prepend (xmessage_funcs, handler);
+ sn_list_prepend (xmessage_funcs, handler);
}
typedef struct
{
const char *message_type;
- LfXmessageFunc func;
+ SnXmessageFunc func;
void *func_data;
- LfXmessageHandler *handler;
+ SnXmessageHandler *handler;
} FindHandlerData;
-static lf_bool_t
+static sn_bool_t
find_handler_foreach (void *value,
void *data)
{
FindHandlerData *fhd = data;
- LfXmessageHandler *handler = value;
+ SnXmessageHandler *handler = value;
if (handler->func == fhd->func &&
handler->func_data == fhd->func_data &&
@@ -98,9 +98,9 @@ find_handler_foreach (void *value,
}
void
-lf_internal_remove_xmessage_func (LfDisplay *display,
+sn_internal_remove_xmessage_func (SnDisplay *display,
const char *message_type,
- LfXmessageFunc func,
+ SnXmessageFunc func,
void *func_data)
{
FindHandlerData fhd;
@@ -110,23 +110,23 @@ lf_internal_remove_xmessage_func (LfDisplay *display,
fhd.handler = NULL;
if (xmessage_funcs != NULL)
- lf_list_foreach (xmessage_funcs, find_handler_foreach, &fhd);
+ sn_list_foreach (xmessage_funcs, find_handler_foreach, &fhd);
if (fhd.handler != NULL)
{
- lf_list_remove (xmessage_funcs, fhd.handler);
+ sn_list_remove (xmessage_funcs, fhd.handler);
- lf_free (fhd.handler->message_type);
+ sn_free (fhd.handler->message_type);
if (fhd.handler->free_data_func)
(* fhd.handler->free_data_func) (fhd.handler->func_data);
- lf_free (fhd.handler);
+ sn_free (fhd.handler);
}
}
void
-lf_internal_broadcast_xmessage (LfDisplay *display,
+sn_internal_broadcast_xmessage (SnDisplay *display,
const char *message_type,
const char *message)
{
@@ -134,7 +134,7 @@ lf_internal_broadcast_xmessage (LfDisplay *display,
Window xwindow;
Display *xdisplay;
- if (!lf_internal_utf8_validate (message, -1))
+ if (!sn_internal_utf8_validate (message, -1))
{
fprintf (stderr,
"Attempted to send non-UTF-8 X message: %s\n",
@@ -142,7 +142,7 @@ lf_internal_broadcast_xmessage (LfDisplay *display,
return;
}
- xdisplay = lf_display_get_x_display (display);
+ xdisplay = sn_display_get_x_display (display);
{
XSetWindowAttributes attrs;
@@ -162,7 +162,7 @@ lf_internal_broadcast_xmessage (LfDisplay *display,
&attrs);
}
- type_atom = lf_internal_atom_get (display, message_type);
+ type_atom = sn_internal_atom_get (display, message_type);
{
XEvent xevent;
@@ -193,7 +193,7 @@ lf_internal_broadcast_xmessage (LfDisplay *display,
++src;
}
- lf_internal_send_event_all_screens (display, PropertyChangeMask,
+ sn_internal_send_event_all_screens (display, PropertyChangeMask,
&xevent);
}
}
@@ -206,14 +206,14 @@ typedef struct
{
Display *xdisplay;
Atom atom;
- lf_bool_t found_handler;
+ sn_bool_t found_handler;
} HandlerForAtomData;
-static lf_bool_t
+static sn_bool_t
handler_for_atom_foreach (void *value,
void *data)
{
- LfXmessageHandler *handler = value;
+ SnXmessageHandler *handler = value;
HandlerForAtomData *hfad = data;
if (handler->xdisplay == hfad->xdisplay &&
@@ -226,18 +226,18 @@ handler_for_atom_foreach (void *value,
return TRUE;
}
-static lf_bool_t
-some_handler_handles_event (LfDisplay *display,
+static sn_bool_t
+some_handler_handles_event (SnDisplay *display,
XEvent *xevent)
{
HandlerForAtomData hfad;
hfad.atom = xevent->xclient.message_type;
- hfad.xdisplay = lf_display_get_x_display (display);
+ hfad.xdisplay = sn_display_get_x_display (display);
hfad.found_handler = FALSE;
if (xmessage_funcs)
- lf_list_foreach (xmessage_funcs,
+ sn_list_foreach (xmessage_funcs,
handler_for_atom_foreach,
&hfad);
@@ -248,14 +248,14 @@ typedef struct
{
Display *xdisplay;
XEvent *xevent;
- LfXmessage *message;
+ SnXmessage *message;
} FindMessageData;
-static lf_bool_t
+static sn_bool_t
find_message_foreach (void *value,
void *data)
{
- LfXmessage *message = value;
+ SnXmessage *message = value;
FindMessageData *fmd = data;
if (fmd->xevent->xclient.window ==
@@ -270,35 +270,35 @@ find_message_foreach (void *value,
return TRUE;
}
-static LfXmessage*
-add_event_to_messages (LfDisplay *display,
+static SnXmessage*
+add_event_to_messages (SnDisplay *display,
XEvent *xevent)
{
FindMessageData fmd;
- LfXmessage *message;
+ SnXmessage *message;
const char *src;
const char *src_end;
char *dest;
- lf_bool_t completed;
+ sn_bool_t completed;
/* We don't want screwy situations to end up causing us to allocate
* infinite memory. Cap the length of a message.
*/
#define MAX_MESSAGE_LENGTH 4096
- fmd.xdisplay = lf_display_get_x_display (display);
+ fmd.xdisplay = sn_display_get_x_display (display);
fmd.xevent = xevent;
fmd.message = NULL;
if (pending_messages)
- lf_list_foreach (pending_messages, find_message_foreach, &fmd);
+ sn_list_foreach (pending_messages, find_message_foreach, &fmd);
message = fmd.message;
if (message == NULL)
{
/* Create a new message */
- message = lf_new0 (LfXmessage, 1);
+ message = sn_new0 (SnXmessage, 1);
message->type_atom = xevent->xclient.message_type;
message->xwindow = xevent->xclient.window;
@@ -306,24 +306,24 @@ add_event_to_messages (LfDisplay *display,
message->allocated = 0;
if (pending_messages == NULL)
- pending_messages = lf_list_new ();
+ pending_messages = sn_list_new ();
- lf_list_prepend (pending_messages, message);
+ sn_list_prepend (pending_messages, message);
}
if (message->allocated > MAX_MESSAGE_LENGTH)
{
/* This message is some kind of crap - just dump it. */
- lf_free (message->message);
- lf_list_remove (pending_messages, message);
- lf_free (message);
+ sn_free (message->message);
+ sn_list_remove (pending_messages, message);
+ sn_free (message);
return NULL;
}
src = &xevent->xclient.data.b[0];
src_end = src + 20;
- message->message = lf_realloc (message->message,
+ message->message = sn_realloc (message->message,
message->allocated + 20);
dest = message->message + message->allocated;
message->allocated += 20;
@@ -348,7 +348,7 @@ add_event_to_messages (LfDisplay *display,
if (completed)
{
/* Pull message out of the pending queue and return it */
- lf_list_remove (pending_messages, message);
+ sn_list_remove (pending_messages, message);
return message;
}
else
@@ -357,15 +357,15 @@ add_event_to_messages (LfDisplay *display,
typedef struct
{
- LfDisplay *display;
- LfXmessage *message;
+ SnDisplay *display;
+ SnXmessage *message;
} MessageDispatchData;
-static lf_bool_t
+static sn_bool_t
dispatch_message_foreach (void *value,
void *data)
{
- LfXmessageHandler *handler = value;
+ SnXmessageHandler *handler = value;
MessageDispatchData *mdd = data;
(* handler->func) (mdd->display,
@@ -376,12 +376,12 @@ dispatch_message_foreach (void *value,
return TRUE;
}
-lf_bool_t
-lf_internal_xmessage_process_event (LfDisplay *display,
+sn_bool_t
+sn_internal_xmessage_process_event (SnDisplay *display,
XEvent *xevent)
{
- lf_bool_t retval;
- LfXmessage *message;
+ sn_bool_t retval;
+ SnXmessage *message;
retval = FALSE;
message = NULL;
@@ -404,7 +404,7 @@ lf_internal_xmessage_process_event (LfDisplay *display,
* messages containing invalid UTF-8
*/
- if (lf_internal_utf8_validate (message->message, -1))
+ if (sn_internal_utf8_validate (message->message, -1))
{
MessageDispatchData mdd;
@@ -416,13 +416,13 @@ lf_internal_xmessage_process_event (LfDisplay *display,
* dispatch
*/
if (xmessage_funcs != NULL)
- lf_list_foreach (xmessage_funcs,
+ sn_list_foreach (xmessage_funcs,
dispatch_message_foreach,
&mdd);
}
- lf_free (message->message);
- lf_free (message);
+ sn_free (message->message);
+ sn_free (message);
}
return retval;
@@ -438,7 +438,7 @@ append_to_string (char **append_to,
len = strlen (append);
- *append_to = lf_realloc (*append_to, *current_len + len + 1);
+ *append_to = sn_realloc (*append_to, *current_len + len + 1);
end = *append_to + *current_len;
strcpy (end, append);
@@ -477,11 +477,11 @@ append_to_string_escaped (char **append_to,
append_to_string (append_to, current_len, escaped);
- lf_free (escaped);
+ sn_free (escaped);
}
char*
-lf_internal_serialize_message (const char *prefix,
+sn_internal_serialize_message (const char *prefix,
const char **property_names,
const char **property_values)
{
@@ -515,8 +515,8 @@ append_string_to_list (char ***list,
{
if (*list == NULL)
{
- *list = lf_new0 (char*, 2);
- (*list)[0] = lf_internal_strdup (append);
+ *list = sn_new0 (char*, 2);
+ (*list)[0] = sn_internal_strdup (append);
}
else
{
@@ -526,8 +526,8 @@ append_string_to_list (char ***list,
while ((*list)[i] != NULL)
++i;
- *list = lf_renew (char*, *list, i + 2);
- (*list)[i] = lf_internal_strdup (append);
+ *list = sn_renew (char*, *list, i + 2);
+ (*list)[i] = sn_internal_strdup (append);
(*list)[i+1] = NULL;
}
}
@@ -552,7 +552,7 @@ parse_prefix_up_to (const char *str,
return NULL;
len = p - str;
- prefix = lf_internal_strndup (str, len);
+ prefix = sn_internal_strndup (str, len);
*end = str + len;
@@ -571,7 +571,7 @@ parse_prefix_up_to (const char *str,
* copyright Red Hat Inc. also)
*/
-static lf_bool_t
+static sn_bool_t
unquote_string_inplace (char *str,
char **end)
{
@@ -675,13 +675,13 @@ unquote_string_inplace (char *str,
return FALSE;
}
-static lf_bool_t
+static sn_bool_t
unescape_string_inplace (char *str,
char **end)
{
char* dest;
char* s;
- lf_bool_t escaped;
+ sn_bool_t escaped;
dest = s = str;
escaped = FALSE;
@@ -717,7 +717,7 @@ unescape_string_inplace (char *str,
return TRUE;
}
-static lf_bool_t
+static sn_bool_t
parse_property (const char *str,
char **name_p,
char **val_p,
@@ -730,7 +730,7 @@ parse_property (const char *str,
*end_p = NULL;
- copy = lf_internal_strdup (str);
+ copy = sn_internal_strdup (str);
p = copy;
while (*p == ' ')
@@ -739,7 +739,7 @@ parse_property (const char *str,
name = parse_prefix_up_to (p, '=', (const char**) &p);
if (name == NULL)
{
- lf_free (copy);
+ sn_free (copy);
return FALSE;
}
++p; /* skip '=' */
@@ -755,11 +755,11 @@ parse_property (const char *str,
end = NULL;
if (!unquote_string_inplace (p, &end))
{
- lf_free (copy);
+ sn_free (copy);
return FALSE;
}
- val = lf_internal_strndup (p, end - p);
+ val = sn_internal_strndup (p, end - p);
p = end;
}
@@ -770,11 +770,11 @@ parse_property (const char *str,
end = NULL;
if (!unescape_string_inplace (p, &end))
{
- lf_free (copy);
+ sn_free (copy);
return FALSE;
}
- val = lf_internal_strndup (p, end - p);
+ val = sn_internal_strndup (p, end - p);
p = end;
}
@@ -784,7 +784,7 @@ parse_property (const char *str,
*end_p = str + (p - copy);
- lf_free (copy);
+ sn_free (copy);
*name_p = name;
*val_p = val;
@@ -792,8 +792,8 @@ parse_property (const char *str,
return TRUE;
}
-lf_bool_t
-lf_internal_unserialize_message (const char *message,
+sn_bool_t
+sn_internal_unserialize_message (const char *message,
char **prefix_p,
char ***property_names,
char ***property_values)
diff --git a/libsn/sn-xmessages.h b/libsn/sn-xmessages.h
index 6920d5d..8f03b77 100644
--- a/libsn/sn-xmessages.h
+++ b/libsn/sn-xmessages.h
@@ -22,39 +22,39 @@
* SOFTWARE.
*/
-#ifndef __LF_XMESSAGES_H__
-#define __LF_XMESSAGES_H__
+#ifndef __SN_XMESSAGES_H__
+#define __SN_XMESSAGES_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-typedef void (* LfXmessageFunc) (LfDisplay *display,
+typedef void (* SnXmessageFunc) (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data);
-void lf_internal_add_xmessage_func (LfDisplay *display,
+void sn_internal_add_xmessage_func (SnDisplay *display,
const char *message_type,
- LfXmessageFunc func,
+ SnXmessageFunc func,
void *func_data,
- LfFreeFunc free_data_func);
-void lf_internal_remove_xmessage_func (LfDisplay *display,
+ SnFreeFunc free_data_func);
+void sn_internal_remove_xmessage_func (SnDisplay *display,
const char *message_type,
- LfXmessageFunc func,
+ SnXmessageFunc func,
void *func_data);
-void lf_internal_broadcast_xmessage (LfDisplay *display,
+void sn_internal_broadcast_xmessage (SnDisplay *display,
const char *message_type,
const char *message);
-char* lf_internal_serialize_message (const char *prefix,
+char* sn_internal_serialize_message (const char *prefix,
const char **property_names,
const char **property_values);
-lf_bool_t lf_internal_unserialize_message (const char *message,
+sn_bool_t sn_internal_unserialize_message (const char *message,
char **prefix,
char ***property_names,
char ***property_values);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_XMESSAGES_H__ */
+#endif /* __SN_XMESSAGES_H__ */
diff --git a/libsn/sn-xutils.c b/libsn/sn-xutils.c
index 1a9d187..4bc127f 100644
--- a/libsn/sn-xutils.c
+++ b/libsn/sn-xutils.c
@@ -22,129 +22,129 @@
* SOFTWARE.
*/
-#include "lf-internals.h"
+#include "sn-internals.h"
#include <X11/Xutil.h>
#include <X11/Xatom.h>
Atom
-lf_internal_atom_get (LfDisplay *display,
+sn_internal_atom_get (SnDisplay *display,
const char *atom_name)
{
- return XInternAtom (lf_display_get_x_display (display),
+ return XInternAtom (sn_display_get_x_display (display),
atom_name,
False);
}
void
-lf_internal_set_utf8_string (LfDisplay *display,
+sn_internal_set_utf8_string (SnDisplay *display,
Window xwindow,
const char *property,
const char *str)
{
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
- lf_internal_atom_get (display, "UTF8_STRING"),
+ sn_internal_atom_get (display, property),
+ sn_internal_atom_get (display, "UTF8_STRING"),
8, PropModeReplace, (unsigned char*) str,
strlen (str));
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
void
-lf_internal_set_string (LfDisplay *display,
+sn_internal_set_string (SnDisplay *display,
Window xwindow,
const char *property,
const char *str)
{
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
XA_STRING,
8, PropModeReplace, (unsigned char*) str,
strlen (str));
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
void
-lf_internal_set_cardinal (LfDisplay *display,
+sn_internal_set_cardinal (SnDisplay *display,
Window xwindow,
const char *property,
int val)
{
unsigned long long_val = val;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
XA_CARDINAL,
32, PropModeReplace, (unsigned char*) &long_val, 1);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
void
-lf_internal_set_window (LfDisplay *display,
+sn_internal_set_window (SnDisplay *display,
Window xwindow,
const char *property,
Window val)
{
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
XA_WINDOW,
32, PropModeReplace, (unsigned char*) &val, 1);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
void
-lf_internal_set_cardinal_list (LfDisplay *display,
+sn_internal_set_cardinal_list (SnDisplay *display,
Window xwindow,
const char *property,
int *vals,
int n_vals)
{
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
XA_CARDINAL,
32, PropModeReplace, (unsigned char*) vals, n_vals);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
void
-lf_internal_set_atom_list (LfDisplay *display,
+sn_internal_set_atom_list (SnDisplay *display,
Window xwindow,
const char *property,
Atom *vals,
int n_vals)
{
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
- XChangeProperty (lf_display_get_x_display (display),
+ XChangeProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
XA_ATOM,
32, PropModeReplace, (unsigned char*) vals, n_vals);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
}
-lf_bool_t
-lf_internal_get_cardinal (LfDisplay *display,
+sn_bool_t
+sn_internal_get_cardinal (SnDisplay *display,
Window xwindow,
const char *property,
int *val)
@@ -158,16 +158,16 @@ lf_internal_get_cardinal (LfDisplay *display,
*val = 0;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
num = NULL;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 256, /* 256 = random number */
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (unsigned char **)&num);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || num == NULL || nitems == 0)
{
if (num)
@@ -187,8 +187,8 @@ lf_internal_get_cardinal (LfDisplay *display,
return TRUE;
}
-lf_bool_t
-lf_internal_get_utf8_string (LfDisplay *display,
+sn_bool_t
+sn_internal_get_utf8_string (SnDisplay *display,
Window xwindow,
const char *property,
char **val)
@@ -201,22 +201,22 @@ lf_internal_get_utf8_string (LfDisplay *display,
int result;
Atom utf8_string;
- utf8_string = lf_internal_atom_get (display, "UTF8_STRING");
+ utf8_string = sn_internal_atom_get (display, "UTF8_STRING");
*val = NULL;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
str = NULL;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 20000, /* 20000 = random number */
False,
utf8_string,
&type, &format, &nitems,
&bytes_after, (unsigned char **)&str);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || str == NULL)
{
if (str)
@@ -232,7 +232,7 @@ lf_internal_get_utf8_string (LfDisplay *display,
return FALSE;
}
- if (!lf_internal_utf8_validate (str, nitems))
+ if (!sn_internal_utf8_validate (str, nitems))
{
fprintf (stderr, "Warning: invalid UTF-8 in property %s on window 0x%lx\n",
property, xwindow);
@@ -240,14 +240,14 @@ lf_internal_get_utf8_string (LfDisplay *display,
return FALSE;
}
- *val = lf_internal_strdup (str);
+ *val = sn_internal_strdup (str);
XFree (str);
return TRUE;
}
-lf_bool_t
-lf_internal_get_string (LfDisplay *display,
+sn_bool_t
+sn_internal_get_string (SnDisplay *display,
Window xwindow,
const char *property,
char **val)
@@ -261,18 +261,18 @@ lf_internal_get_string (LfDisplay *display,
*val = NULL;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
str = NULL;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 20000, /* 20000 = random number */
False,
XA_STRING,
&type, &format, &nitems,
&bytes_after, (unsigned char **)&str);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || str == NULL)
{
if (str)
@@ -288,14 +288,14 @@ lf_internal_get_string (LfDisplay *display,
return FALSE;
}
- *val = lf_internal_strdup (str);
+ *val = sn_internal_strdup (str);
XFree (str);
return TRUE;
}
-lf_bool_t
-lf_internal_get_window (LfDisplay *display,
+sn_bool_t
+sn_internal_get_window (SnDisplay *display,
Window xwindow,
const char *property,
Window *val)
@@ -309,16 +309,16 @@ lf_internal_get_window (LfDisplay *display,
*val = 0;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
win = NULL;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 256, /* 256 = random number */
False, XA_WINDOW, &type, &format, &nitems,
&bytes_after, (unsigned char **)&win);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || win == NULL || nitems == 0)
{
if (win)
@@ -338,8 +338,8 @@ lf_internal_get_window (LfDisplay *display,
return TRUE;
}
-lf_bool_t
-lf_internal_get_atom_list (LfDisplay *display,
+sn_bool_t
+sn_internal_get_atom_list (SnDisplay *display,
Window xwindow,
const char *property,
Atom **atoms,
@@ -356,15 +356,15 @@ lf_internal_get_atom_list (LfDisplay *display,
*n_atoms = 0;
data = NULL;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 1000, /* 1000 = random number */
False, XA_ATOM, &type, &format, &nitems,
&bytes_after, (unsigned char **)&data);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || data == NULL)
{
if (data)
@@ -378,7 +378,7 @@ lf_internal_get_atom_list (LfDisplay *display,
return FALSE;
}
- *atoms = lf_new (Atom, nitems);
+ *atoms = sn_new (Atom, nitems);
memcpy (*atoms, data, sizeof (Atom) * nitems);
*n_atoms = nitems;
@@ -387,8 +387,8 @@ lf_internal_get_atom_list (LfDisplay *display,
return TRUE;
}
-lf_bool_t
-lf_internal_get_cardinal_list (LfDisplay *display,
+sn_bool_t
+sn_internal_get_cardinal_list (SnDisplay *display,
Window xwindow,
const char *property,
int **vals,
@@ -406,15 +406,15 @@ lf_internal_get_cardinal_list (LfDisplay *display,
*n_vals = 0;
nums = NULL;
- lf_display_error_trap_push (display);
+ sn_display_error_trap_push (display);
type = None;
- result = XGetWindowProperty (lf_display_get_x_display (display),
+ result = XGetWindowProperty (sn_display_get_x_display (display),
xwindow,
- lf_internal_atom_get (display, property),
+ sn_internal_atom_get (display, property),
0, 1000, /* 1000 = random number */
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (unsigned char **)&nums);
- lf_display_error_trap_pop (display);
+ sn_display_error_trap_pop (display);
if (result != Success || nums == NULL)
{
if (nums)
@@ -428,7 +428,7 @@ lf_internal_get_cardinal_list (LfDisplay *display,
return FALSE;
}
- *vals = lf_new (int, nitems);
+ *vals = sn_new (int, nitems);
*n_vals = nitems;
i = 0;
while (i < *n_vals)
@@ -443,17 +443,17 @@ lf_internal_get_cardinal_list (LfDisplay *display,
}
void
-lf_internal_send_event_all_screens (LfDisplay *display,
+sn_internal_send_event_all_screens (SnDisplay *display,
unsigned long mask,
XEvent *xevent)
{
int i;
Display *xdisplay;
- xdisplay = lf_display_get_x_display (display);
+ xdisplay = sn_display_get_x_display (display);
i = 0;
- while (lf_display_get_x_screen (display, i) != NULL)
+ while (sn_display_get_x_screen (display, i) != NULL)
{
XSendEvent (xdisplay,
RootWindow (xdisplay, i),
diff --git a/libsn/sn-xutils.h b/libsn/sn-xutils.h
index 819a3c8..6e4ee13 100644
--- a/libsn/sn-xutils.h
+++ b/libsn/sn-xutils.h
@@ -22,75 +22,75 @@
* SOFTWARE.
*/
-#ifndef __LF_XUTILS_H__
-#define __LF_XUTILS_H__
+#ifndef __SN_XUTILS_H__
+#define __SN_XUTILS_H__
-#include <liblf/lf-common.h>
+#include <libsn/sn-common.h>
-LF_BEGIN_DECLS
+SN_BEGIN_DECLS
-Atom lf_internal_atom_get (LfDisplay *display,
+Atom sn_internal_atom_get (SnDisplay *display,
const char *atom_name);
-void lf_internal_set_utf8_string (LfDisplay *display,
+void sn_internal_set_utf8_string (SnDisplay *display,
Window xwindow,
const char *property,
const char *str);
-void lf_internal_set_string (LfDisplay *display,
+void sn_internal_set_string (SnDisplay *display,
Window xwindow,
const char *property,
const char *str);
-void lf_internal_set_cardinal (LfDisplay *display,
+void sn_internal_set_cardinal (SnDisplay *display,
Window xwindow,
const char *property,
int val);
-void lf_internal_set_window (LfDisplay *display,
+void sn_internal_set_window (SnDisplay *display,
Window xwindow,
const char *property,
Window val);
-void lf_internal_set_cardinal_list (LfDisplay *display,
+void sn_internal_set_cardinal_list (SnDisplay *display,
Window xwindow,
const char *property,
int *vals,
int n_vals);
-void lf_internal_set_atom_list (LfDisplay *display,
+void sn_internal_set_atom_list (SnDisplay *display,
Window xwindow,
const char *property,
Atom *vals,
int n_vals);
-lf_bool_t lf_internal_get_utf8_string (LfDisplay *display,
+sn_bool_t sn_internal_get_utf8_string (SnDisplay *display,
Window xwindow,
const char *property,
char **val);
-lf_bool_t lf_internal_get_string (LfDisplay *display,
+sn_bool_t sn_internal_get_string (SnDisplay *display,
Window xwindow,
const char *property,
char **val);
-lf_bool_t lf_internal_get_cardinal (LfDisplay *display,
+sn_bool_t sn_internal_get_cardinal (SnDisplay *display,
Window xwindow,
const char *property,
int *val);
-lf_bool_t lf_internal_get_window (LfDisplay *display,
+sn_bool_t sn_internal_get_window (SnDisplay *display,
Window xwindow,
const char *property,
Window *val);
-lf_bool_t lf_internal_get_atom_list (LfDisplay *display,
+sn_bool_t sn_internal_get_atom_list (SnDisplay *display,
Window xwindow,
const char *property,
Atom **atoms,
int *n_atoms);
-lf_bool_t lf_internal_get_cardinal_list (LfDisplay *display,
+sn_bool_t sn_internal_get_cardinal_list (SnDisplay *display,
Window xwindow,
const char *property,
int **vals,
int *n_vals);
-void lf_internal_send_event_all_screens (LfDisplay *display,
+void sn_internal_send_event_all_screens (SnDisplay *display,
unsigned long mask,
XEvent *xevent);
-LF_END_DECLS
+SN_END_DECLS
-#endif /* __LF_XUTILS_H__ */
+#endif /* __SN_XUTILS_H__ */
diff --git a/test/Makefile.am b/test/Makefile.am
index ab8fa4a..2700cb8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,5 @@
-INCLUDES=$(LIBLF_CFLAGS) -I$(top_srcdir)
+INCLUDES=$(LIBSN_CFLAGS) -I$(top_srcdir)
noinst_PROGRAMS= \
test-launcher \
@@ -10,22 +10,22 @@ noinst_PROGRAMS= \
test_launcher_SOURCES= test-launcher.c
-test_launcher_LDADD= $(LIBLF_LIBS) $(top_builddir)/liblf/liblf-1.la
+test_launcher_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libsn-1.la
test_launchee_SOURCES= test-launchee.c
-test_launchee_LDADD= $(LIBLF_LIBS) $(top_builddir)/liblf/liblf-1.la
+test_launchee_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libsn-1.la
test_monitor_SOURCES= test-monitor.c
-test_monitor_LDADD= $(LIBLF_LIBS) $(top_builddir)/liblf/liblf-1.la
+test_monitor_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libsn-1.la
test_send_xmessage_SOURCES= test-send-xmessage.c
-test_send_xmessage_LDADD= $(LIBLF_LIBS) $(top_builddir)/liblf/liblf-1.la
+test_send_xmessage_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libsn-1.la
test_watch_xmessages_SOURCES= test-watch-xmessages.c
-test_watch_xmessages_LDADD= $(LIBLF_LIBS) $(top_builddir)/liblf/liblf-1.la
+test_watch_xmessages_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libsn-1.la
EXTRA_DIST=test-boilerplate.h \ No newline at end of file
diff --git a/test/test-boilerplate.h b/test/test-boilerplate.h
index 90e1fbd..3170790 100644
--- a/test/test-boilerplate.h
+++ b/test/test-boilerplate.h
@@ -101,14 +101,14 @@ x_error_handler (Display *xdisplay,
}
static void
-error_trap_push (LfDisplay *display,
+error_trap_push (SnDisplay *display,
Display *xdisplay)
{
++error_trap_depth;
}
static void
-error_trap_pop (LfDisplay *display,
+error_trap_pop (SnDisplay *display,
Display *xdisplay)
{
if (error_trap_depth == 0)
diff --git a/test/test-launchee.c b/test/test-launchee.c
index ef77b1c..7751cbd 100644
--- a/test/test-launchee.c
+++ b/test/test-launchee.c
@@ -23,7 +23,7 @@
*/
#include <config.h>
-#include <liblf/lf.h>
+#include <libsn/sn.h>
#include "test-boilerplate.h"
@@ -31,8 +31,8 @@ int
main (int argc, char **argv)
{
Display *xdisplay;
- LfDisplay *display;
- LfLauncheeContext *context;
+ SnDisplay *display;
+ SnLauncheeContext *context;
int i;
xdisplay = XOpenDisplay (NULL);
@@ -42,16 +42,16 @@ main (int argc, char **argv)
return 1;
}
- if (getenv ("LIBLF_SYNC") != NULL)
+ if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
- display = lf_display_new (xdisplay,
+ display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
- context = lf_launchee_context_new_from_environment (display);
+ context = sn_launchee_context_new_from_environment (display);
if (context == NULL)
{
@@ -60,20 +60,20 @@ main (int argc, char **argv)
}
printf ("Launchee started with window 0x%lx ID \"%s\"\n",
- lf_launchee_context_get_launch_window (context),
- lf_launchee_context_get_launch_id (context));
+ sn_launchee_context_get_launch_window (context),
+ sn_launchee_context_get_launch_id (context));
/* simulate startup time */
i = 0;
while (i < 4)
{
sleep (1);
- lf_launchee_context_pulse (context);
+ sn_launchee_context_pulse (context);
++i;
}
printf ("Launchee startup complete\n");
- lf_launchee_context_complete (context);
+ sn_launchee_context_complete (context);
while (TRUE)
{
@@ -81,7 +81,7 @@ main (int argc, char **argv)
XNextEvent (xdisplay, &xevent);
- lf_display_process_event (display, &xevent);
+ sn_display_process_event (display, &xevent);
}
return 0;
diff --git a/test/test-launcher.c b/test/test-launcher.c
index 3a006e0..2005026 100644
--- a/test/test-launcher.c
+++ b/test/test-launcher.c
@@ -23,31 +23,31 @@
*/
#include <config.h>
-#include <liblf/lf.h>
+#include <libsn/sn.h>
#include "test-boilerplate.h"
static pid_t child_pid = 0;
static void
-launcher_event_func (LfLauncherEvent *event,
+launcher_event_func (SnLauncherEvent *event,
void *user_data)
{
- LfLauncherContext *context;
+ SnLauncherContext *context;
- context = lf_launcher_event_get_context (event);
+ context = sn_launcher_event_get_context (event);
- switch (lf_launcher_event_get_type (event))
+ switch (sn_launcher_event_get_type (event))
{
- case LF_LAUNCHER_EVENT_COMPLETED:
+ case SN_LAUNCHER_EVENT_COMPLETED:
printf ("Completed!\n");
break;
- case LF_LAUNCHER_EVENT_CANCELED:
+ case SN_LAUNCHER_EVENT_CANCELED:
printf ("Canceled!\n");
kill (child_pid, SIGTERM);
- lf_launcher_context_complete (context);
+ sn_launcher_context_complete (context);
break;
- case LF_LAUNCHER_EVENT_PULSE:
+ case SN_LAUNCHER_EVENT_PULSE:
printf (" pulse.\n");
break;
}
@@ -57,8 +57,8 @@ int
main (int argc, char **argv)
{
Display *xdisplay;
- LfDisplay *display;
- LfLauncherContext *context;
+ SnDisplay *display;
+ SnLauncherContext *context;
if (argc < 2)
{
@@ -73,25 +73,25 @@ main (int argc, char **argv)
return 1;
}
- if (getenv ("LIBLF_SYNC") != NULL)
+ if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
- display = lf_display_new (xdisplay,
+ display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
- context = lf_launcher_context_new (display,
+ context = sn_launcher_context_new (display,
launcher_event_func,
NULL, NULL);
- lf_launcher_context_set_launch_name (context, "Test Launch");
- lf_launcher_context_set_launch_description (context, "Launching a test program for liblf");
- lf_launcher_context_set_supports_cancel (context, TRUE);
- lf_launcher_context_set_binary_name (context, argv[1]);
+ sn_launcher_context_set_launch_name (context, "Test Launch");
+ sn_launcher_context_set_launch_description (context, "Launching a test program for libsn");
+ sn_launcher_context_set_supports_cancel (context, TRUE);
+ sn_launcher_context_set_binary_name (context, argv[1]);
- lf_launcher_context_initiate (context,
+ sn_launcher_context_initiate (context,
"test-launcher",
argv[1],
CurrentTime); /* CurrentTime bad */
@@ -102,14 +102,14 @@ main (int argc, char **argv)
fprintf (stderr, "Fork failed: %s\n", strerror (errno));
break;
case 0:
- lf_launcher_context_setup_child_process (context);
+ sn_launcher_context_setup_child_process (context);
execv (argv[1], argv + 1);
fprintf (stderr, "Failed to exec %s: %s\n", argv[1], strerror (errno));
_exit (1);
break;
}
- lf_launcher_context_set_pid (context, child_pid);
+ sn_launcher_context_set_pid (context, child_pid);
while (TRUE)
{
@@ -117,10 +117,10 @@ main (int argc, char **argv)
XNextEvent (xdisplay, &xevent);
- lf_display_process_event (display, &xevent);
+ sn_display_process_event (display, &xevent);
}
- lf_launcher_context_unref (context);
+ sn_launcher_context_unref (context);
return 0;
}
diff --git a/test/test-monitor.c b/test/test-monitor.c
index 59d4524..6f031fd 100644
--- a/test/test-monitor.c
+++ b/test/test-monitor.c
@@ -23,114 +23,114 @@
*/
#include <config.h>
-#include <liblf/lf.h>
+#include <libsn/sn.h>
#include "test-boilerplate.h"
static void
-monitor_event_func (LfMonitorEvent *event,
+monitor_event_func (SnMonitorEvent *event,
void *user_data)
{
- LfMonitorContext *context;
- LfLaunchSequence *sequence;
+ SnMonitorContext *context;
+ SnLaunchSequence *sequence;
- context = lf_monitor_event_get_context (event);
- sequence = lf_monitor_event_get_launch_sequence (event);
+ context = sn_monitor_event_get_context (event);
+ sequence = sn_monitor_event_get_launch_sequence (event);
- switch (lf_monitor_event_get_type (event))
+ switch (sn_monitor_event_get_type (event))
{
- case LF_MONITOR_EVENT_INITIATED:
+ case SN_MONITOR_EVENT_INITIATED:
{
int x, y, w, h;
const char *s;
printf ("Initiated sequence %s\n",
- lf_launch_sequence_get_id (sequence));
+ sn_launch_sequence_get_id (sequence));
printf (" launch window 0x%lx\n",
- lf_launch_sequence_get_window (sequence));
+ sn_launch_sequence_get_window (sequence));
- s = lf_launch_sequence_get_name (sequence);
+ s = sn_launch_sequence_get_name (sequence);
printf (" name %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_description (sequence);
+ s = sn_launch_sequence_get_description (sequence);
printf (" description %s\n", s ? s : "(unset)");
printf (" workspace %d\n",
- lf_launch_sequence_get_workspace (sequence));
+ sn_launch_sequence_get_workspace (sequence));
printf (" %s cancel\n",
- lf_launch_sequence_get_supports_cancel (sequence) ?
+ sn_launch_sequence_get_supports_cancel (sequence) ?
"supports" : "does not support");
- if (lf_launch_sequence_get_geometry (sequence,
+ if (sn_launch_sequence_get_geometry (sequence,
&x, &y, &w, &h))
printf (" geometry %d,%d %d x %d window 0x%lx\n",
x, y, w, h,
- lf_launch_sequence_get_geometry_window (sequence));
+ sn_launch_sequence_get_geometry_window (sequence));
else
printf (" no geometry set\n");
printf (" pid %d\n",
- lf_launch_sequence_get_pid (sequence));
+ sn_launch_sequence_get_pid (sequence));
- s = lf_launch_sequence_get_binary_name (sequence);
+ s = sn_launch_sequence_get_binary_name (sequence);
printf (" binary name %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_icon_name (sequence);
+ s = sn_launch_sequence_get_icon_name (sequence);
printf (" icon name %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_hostname (sequence);
+ s = sn_launch_sequence_get_hostname (sequence);
printf (" hostname %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_legacy_resource_class (sequence);
+ s = sn_launch_sequence_get_legacy_resource_class (sequence);
printf (" legacy class %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_legacy_resource_name (sequence);
+ s = sn_launch_sequence_get_legacy_resource_name (sequence);
printf (" legacy name %s\n", s ? s : "(unset)");
- s = lf_launch_sequence_get_legacy_window_title (sequence);
+ s = sn_launch_sequence_get_legacy_window_title (sequence);
printf (" legacy title %s\n", s ? s : "(unset)");
}
break;
- case LF_MONITOR_EVENT_COMPLETED:
+ case SN_MONITOR_EVENT_COMPLETED:
printf ("Completed sequence %s\n",
- lf_launch_sequence_get_id (sequence));
+ sn_launch_sequence_get_id (sequence));
break;
- case LF_MONITOR_EVENT_CANCELED:
+ case SN_MONITOR_EVENT_CANCELED:
printf ("Canceled sequence %s\n",
- lf_launch_sequence_get_id (sequence));
+ sn_launch_sequence_get_id (sequence));
break;
- case LF_MONITOR_EVENT_PULSE:
+ case SN_MONITOR_EVENT_PULSE:
printf ("Pulse for sequence %s\n",
- lf_launch_sequence_get_id (sequence));
+ sn_launch_sequence_get_id (sequence));
break;
- case LF_MONITOR_EVENT_GEOMETRY_CHANGED:
+ case SN_MONITOR_EVENT_GEOMETRY_CHANGED:
{
int x, y, w, h;
printf ("Geometry changed for sequence %s\n",
- lf_launch_sequence_get_id (sequence));
- if (lf_launch_sequence_get_geometry (sequence,
+ sn_launch_sequence_get_id (sequence));
+ if (sn_launch_sequence_get_geometry (sequence,
&x, &y, &w, &h))
printf (" geometry %d,%d %d x %d window 0x%lx\n",
x, y, w, h,
- lf_launch_sequence_get_geometry_window (sequence));
+ sn_launch_sequence_get_geometry_window (sequence));
else
printf (" no geometry set\n");
}
break;
- case LF_MONITOR_EVENT_PID_CHANGED:
+ case SN_MONITOR_EVENT_PID_CHANGED:
{
printf ("PID for sequence %s is now %d\n",
- lf_launch_sequence_get_id (sequence),
- lf_launch_sequence_get_pid (sequence));
+ sn_launch_sequence_get_id (sequence),
+ sn_launch_sequence_get_pid (sequence));
}
break;
- case LF_MONITOR_EVENT_WORKSPACE_CHANGED:
+ case SN_MONITOR_EVENT_WORKSPACE_CHANGED:
{
printf ("Workspace for sequence %s is now %d\n",
- lf_launch_sequence_get_id (sequence),
- lf_launch_sequence_get_workspace (sequence));
+ sn_launch_sequence_get_id (sequence),
+ sn_launch_sequence_get_workspace (sequence));
}
break;
}
@@ -140,8 +140,8 @@ int
main (int argc, char **argv)
{
Display *xdisplay;
- LfDisplay *display;
- LfMonitorContext *context;
+ SnDisplay *display;
+ SnMonitorContext *context;
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
@@ -150,7 +150,7 @@ main (int argc, char **argv)
return 1;
}
- if (getenv ("LIBLF_SYNC") != NULL)
+ if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
@@ -162,11 +162,11 @@ main (int argc, char **argv)
XSelectInput (xdisplay, DefaultRootWindow (xdisplay),
PropertyChangeMask);
- display = lf_display_new (xdisplay,
+ display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
- context = lf_monitor_context_new (display,
+ context = sn_monitor_context_new (display,
monitor_event_func,
NULL, NULL);
@@ -176,10 +176,10 @@ main (int argc, char **argv)
XNextEvent (xdisplay, &xevent);
- lf_display_process_event (display, &xevent);
+ sn_display_process_event (display, &xevent);
}
- lf_monitor_context_unref (context);
+ sn_monitor_context_unref (context);
return 0;
}
diff --git a/test/test-send-xmessage.c b/test/test-send-xmessage.c
index 3052a60..00ae71a 100644
--- a/test/test-send-xmessage.c
+++ b/test/test-send-xmessage.c
@@ -23,8 +23,8 @@
*/
#include <config.h>
-#include <liblf/lf.h>
-#include <liblf/lf-xmessages.h>
+#include <libsn/sn.h>
+#include <libsn/sn-xmessages.h>
#include "test-boilerplate.h"
@@ -32,7 +32,7 @@ int
main (int argc, char **argv)
{
Display *xdisplay;
- LfDisplay *display;
+ SnDisplay *display;
if (argc != 3)
{
@@ -47,16 +47,16 @@ main (int argc, char **argv)
return 1;
}
- if (getenv ("LIBLF_SYNC") != NULL)
+ if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
- display = lf_display_new (xdisplay,
+ display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
- lf_internal_broadcast_xmessage (display,
+ sn_internal_broadcast_xmessage (display,
argv[1],
argv[2]);
diff --git a/test/test-watch-xmessages.c b/test/test-watch-xmessages.c
index 150af5c..85728a5 100644
--- a/test/test-watch-xmessages.c
+++ b/test/test-watch-xmessages.c
@@ -23,14 +23,14 @@
*/
#include <config.h>
-#include <liblf/lf.h>
-#include <liblf/lf-xmessages.h>
-#include <liblf/lf-internals.h>
+#include <libsn/sn.h>
+#include <libsn/sn-xmessages.h>
+#include <libsn/sn-internals.h>
#include "test-boilerplate.h"
static void
-message_func (LfDisplay *display,
+message_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data)
@@ -49,7 +49,7 @@ message_func (LfDisplay *display,
names = NULL;
values = NULL;
- if (lf_internal_unserialize_message (message,
+ if (sn_internal_unserialize_message (message,
&prefix, &names, &values))
{
printf (" %s:\n", prefix);
@@ -62,8 +62,8 @@ message_func (LfDisplay *display,
++i;
}
- lf_internal_strfreev (names);
- lf_internal_strfreev (values);
+ sn_internal_strfreev (names);
+ sn_internal_strfreev (values);
}
}
@@ -71,7 +71,7 @@ int
main (int argc, char **argv)
{
Display *xdisplay;
- LfDisplay *display;
+ SnDisplay *display;
if (argc != 2)
{
@@ -86,7 +86,7 @@ main (int argc, char **argv)
return 1;
}
- if (getenv ("LIBLF_SYNC") != NULL)
+ if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
@@ -96,11 +96,11 @@ main (int argc, char **argv)
XSelectInput (xdisplay, DefaultRootWindow (xdisplay),
PropertyChangeMask);
- display = lf_display_new (xdisplay,
+ display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
- lf_internal_add_xmessage_func (display,
+ sn_internal_add_xmessage_func (display,
argv[1],
message_func,
NULL, NULL);
@@ -111,7 +111,7 @@ main (int argc, char **argv)
XNextEvent (xdisplay, &xevent);
- lf_display_process_event (display, &xevent);
+ sn_display_process_event (display, &xevent);
}
return 0;