This commit also changes the licence of the moved code from GPL to LGPL.
See GOSSIP-RELICENSING.txt for details.
https://bugzilla.gnome.org/show_bug.cgi?id=699492
return ret;
}
-/* Takes care of moving the window to the current workspace. */
-void
-empathy_window_present_with_time (GtkWindow *window,
- guint32 timestamp)
-{
- GdkWindow *gdk_window;
-
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- /* Move the window to the current workspace before trying to show it.
- * This is the behaviour people expect when clicking on the statusbar icon. */
- gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
-
- if (gdk_window)
- {
- gint x, y;
- gint w, h;
-
- /* Has no effect if the WM has viewports, like compiz */
- gdk_x11_window_move_to_current_desktop (gdk_window);
-
- /* If window is still off-screen, hide it to force it to
- * reposition on the current workspace. */
- gtk_window_get_position (window, &x, &y);
- gtk_window_get_size (window, &w, &h);
- if (!EMPATHY_RECT_IS_ON_SCREEN (x, y, w, h))
- gtk_widget_hide (GTK_WIDGET (window));
- }
-
- if (timestamp == GDK_CURRENT_TIME)
- gtk_window_present (window);
- else
- gtk_window_present_with_time (window, timestamp);
-}
-
-void
-empathy_window_present (GtkWindow *window)
-{
- empathy_window_present_with_time (window, gtk_get_current_event_time ());
-}
-
/** empathy_make_absolute_url_len:
* @url: an url
* @len: a length
gchar * empathy_filename_from_icon_name (const gchar *icon_name,
GtkIconSize icon_size);
-/* Windows */
-void empathy_window_present (GtkWindow *window);
-void empathy_window_present_with_time (GtkWindow *window,
- guint32 timestamp);
-
void empathy_move_to_window_desktop (GtkWindow *window,
guint32 timestamp);
#include <tp-account-widgets/tpaw-builder.h>
#include <tp-account-widgets/tpaw-camera-monitor.h>
#include <tp-account-widgets/tpaw-images.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-about-dialog.h"
#include "empathy-audio-sink.h"
g_return_if_fail (EMPATHY_IS_CALL_HANDLER (handler));
if (present)
- empathy_window_present_with_time (GTK_WINDOW (self), x11_time);
+ tpaw_window_present_with_time (GTK_WINDOW (self), x11_time);
if (self->priv->call_state == DISCONNECTED)
{
#include <glib/gi18n.h>
#include <clutter-gtk/clutter-gtk.h>
#include <clutter-gst/clutter-gst.h>
+#include <tp-account-widgets/tpaw-utils.h>
#ifdef CLUTTER_WINDOWING_X11
#include <X11/Xlib.h>
gtk_widget_show (GTK_WIDGET (window));
if (present)
- empathy_window_present_with_time (GTK_WINDOW (window), x11_time);
+ tpaw_window_present_with_time (GTK_WINDOW (window), x11_time);
}
}
empathy_chat_window_switch_to_chat (self, chat);
- /* Don't use empathy_window_present_with_time () which would move the window
+ /* Don't use tpaw_window_present_with_time () which would move the window
* to our current desktop but move to the window's desktop instead. This is
* more coherent with Shell's 'app is ready' notication which moves the view
* to the app desktop rather than moving the app itself. */
#include "empathy-status-icon.h"
#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-event-manager.h"
#include "empathy-gsettings.h"
if (!visible) {
gtk_widget_hide (priv->window);
} else {
- empathy_window_present (GTK_WINDOW (priv->window));
+ tpaw_window_present (GTK_WINDOW (priv->window));
}
}
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include <libnotify/notify.h>
+#include <tp-account-widgets/tpaw-utils.h>
#ifdef HAVE_LIBCHAMPLAIN
#include <clutter-gtk/clutter-gtk.h>
else
{
if (!self->start_hidden)
- empathy_window_present (GTK_WINDOW (self->window));
+ tpaw_window_present (GTK_WINDOW (self->window));
}
/* Display the accounts dialog if needed */
G_CALLBACK (dialog_response_cb), button, 0);
out:
- empathy_window_present (GTK_WINDOW (priv->dialog));
+ tpaw_window_present (GTK_WINDOW (priv->dialog));
}
static void
/*
* Copyright (C) 2007-2013 Collabora Ltd.
+ * Copyright (C) 2005-2006 Imendio AB
* Copyright (C) 2006 Xavier Claessens <xavier.claessens@gmail.com>
+ * Copyright (C) 2009 Steve Frécinaux <code@istique.net>
*
* Authors: Marco Barisione <marco.barisione@collabora.co.uk>
* Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
* Sjoerd Simons <sjoerd.simons@collabora.co.uk>
* Xavier Claessens <xavier.claessens@collabora.co.uk>
+ * Mikael Hallendal <micke@imendio.com>
+ * Richard Hult <richard@imendio.com>
+ * Martyn Russell <martyn@imendio.com>
+ * Steve Frécinaux <code@istique.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "tpaw-utils.h"
#include <glib/gi18n-lib.h>
+#include <gdk/gdkx.h>
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
+#define TPAW_RECT_IS_ON_SCREEN(x,y,w,h) ((x) + (w) > 0 && \
+ (y) + (h) > 0 && \
+ (x) < gdk_screen_width () && \
+ (y) < gdk_screen_height ())
+
/* Change the RequestedPresence of a newly created account to ensure that it
* is actually connected. */
void
color->blue = (color->blue + white.blue) / 2;
}
+/* Takes care of moving the window to the current workspace. */
+void
+tpaw_window_present_with_time (GtkWindow *window,
+ guint32 timestamp)
+{
+ GdkWindow *gdk_window;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ /* Move the window to the current workspace before trying to show it.
+ * This is the behaviour people expect when clicking on the statusbar icon. */
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+
+ if (gdk_window)
+ {
+ gint x, y;
+ gint w, h;
+
+ /* Has no effect if the WM has viewports, like compiz */
+ gdk_x11_window_move_to_current_desktop (gdk_window);
+
+ /* If window is still off-screen, hide it to force it to
+ * reposition on the current workspace. */
+ gtk_window_get_position (window, &x, &y);
+ gtk_window_get_size (window, &w, &h);
+ if (!TPAW_RECT_IS_ON_SCREEN (x, y, w, h))
+ gtk_widget_hide (GTK_WIDGET (window));
+ }
+
+ if (timestamp == GDK_CURRENT_TIME)
+ gtk_window_present (window);
+ else
+ gtk_window_present_with_time (window, timestamp);
+}
+
+void
+tpaw_window_present (GtkWindow *window)
+{
+ tpaw_window_present_with_time (window, gtk_get_current_event_time ());
+}
+
GtkWindow *
tpaw_get_toplevel_window (GtkWidget *widget)
{
/*
* Copyright (C) 2007-2013 Collabora Ltd.
+ * Copyright (C) 2005-2006 Imendio AB
* Copyright (C) 2006 Xavier Claessens <xavier.claessens@gmail.com>
+ * Copyright (C) 2009 Steve Frécinaux <code@istique.net>
*
* Authors: Marco Barisione <marco.barisione@collabora.co.uk>
* Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
* Sjoerd Simons <sjoerd.simons@collabora.co.uk>
* Xavier Claessens <xavier.claessens@collabora.co.uk>
+ * Mikael Hallendal <micke@imendio.com>
+ * Richard Hult <richard@imendio.com>
+ * Martyn Russell <martyn@imendio.com>
+ * Steve Frécinaux <code@istique.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
void tpaw_make_color_whiter (GdkRGBA *color);
/* Windows */
+void tpaw_window_present (GtkWindow *window);
+void tpaw_window_present_with_time (GtkWindow *window,
+ guint32 timestamp);
GtkWindow * tpaw_get_toplevel_window (GtkWidget *widget);
/* Copied from wocky/wocky-utils.h */