You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2318 lines
74 KiB

13 years ago
/*
* Copyright (C) 2009 Nick Schermer <nick@xfce.org>
13 years ago
*
13 years ago
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
13 years ago
*
13 years ago
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
13 years ago
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
13 years ago
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#include <exo/exo.h>
#include <common/panel-private.h>
#include <common/panel-debug.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <panel/panel-base-window.h>
13 years ago
#include <panel/panel-window.h>
#include <panel/panel-item-dialog.h>
#include <panel/panel-preferences-dialog.h>
#include <panel/panel-dialogs.h>
#include <panel/panel-dbus-service.h>
#include <panel/panel-plugin-external.h>
#include <panel/panel-plugin-external-46.h>
#define SNAP_DISTANCE (10)
#define SET_OLD_WM_STRUTS (FALSE)
#define STRUTS_DEBUGGING (FALSE)
#define DEFAULT_POPUP_DELAY (225)
#define DEFAULT_POPDOWN_DELAY (350)
#define HANDLE_SPACING (4)
#define HANDLE_DOTS (2)
#define HANDLE_PIXELS (2)
#define HANDLE_PIXEL_SPACE (1)
#define HANDLE_SIZE (HANDLE_DOTS * (HANDLE_PIXELS + \
HANDLE_PIXEL_SPACE) - HANDLE_PIXEL_SPACE)
#define HANDLE_SIZE_TOTAL (2 * HANDLE_SPACING + HANDLE_SIZE)
typedef enum _StrutsEgde StrutsEgde;
typedef enum _AutohideState AutohideState;
typedef enum _SnapPosition SnapPosition;
static void panel_window_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void panel_window_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void panel_window_finalize (GObject *object);
static gboolean panel_window_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gboolean panel_window_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean panel_window_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean panel_window_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint drag_time);
static void panel_window_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint drag_time);
static gboolean panel_window_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event);
static gboolean panel_window_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static gboolean panel_window_button_release_event (GtkWidget *widget,
GdkEventButton *event);
static void panel_window_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void panel_window_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void panel_window_size_allocate (GtkWidget *widget,
GtkAllocation *alloc);
static void panel_window_size_allocate_set_xy (PanelWindow *window,
gint window_width,
gint window_height,
gint *return_x,
gint *return_y);
static void panel_window_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void panel_window_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window);
static void panel_window_screen_struts_set (PanelWindow *window);
static void panel_window_screen_force_update (PanelWindow *window);
static void panel_window_screen_update_borders (PanelWindow *window);
static SnapPosition panel_window_snap_position (PanelWindow *window);
static void panel_window_screen_layout_changed (GdkScreen *screen,
PanelWindow *window);
static void panel_window_autohide_queue (PanelWindow *window,
AutohideState new_state);
static void panel_window_set_autohide (PanelWindow *window,
gboolean autohide);
static void panel_window_menu_popup (PanelWindow *window,
guint32 event_time);
static void panel_window_set_plugin_orientation (GtkWidget *widget,
gpointer user_data);
static void panel_window_set_plugin_size (GtkWidget *widget,
gpointer user_data);
static void panel_window_set_plugin_screen_position (GtkWidget *widget,
gpointer user_data);
13 years ago
enum
{
PROP_0,
PROP_HORIZONTAL,
PROP_SIZE,
PROP_LENGTH,
PROP_POSITION_LOCKED,
PROP_AUTOHIDE,
PROP_SPAN_MONITORS,
PROP_OUTPUT_NAME,
PROP_POSITION,
PROP_DISABLE_STRUTS
};
enum _AutohideState
{
AUTOHIDE_DISABLED = 0, /* autohide is disabled */
AUTOHIDE_VISIBLE, /* visible */
AUTOHIDE_POPDOWN, /* visible, but hide timeout is running */
AUTOHIDE_POPDOWN_SLOW, /* same as popdown, but timeout is 4x longer */
AUTOHIDE_HIDDEN, /* invisible */
AUTOHIDE_POPUP, /* invisible, but show timeout is running */
AUTOHIDE_BLOCKED /* autohide is enabled, but blocked */
};
enum _SnapPosition
{
/* no snapping */
SNAP_POSITION_NONE, /* snapping */
/* right edge */
SNAP_POSITION_E, /* right */
SNAP_POSITION_NE, /* top right */
SNAP_POSITION_EC, /* right center */
SNAP_POSITION_SE, /* bottom right */
/* left edge */
SNAP_POSITION_W, /* left */
SNAP_POSITION_NW, /* top left */
SNAP_POSITION_WC, /* left center */
SNAP_POSITION_SW, /* bottom left */
/* top and bottom */
SNAP_POSITION_NC, /* top center */
SNAP_POSITION_SC, /* bottom center */
SNAP_POSITION_N, /* top */
SNAP_POSITION_S, /* bottom */
13 years ago
};
enum
{
EDGE_GRAVITY_NONE = 0,
EDGE_GRAVITY_START = (SNAP_POSITION_NE - SNAP_POSITION_E),
EDGE_GRAVITY_CENTER = (SNAP_POSITION_EC - SNAP_POSITION_E),
EDGE_GRAVITY_END = (SNAP_POSITION_SE - SNAP_POSITION_E)
13 years ago
};
enum _StrutsEgde
13 years ago
{
STRUTS_EDGE_NONE = 0,
STRUTS_EDGE_LEFT,
STRUTS_EDGE_RIGHT,
STRUTS_EDGE_TOP,
STRUTS_EDGE_BOTTOM
};
13 years ago
enum
{
STRUT_LEFT = 0,
STRUT_RIGHT,
STRUT_TOP,
STRUT_BOTTOM,
STRUT_LEFT_START_Y,
STRUT_LEFT_END_Y,
STRUT_RIGHT_START_Y,
STRUT_RIGHT_END_Y,
STRUT_TOP_START_X,
STRUT_TOP_END_X,
STRUT_BOTTOM_START_X,
STRUT_BOTTOM_END_X,
N_STRUTS
13 years ago
};
struct _PanelWindowClass
{
PanelBaseWindowClass __parent__;
13 years ago
};
struct _PanelWindow
{
PanelBaseWindow __parent__;
/* whether the user is allowed to make
* changes to this window */
guint locked : 1;
/* screen and working area of this panel */
GdkScreen *screen;
GdkRectangle area;
/* struts information */
StrutsEgde struts_edge;
13 years ago
gulong struts[N_STRUTS];
guint struts_disabled : 1;
/* window positioning */
guint size;
13 years ago
gdouble length;
guint horizontal : 1;
SnapPosition snap_position;
guint span_monitors : 1;
gchar *output_name;
13 years ago
/* allocated position of the panel */
GdkRectangle alloc;
/* autohiding */
13 years ago
GtkWidget *autohide_window;
AutohideState autohide_state;
guint autohide_timeout_id;
gint autohide_block;
13 years ago
/* popup/down delay from gtk style */
gint popup_delay;
gint popdown_delay;
/* whether the window position is locked */
guint position_locked : 1;
13 years ago
/* window base point */
gint base_x;
gint base_y;
13 years ago
/* window drag information */
guint32 grab_time;
gint grab_x;
gint grab_y;
13 years ago
};
/* used for a full XfcePanelWindow name in the class, but not in the code */
typedef PanelWindow XfcePanelWindow;
typedef PanelWindowClass XfcePanelWindowClass;
13 years ago
static GdkAtom cardinal_atom = 0;
#if SET_OLD_WM_STRUTS
static GdkAtom net_wm_strut_atom = 0;
#endif
static GdkAtom net_wm_strut_partial_atom = 0;
13 years ago
G_DEFINE_TYPE (XfcePanelWindow, panel_window, PANEL_TYPE_BASE_WINDOW)
13 years ago
static void
panel_window_class_init (PanelWindowClass *klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *gtkwidget_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = panel_window_get_property;
gobject_class->set_property = panel_window_set_property;
13 years ago
gobject_class->finalize = panel_window_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->expose_event = panel_window_expose_event;
gtkwidget_class->enter_notify_event = panel_window_enter_notify_event;
gtkwidget_class->leave_notify_event = panel_window_leave_notify_event;
gtkwidget_class->drag_motion = panel_window_drag_motion;
gtkwidget_class->drag_leave = panel_window_drag_leave;
gtkwidget_class->motion_notify_event = panel_window_motion_notify_event;
gtkwidget_class->button_press_event = panel_window_button_press_event;
gtkwidget_class->button_release_event = panel_window_button_release_event;
gtkwidget_class->grab_notify = panel_window_grab_notify;
13 years ago
gtkwidget_class->size_request = panel_window_size_request;
gtkwidget_class->size_allocate = panel_window_size_allocate;
gtkwidget_class->screen_changed = panel_window_screen_changed;
gtkwidget_class->style_set = panel_window_style_set;
13 years ago
g_object_class_install_property (gobject_class,
PROP_HORIZONTAL,
g_param_spec_boolean ("horizontal", NULL, NULL,
TRUE,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_SIZE,
g_param_spec_uint ("size", NULL, NULL,
16, 128, 48,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_LENGTH,
g_param_spec_uint ("length", NULL, NULL,
1, 100, 25,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_POSITION_LOCKED,
g_param_spec_boolean ("position-locked", NULL, NULL,
FALSE,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_AUTOHIDE,
g_param_spec_boolean ("autohide", NULL, NULL,
FALSE,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_SPAN_MONITORS,
g_param_spec_boolean ("span-monitors", NULL, NULL,
FALSE,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_OUTPUT_NAME,
g_param_spec_string ("output-name", NULL, NULL,
NULL,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_POSITION,
g_param_spec_string ("position", NULL, NULL,
NULL,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_DISABLE_STRUTS,
g_param_spec_boolean ("disable-struts", NULL, NULL,
FALSE,
EXO_PARAM_READWRITE));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("popup-delay",
NULL,
"Time before the panel will unhide on an enter event",
1, G_MAXINT,
DEFAULT_POPUP_DELAY,
EXO_PARAM_READABLE));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("popdown-delay",
NULL,
"Time before the panel will hide on a leave event",
1, G_MAXINT,
DEFAULT_POPDOWN_DELAY,
EXO_PARAM_READABLE));
13 years ago
/* initialize the atoms */
cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
net_wm_strut_partial_atom = gdk_atom_intern_static_string ("_NET_WM_STRUT_PARTIAL");
#if SET_OLD_WM_STRUTS
net_wm_strut_atom = gdk_atom_intern_static_string ("_NET_WM_STRUT");
#endif
13 years ago
}
static void
panel_window_init (PanelWindow *window)
{
window->locked = TRUE;
window->screen = NULL;
window->struts_edge = STRUTS_EDGE_NONE;
window->struts_disabled = FALSE;
13 years ago
window->horizontal = TRUE;
window->size = 30;
window->length = 0.10;
window->snap_position = SNAP_POSITION_NONE;
window->span_monitors = FALSE;
window->position_locked = FALSE;
window->autohide_state = AUTOHIDE_DISABLED;
window->autohide_timeout_id = 0;
window->autohide_block = 0;
window->popup_delay = DEFAULT_POPUP_DELAY;
window->popdown_delay = DEFAULT_POPDOWN_DELAY;
window->base_x = -1;
window->base_y = -1;
window->grab_time = 0;
window->grab_x = 0;
window->grab_y = 0;
13 years ago
/* not resizable, so allocation will follow size request */
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
/* set additional events */
gtk_widget_add_events (GTK_WIDGET (window), GDK_BUTTON_PRESS_MASK);
/* create a 'fake' drop zone for autohide drag motion */
gtk_drag_dest_set (GTK_WIDGET (window), 0, NULL, 0, 0);
/* set the screen */
panel_window_screen_changed (GTK_WIDGET (window), NULL);
/* watch changes in the compositing */
g_signal_connect (G_OBJECT (window), "notify::composited",
G_CALLBACK (panel_window_screen_force_update), NULL);
13 years ago
}
static void
panel_window_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PanelWindow *window = PANEL_WINDOW (object);
gchar *position;
13 years ago
switch (prop_id)
{
case PROP_HORIZONTAL:
g_value_set_boolean (value, window->horizontal);
break;
case PROP_SIZE:
g_value_set_uint (value, window->size);
break;
case PROP_LENGTH:
g_value_set_uint (value, rint (window->length * 100.00));
break;
case PROP_POSITION_LOCKED:
g_value_set_boolean (value, window->position_locked);
break;
case PROP_AUTOHIDE:
g_value_set_boolean (value, !!(window->autohide_state != AUTOHIDE_DISABLED));
break;
case PROP_SPAN_MONITORS:
g_value_set_boolean (value, window->span_monitors);
break;
case PROP_OUTPUT_NAME:
g_value_set_static_string (value, window->output_name);
break;
case PROP_POSITION:
position = g_strdup_printf ("p=%d;x=%d;y=%d",
window->snap_position,
window->base_x,
window->base_y);
g_value_take_string (value, position);
break;
case PROP_DISABLE_STRUTS:
g_value_set_boolean (value, window->struts_disabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
panel_window_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PanelWindow *window = PANEL_WINDOW (object);
gboolean val_bool;
guint val_uint;
gdouble val_double;
const gchar *val_string;
gboolean update = FALSE;
gint x, y, snap_position;
GtkWidget *itembar;
switch (prop_id)
{
case PROP_HORIZONTAL:
val_bool = g_value_get_boolean (value);
if (window->horizontal != val_bool)
{
window->horizontal = !!val_bool;
panel_window_screen_layout_changed (window->screen, window);
}
/* send the new orientation to the panel plugins */
itembar = gtk_bin_get_child (GTK_BIN (window));
if (G_LIKELY (itembar != NULL))
gtk_container_foreach (GTK_CONTAINER (itembar),
panel_window_set_plugin_orientation, window);
/* send the new screen position */
if (G_LIKELY (itembar != NULL))
gtk_container_foreach (GTK_CONTAINER (itembar),
panel_window_set_plugin_screen_position, window);
break;
case PROP_SIZE:
val_uint = g_value_get_uint (value);
if (window->size != val_uint)
{
window->size = val_uint;
gtk_widget_queue_resize (GTK_WIDGET (window));
}
/* send the new size to the panel plugins */
itembar = gtk_bin_get_child (GTK_BIN (window));
if (G_LIKELY (itembar != NULL))
gtk_container_foreach (GTK_CONTAINER (itembar),
panel_window_set_plugin_size, window);
break;
case PROP_LENGTH:
val_double = g_value_get_uint (value) / 100.00;
if (window->length != val_double)
{
if (window->length == 1.00 || val_double == 1.00)
update = TRUE;
window->length = val_double;
if (update)
panel_window_screen_update_borders (window);
gtk_widget_queue_resize (GTK_WIDGET (window));
}
break;
case PROP_POSITION_LOCKED:
val_bool = g_value_get_boolean (value);
if (window->position_locked != val_bool)
{
window->position_locked = !!val_bool;
gtk_widget_queue_resize (GTK_WIDGET (window));
}
break;
case PROP_AUTOHIDE:
panel_window_set_autohide (window, g_value_get_boolean (value));
break;
case PROP_SPAN_MONITORS:
val_bool = g_value_get_boolean (value);
if (window->span_monitors != val_bool)
{
window->span_monitors = !!val_bool;
panel_window_screen_layout_changed (window->screen, window);
}
break;
case PROP_OUTPUT_NAME:
g_free (window->output_name);
val_string = g_value_get_string (value);
if (exo_str_is_empty (val_string))
window->output_name = NULL;
else
window->output_name = g_strdup (val_string);
panel_window_screen_layout_changed (window->screen, window);
break;
case PROP_POSITION:
val_string = g_value_get_string (value);
if (!exo_str_is_empty (val_string)
&& sscanf (val_string, "p=%d;x=%d;y=%d", &snap_position, &x, &y) == 3)
{
window->snap_position = CLAMP (snap_position, SNAP_POSITION_NONE, SNAP_POSITION_S);
window->base_x = x;
window->base_y = y;
13 years ago
panel_window_screen_layout_changed (window->screen, window);
/* send the new screen position to the panel plugins */
itembar = gtk_bin_get_child (GTK_BIN (window));
if (G_LIKELY (itembar != NULL))
gtk_container_foreach (GTK_CONTAINER (itembar),
panel_window_set_plugin_screen_position, window);
}
else
{
g_message ("no valid position defined");
}
break;
case PROP_DISABLE_STRUTS:
val_bool = g_value_get_boolean (value);
if (val_bool != window->struts_disabled)
{
window->struts_disabled = val_bool;
panel_window_screen_layout_changed (window->screen, window);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
13 years ago
}
}
static void
panel_window_finalize (GObject *object)
{
PanelWindow *window = PANEL_WINDOW (object);
/* stop running autohide timeout */
if (G_UNLIKELY (window->autohide_timeout_id != 0))
g_source_remove (window->autohide_timeout_id);
/* destroy the autohide window */
13 years ago
if (window->autohide_window != NULL)
gtk_widget_destroy (window->autohide_window);
g_free (window->output_name);
13 years ago
(*G_OBJECT_CLASS (panel_window_parent_class)->finalize) (object);
13 years ago
}
static gboolean
panel_window_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
PanelWindow *window = PANEL_WINDOW (widget);
cairo_t *cr;
GdkColor *color;
guint xx, yy, i;
gint xs, xe, ys, ye;
gint handle_w, handle_h;
gdouble alpha = 1.00;
GtkWidget *child;
13 years ago
/* expose the background and borders handled in PanelBaseWindow */
(*GTK_WIDGET_CLASS (panel_window_parent_class)->expose_event) (widget, event);
if (window->position_locked || !GTK_WIDGET_DRAWABLE (widget))
goto end;
if (window->horizontal)
13 years ago
{
handle_h = window->alloc.height / 2;
handle_w = HANDLE_SIZE;
xs = HANDLE_SPACING + 1;
xe = window->alloc.width - HANDLE_SIZE - HANDLE_SIZE;
ys = ye = (window->alloc.height - handle_h) / 2;
13 years ago
/* dirty check if we have to redraw the handles */
if (event->area.x > xs + HANDLE_SIZE
&& event->area.x + event->area.width < xe)
goto end;
}
else
{
handle_h = HANDLE_SIZE;
handle_w = window->alloc.width / 2;
xs = xe = (window->alloc.width - handle_w) / 2;
ys = HANDLE_SPACING + 1;
ye = window->alloc.height - HANDLE_SIZE - HANDLE_SIZE;
13 years ago
/* dirty check if we have to redraw the handles */
if (event->area.y > ys + HANDLE_SIZE
&& event->area.y + event->area.height < ye)
goto end;
}
13 years ago
/* create cairo context and set some default properties */
cr = gdk_cairo_create (widget->window);
panel_return_val_if_fail (cr != NULL, FALSE);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
13 years ago
/* clip the drawing area */
gdk_cairo_rectangle (cr, &event->area);
cairo_clip (cr);
13 years ago
/* alpha color */
if (PANEL_BASE_WINDOW (window)->is_composited)
alpha = MAX (0.50, PANEL_BASE_WINDOW (window)->background_alpha);
13 years ago
for (i = HANDLE_PIXELS; i >= HANDLE_PIXELS - 1; i--)
{
/* set the source color */
if (i == HANDLE_PIXELS)
color = &(widget->style->light[GTK_STATE_NORMAL]);
else
color = &(widget->style->dark[GTK_STATE_NORMAL]);
panel_util_set_source_rgba (cr, color, alpha);
13 years ago
/* draw the dots */
for (xx = 0; xx < (guint) handle_w; xx += HANDLE_PIXELS + HANDLE_PIXEL_SPACE)
for (yy = 0; yy < (guint) handle_h; yy += HANDLE_PIXELS + HANDLE_PIXEL_SPACE)
{
cairo_rectangle (cr, xs + xx, ys + yy, i, i);
cairo_rectangle (cr, xe + xx, ye + yy, i, i);
}
13 years ago
/* fill the rectangles */
cairo_fill (cr);
13 years ago
}
cairo_destroy (cr);
end:
/* send the expose event to the child */
child = gtk_bin_get_child (GTK_BIN (widget));
if (G_LIKELY (child != NULL))
gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event);
13 years ago
return FALSE;
}
static gboolean
panel_window_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
13 years ago
{
PanelWindow *window = PANEL_WINDOW (widget);
13 years ago
/* update autohide status */
if (event->detail != GDK_NOTIFY_INFERIOR
&& window->autohide_state != AUTOHIDE_DISABLED)
13 years ago
{
/* stop a running autohide timeout */
if (window->autohide_timeout_id != 0)
g_source_remove (window->autohide_timeout_id);
13 years ago
/* update autohide status */
if (window->autohide_state == AUTOHIDE_POPDOWN)
window->autohide_state = AUTOHIDE_VISIBLE;
13 years ago
}
return (*GTK_WIDGET_CLASS (panel_window_parent_class)->enter_notify_event) (widget, event);
}
static gboolean
panel_window_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
{
PanelWindow *window = PANEL_WINDOW (widget);
/* queue an autohide timeout if needed */
if (event->detail != GDK_NOTIFY_INFERIOR
&& window->autohide_state != AUTOHIDE_DISABLED
&& window->autohide_state != AUTOHIDE_BLOCKED)
panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
13 years ago
return (*GTK_WIDGET_CLASS (panel_window_parent_class)->leave_notify_event) (widget, event);
13 years ago
}
static gboolean
panel_window_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint drag_time)
{
if ((*GTK_WIDGET_CLASS (panel_window_parent_class)->drag_motion) != NULL)
(*GTK_WIDGET_CLASS (panel_window_parent_class)->drag_motion) (widget, context, x, y, drag_time);
return TRUE;
}
static void
panel_window_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint drag_time)
{
PanelWindow *window = PANEL_WINDOW (widget);
/* queue an autohide timeout if needed */
if (window->autohide_state == AUTOHIDE_VISIBLE)
panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
}
13 years ago
static gboolean
panel_window_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event)
13 years ago
{
PanelWindow *window = PANEL_WINDOW (widget);
gint pointer_x, pointer_y;
gint window_x, window_y;
gint high;
13 years ago
/* leave when the pointer is not grabbed */
if (G_UNLIKELY (window->grab_time == 0))
return FALSE;
/* get the pointer position from the event */
pointer_x = event->x_root;
pointer_y = event->y_root;
/* check if the pointer moved to another monitor */
if (!window->span_monitors