Add gtk_status_icon_get_screen and gtk_status_icon_set_screen.
2006-12-27 Tor Lillqvist <tml@novell.com> * gtk/gtk.symbols: Add gtk_status_icon_get_screen and gtk_status_icon_set_screen. * gtk/gtkstatusicon.c: Implement gtk_status_icon_position_menu() on Windows. Keep track of where the last button click on the taskbar icon took place, and return that. Obviously not correct if no button has ever been clicked on the icon, or if the geometry of the taskbar has changed since. But for most use cases where a menu is going to be displayed as a direct result of a button click on the status icon, works fine. (#377349) Implement getting the orientation property on Windows. (gtk_status_icon_embedded_changed) (gtk_status_icon_orientation_changed): Ifdefify these functions that are used only on X11.
This commit is contained in:
committed by
Tor Lillqvist
parent
6d9dac29d0
commit
cc89cf541f
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
|||||||
|
2006-12-27 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* gtk/gtk.symbols: Add gtk_status_icon_get_screen and
|
||||||
|
gtk_status_icon_set_screen.
|
||||||
|
|
||||||
|
* gtk/gtkstatusicon.c: Implement gtk_status_icon_position_menu()
|
||||||
|
on Windows. Keep track of where the last button click on the
|
||||||
|
taskbar icon took place, and return that. Obviously not correct if
|
||||||
|
no button has ever been clicked on the icon, or if the geometry of
|
||||||
|
the taskbar has changed since. But for most use cases where a menu
|
||||||
|
is going to be displayed as a direct result of a button click on
|
||||||
|
the status icon, works fine. (#377349)
|
||||||
|
|
||||||
|
Implement getting the orientation property on Windows.
|
||||||
|
|
||||||
|
(gtk_status_icon_embedded_changed)
|
||||||
|
(gtk_status_icon_orientation_changed): Ifdefify these functions
|
||||||
|
that are used only on X11.
|
||||||
|
|
||||||
2006-12-27 Tor Lillqvist <tml@novell.com>
|
2006-12-27 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* gtk/gtkfilesystemwin32.c (execute_callbacks): Fix
|
* gtk/gtkfilesystemwin32.c (execute_callbacks): Fix
|
||||||
|
|||||||
@ -1062,9 +1062,11 @@ gtk_status_icon_set_from_stock
|
|||||||
gtk_status_icon_set_from_icon_name
|
gtk_status_icon_set_from_icon_name
|
||||||
gtk_status_icon_get_storage_type
|
gtk_status_icon_get_storage_type
|
||||||
gtk_status_icon_get_pixbuf
|
gtk_status_icon_get_pixbuf
|
||||||
|
gtk_status_icon_get_screen
|
||||||
gtk_status_icon_get_stock
|
gtk_status_icon_get_stock
|
||||||
gtk_status_icon_get_icon_name
|
gtk_status_icon_get_icon_name
|
||||||
gtk_status_icon_get_size
|
gtk_status_icon_get_size
|
||||||
|
gtk_status_icon_set_screen
|
||||||
gtk_status_icon_set_tooltip
|
gtk_status_icon_set_tooltip
|
||||||
gtk_status_icon_set_visible
|
gtk_status_icon_set_visible
|
||||||
gtk_status_icon_get_visible
|
gtk_status_icon_get_visible
|
||||||
|
|||||||
@ -99,6 +99,8 @@ struct _GtkStatusIconPrivate
|
|||||||
#ifdef GDK_WINDOWING_WIN32
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
GtkWidget *dummy_widget;
|
GtkWidget *dummy_widget;
|
||||||
NOTIFYICONDATAW nid;
|
NOTIFYICONDATAW nid;
|
||||||
|
gint last_click_x, last_click_y;
|
||||||
|
GtkOrientation orientation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_QUARTZ
|
#ifdef GDK_WINDOWING_QUARTZ
|
||||||
@ -354,9 +356,10 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
|
|||||||
#ifdef GDK_WINDOWING_WIN32
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_button_event (GdkEventButton *e,
|
build_button_event (GtkStatusIconPrivate *priv,
|
||||||
GdkEventType type,
|
GdkEventButton *e,
|
||||||
guint button)
|
GdkEventType type,
|
||||||
|
guint button)
|
||||||
{
|
{
|
||||||
POINT pos;
|
POINT pos;
|
||||||
GdkRectangle monitor0;
|
GdkRectangle monitor0;
|
||||||
@ -368,8 +371,8 @@ build_button_event (GdkEventButton *e,
|
|||||||
e->send_event = TRUE;
|
e->send_event = TRUE;
|
||||||
e->time = GetTickCount ();
|
e->time = GetTickCount ();
|
||||||
GetCursorPos (&pos);
|
GetCursorPos (&pos);
|
||||||
e->x = pos.x + monitor0.x;
|
priv->last_click_x = e->x = pos.x + monitor0.x;
|
||||||
e->y = pos.y + monitor0.y;
|
priv->last_click_y = e->y = pos.y + monitor0.y;
|
||||||
e->axes = NULL;
|
e->axes = NULL;
|
||||||
e->state = 0;
|
e->state = 0;
|
||||||
e->button = button;
|
e->button = button;
|
||||||
@ -393,7 +396,7 @@ wndproc (HWND hwnd,
|
|||||||
{
|
{
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
build_button_event (&e, GDK_BUTTON_PRESS,
|
build_button_event (status_icon->priv, &e, GDK_BUTTON_PRESS,
|
||||||
(lparam == WM_LBUTTONDOWN) ? 1 : 3);
|
(lparam == WM_LBUTTONDOWN) ? 1 : 3);
|
||||||
gtk_status_icon_button_press (status_icon, &e);
|
gtk_status_icon_button_press (status_icon, &e);
|
||||||
break;
|
break;
|
||||||
@ -488,21 +491,19 @@ gtk_status_icon_init (GtkStatusIcon *status_icon)
|
|||||||
|
|
||||||
#ifdef GDK_WINDOWING_WIN32
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
|
|
||||||
/* Code to get position and orientation of Windows taskbar. Not needed
|
/* Get position and orientation of Windows taskbar. */
|
||||||
* currently, kept for reference.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
{
|
{
|
||||||
APPBARDATA abd;
|
APPBARDATA abd;
|
||||||
|
|
||||||
abd.cbSize = sizeof (abd);
|
abd.cbSize = sizeof (abd);
|
||||||
SHAppBarMessage (ABM_GETTASKBARPOS, &abd);
|
SHAppBarMessage (ABM_GETTASKBARPOS, &abd);
|
||||||
if (abd.rc.bottom - abd.rc.top > abd.rc.right - abd.rc.left)
|
if (abd.rc.bottom - abd.rc.top > abd.rc.right - abd.rc.left)
|
||||||
orientation = GTK_ORIENTATION_VERTICAL;
|
priv->orientation = GTK_ORIENTATION_VERTICAL;
|
||||||
else
|
else
|
||||||
orientation = GTK_ORIENTATION_HORIZONTAL;
|
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
priv->last_click_x = priv->last_click_y = 0;
|
||||||
|
|
||||||
/* Are the system tray icons always 16 pixels square? */
|
/* Are the system tray icons always 16 pixels square? */
|
||||||
priv->size = 16;
|
priv->size = 16;
|
||||||
@ -669,7 +670,12 @@ gtk_status_icon_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, gtk_status_icon_is_embedded (status_icon));
|
g_value_set_boolean (value, gtk_status_icon_is_embedded (status_icon));
|
||||||
break;
|
break;
|
||||||
case PROP_ORIENTATION:
|
case PROP_ORIENTATION:
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
g_value_set_enum (value, _gtk_tray_icon_get_orientation (status_icon->priv->tray_icon));
|
g_value_set_enum (value, _gtk_tray_icon_get_orientation (status_icon->priv->tray_icon));
|
||||||
|
#endif
|
||||||
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
|
g_value_set_enum (value, status_icon->priv->orientation);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -1124,6 +1130,8 @@ gtk_status_icon_screen_changed (GtkStatusIcon *status_icon,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon)
|
gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon)
|
||||||
{
|
{
|
||||||
@ -1136,6 +1144,8 @@ gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon)
|
|||||||
g_object_notify (G_OBJECT (status_icon), "orientation");
|
g_object_notify (G_OBJECT (status_icon), "orientation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_status_icon_button_press (GtkStatusIcon *status_icon,
|
gtk_status_icon_button_press (GtkStatusIcon *status_icon,
|
||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
@ -1864,6 +1874,21 @@ gtk_status_icon_position_menu (GtkMenu *menu,
|
|||||||
|
|
||||||
*push_in = FALSE;
|
*push_in = FALSE;
|
||||||
#endif /* GDK_WINDOWING_X11 */
|
#endif /* GDK_WINDOWING_X11 */
|
||||||
|
|
||||||
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
|
GtkStatusIcon *status_icon;
|
||||||
|
GtkStatusIconPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_MENU (menu));
|
||||||
|
g_return_if_fail (GTK_IS_STATUS_ICON (user_data));
|
||||||
|
|
||||||
|
status_icon = GTK_STATUS_ICON (user_data);
|
||||||
|
priv = status_icon->priv;
|
||||||
|
|
||||||
|
*x = priv->last_click_x;
|
||||||
|
*y = priv->last_click_y;
|
||||||
|
*push_in = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user