Fri, 05 Mar 2021 03:31:29 -0600
Create a PidginAvatar widget.
This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.
The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.
Testing Done:
Ran locally.
Reviewed at https://reviews.imfreedom.org/r/528/
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1 | /* pidgin |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2 | * |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
5 | * source distribution. |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
6 | * |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
15 | * GNU General Public License for more details. |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
21 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
23 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40315
diff
changeset
|
24 | #include <purple.h> |
|
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40315
diff
changeset
|
25 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | #include "pidgintooltip.h" |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
28 | static gboolean enable_tooltips; |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
29 | static int tooltip_delay = -1; |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
30 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
31 | struct |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | GtkWidget *widget; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | int timeout; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | GdkRectangle tip_rect; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | GtkWidget *tipwindow; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | PidginTooltipPaint paint_tooltip; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
38 | } pidgin_tooltip; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
39 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | typedef struct |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
41 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | GtkWidget *widget; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
43 | gpointer userdata; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
44 | PidginTooltipPaint paint_tooltip; |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
45 | union { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
46 | struct { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
47 | PidginTooltipCreateForTree create_tooltip; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
48 | GtkTreePath *path; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
49 | } treeview; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
50 | struct { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
51 | PidginTooltipCreate create_tooltip; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
52 | } widget; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
53 | } common; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
54 | } PidginTooltipData; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
55 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | static void |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
57 | initialize_tooltip_delay() |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
58 | { |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
59 | GtkSettings *settings; |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
60 | |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
61 | if (tooltip_delay != -1) |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
62 | return; |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
63 | |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
64 | settings = gtk_settings_get_default(); |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
65 | |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
66 | g_object_get(settings, "gtk-enable-tooltips", &enable_tooltips, NULL); |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
67 | g_object_get(settings, "gtk-tooltip-timeout", &tooltip_delay, NULL); |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
68 | } |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
69 | |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
70 | static void |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
71 | destroy_tooltip_data(PidginTooltipData *data) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
72 | { |
|
25435
812799377532
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <datallah@pidgin.im>
parents:
24566
diff
changeset
|
73 | if (data->common.treeview.path) |
|
812799377532
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <datallah@pidgin.im>
parents:
24566
diff
changeset
|
74 | gtk_tree_path_free(data->common.treeview.path); |
|
23901
fb9610ea214c
Jan Kratochvil noticed there was a race condition in the treeview tooltip
Daniel Atallah <datallah@pidgin.im>
parents:
22104
diff
changeset
|
75 | pidgin_tooltip_destroy(); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
76 | g_free(data); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
77 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
78 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
79 | void pidgin_tooltip_destroy() |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
80 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
81 | if (pidgin_tooltip.timeout > 0) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
82 | g_source_remove(pidgin_tooltip.timeout); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
83 | pidgin_tooltip.timeout = 0; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
84 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
85 | if (pidgin_tooltip.tipwindow) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
86 | gtk_widget_destroy(pidgin_tooltip.tipwindow); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
87 | pidgin_tooltip.tipwindow = NULL; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
88 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
89 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
90 | |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
91 | static gboolean |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
92 | pidgin_tooltip_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
93 | { |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
94 | GtkAllocation allocation; |
|
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
95 | |
|
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
96 | gtk_widget_get_allocation(widget, &allocation); |
|
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
97 | |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
98 | if (pidgin_tooltip.paint_tooltip) { |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
99 | GtkStyleContext *context = gtk_widget_get_style_context(widget); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
100 | gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
101 | gtk_render_background(context, cr, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
102 | 0, 0, allocation.width, allocation.height); |
|
33161
c248c062f272
Pass the cairo context to the tooltip paint function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33133
diff
changeset
|
103 | pidgin_tooltip.paint_tooltip(widget, cr, data); |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
104 | } |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
105 | return FALSE; |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
106 | } |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
107 | |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
108 | static GtkWidget* |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
22064
diff
changeset
|
109 | setup_tooltip_window(void) |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
110 | { |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
111 | const char *name; |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
112 | GtkWidget *tipwindow; |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
113 | |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
114 | tipwindow = gtk_window_new(GTK_WINDOW_POPUP); |
|
40122
a46888708fd7
Set tooltips to be transient for the buddy list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39945
diff
changeset
|
115 | gtk_window_set_transient_for(GTK_WINDOW(tipwindow), |
|
a46888708fd7
Set tooltips to be transient for the buddy list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39945
diff
changeset
|
116 | GTK_WINDOW(pidgin_tooltip.widget)); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
117 | name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget)); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
118 | gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
119 | gtk_widget_set_app_paintable(tipwindow, TRUE); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
120 | gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip")); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
121 | gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
122 | gtk_widget_set_name(tipwindow, "gtk-tooltips"); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
123 | gtk_widget_ensure_style(tipwindow); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
124 | gtk_widget_realize(tipwindow); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
125 | return tipwindow; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
126 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
127 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
128 | static void |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
129 | setup_tooltip_window_position(gpointer data, int w, int h) |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
130 | { |
|
25605
85d2115907ac
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25435
diff
changeset
|
131 | int scr_w, scr_h, x, y, dy; |
|
31817
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
132 | int preserved_x, preserved_y; |
|
40315
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
133 | GdkDisplay *display = NULL; |
|
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
134 | GdkSeat *seat = NULL; |
|
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
135 | GdkMonitor *monitor = NULL; |
|
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
136 | GdkDevice *dev = NULL; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
137 | GdkRectangle mon_size; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
138 | GtkWidget *tipwindow = pidgin_tooltip.tipwindow; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29499
diff
changeset
|
139 | |
|
40315
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
140 | display = gdk_display_get_default(); |
|
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
141 | seat = gdk_display_get_default_seat(display); |
|
39945
a463a1d03965
Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37555
diff
changeset
|
142 | dev = gdk_seat_get_pointer(seat); |
|
40315
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
143 | gdk_device_get_position(dev, NULL, &x, &y); |
|
35532
2c802bb77720
Fix most of warnings for gtk 3.4
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
144 | |
|
40315
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
145 | monitor = gdk_display_get_monitor_at_point(display, x, y); |
|
6746d9b67b3e
Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents:
40122
diff
changeset
|
146 | gdk_monitor_get_geometry(monitor, &mon_size); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
147 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | scr_w = mon_size.width + mon_size.x; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | scr_h = mon_size.height + mon_size.y; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
150 | |
|
25605
85d2115907ac
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25435
diff
changeset
|
151 | dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; |
|
85d2115907ac
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25435
diff
changeset
|
152 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | if (w > mon_size.width) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | w = mon_size.width - 10; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | if (h > mon_size.height) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
157 | h = mon_size.height - 10; |
|
29499
08832cbd946b
Kill off more GTK_CHECK_VERSION uses that we don't need anymore. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25607
diff
changeset
|
158 | |
|
31817
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
159 | preserved_x = x; |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
160 | preserved_y = y; |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
161 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | x -= ((w >> 1) + 4); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | if ((y + h + 4) > scr_h) |
|
25605
85d2115907ac
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25435
diff
changeset
|
165 | y = y - h - dy - 5; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
166 | else |
|
25605
85d2115907ac
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25435
diff
changeset
|
167 | y = y + dy + 6; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
168 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | if (y < mon_size.y) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
170 | y = mon_size.y; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
171 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | if (y != mon_size.y) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | if ((x + w) > scr_w) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
174 | x -= (x + w + 5) - scr_w; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
175 | else if (x < mon_size.x) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | x = mon_size.x; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | } else { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
178 | x -= (w / 2 + 10); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
179 | if (x < mon_size.x) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
180 | x = mon_size.x; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
181 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
182 | |
|
31817
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
183 | /* If the mouse covered by the tipwindow, move the tipwindow |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
184 | * to the righ side of the it */ |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
185 | if ((preserved_x >= x) && (preserved_x <= (x + w)) |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
186 | && (preserved_y >= y) && (preserved_y <= (y + h))) |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
187 | x = preserved_x + dy; |
|
76d8052104d4
Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31294
diff
changeset
|
188 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
189 | gtk_widget_set_size_request(tipwindow, w, h); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
190 | gtk_window_move(GTK_WINDOW(tipwindow), x, y); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
191 | gtk_widget_show(tipwindow); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
193 | g_signal_connect(G_OBJECT(tipwindow), "draw", |
|
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
194 | G_CALLBACK(pidgin_tooltip_draw_cb), data); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
195 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
196 | /* Hide the tooltip when the widget is destroyed */ |
|
37555
074df5eb09a2
Silence warning when tooltip's tipwindow is destroyed before widget
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
197 | g_signal_connect_object(G_OBJECT(pidgin_tooltip.widget), |
|
074df5eb09a2
Silence warning when tooltip's tipwindow is destroyed before widget
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
198 | "destroy", G_CALLBACK(pidgin_tooltip_destroy), |
|
074df5eb09a2
Silence warning when tooltip's tipwindow is destroyed before widget
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
199 | G_OBJECT(tipwindow), 0); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
200 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
201 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
202 | void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | PidginTooltipCreate create_tooltip, PidginTooltipPaint paint_tooltip) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
204 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
205 | GtkWidget *tipwindow; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
206 | int w, h; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
207 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
208 | pidgin_tooltip_destroy(); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
209 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
210 | pidgin_tooltip.widget = gtk_widget_get_toplevel(widget); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
211 | pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
212 | pidgin_tooltip.paint_tooltip = paint_tooltip; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | if (!create_tooltip(tipwindow, userdata, &w, &h)) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | pidgin_tooltip_destroy(); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
216 | return; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | } |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
218 | setup_tooltip_window_position(userdata, w, h); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
219 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
221 | static void |
|
21997
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
222 | reset_data_treepath(PidginTooltipData *data) |
|
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
223 | { |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
224 | gtk_tree_path_free(data->common.treeview.path); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
225 | data->common.treeview.path = NULL; |
|
21997
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
226 | } |
|
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
227 | |
|
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
228 | static void |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
229 | pidgin_tooltip_draw(PidginTooltipData *data) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
230 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
231 | GtkWidget *tipwindow; |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
232 | int w, h; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
233 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
234 | pidgin_tooltip_destroy(); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
235 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
236 | pidgin_tooltip.widget = gtk_widget_get_toplevel(data->widget); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
237 | pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
238 | pidgin_tooltip.paint_tooltip = data->paint_tooltip; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
239 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
240 | if (!data->common.widget.create_tooltip(tipwindow, data->userdata, &w, &h)) { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
241 | if (tipwindow == pidgin_tooltip.tipwindow) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
242 | pidgin_tooltip_destroy(); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
243 | return; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
244 | } |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
245 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
246 | setup_tooltip_window_position(data->userdata, w, h); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
247 | } |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
248 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
249 | static void |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
250 | pidgin_tooltip_draw_tree(PidginTooltipData *data) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
251 | { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
252 | GtkWidget *tipwindow; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
253 | GtkTreePath *path = NULL; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
254 | int w, h; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
255 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
256 | if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(data->widget), |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
257 | pidgin_tooltip.tip_rect.x, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
258 | pidgin_tooltip.tip_rect.y + (pidgin_tooltip.tip_rect.height/2), |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
259 | &path, NULL, NULL, NULL)) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
260 | pidgin_tooltip_destroy(); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
261 | return; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
262 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
263 | |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
264 | if (data->common.treeview.path) { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
265 | if (gtk_tree_path_compare(data->common.treeview.path, path) == 0) { |
|
21994
6ff974b162c0
Plug a leak. And a patch from 'js' to fix tooltips in compiz fusion. References #4323.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21993
diff
changeset
|
266 | gtk_tree_path_free(path); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
267 | return; |
|
21994
6ff974b162c0
Plug a leak. And a patch from 'js' to fix tooltips in compiz fusion. References #4323.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21993
diff
changeset
|
268 | } |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
269 | gtk_tree_path_free(data->common.treeview.path); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
270 | data->common.treeview.path = NULL; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
271 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
272 | |
|
21993
3fdb200f15bb
Make sure an old tooltip is destroyed before creating a new one.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21903
diff
changeset
|
273 | pidgin_tooltip_destroy(); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
274 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
275 | pidgin_tooltip.widget = gtk_widget_get_toplevel(data->widget); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
276 | pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
277 | pidgin_tooltip.paint_tooltip = data->paint_tooltip; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
278 | |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
279 | if (!data->common.treeview.create_tooltip(tipwindow, path, data->userdata, &w, &h)) { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
280 | if (tipwindow == pidgin_tooltip.tipwindow) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
281 | pidgin_tooltip_destroy(); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
282 | gtk_tree_path_free(path); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
283 | return; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
284 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
285 | |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
286 | setup_tooltip_window_position(data->userdata, w, h); |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
287 | |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
288 | data->common.treeview.path = path; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
289 | g_signal_connect_swapped(G_OBJECT(pidgin_tooltip.tipwindow), "destroy", |
|
21997
08bc3d1daa99
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21994
diff
changeset
|
290 | G_CALLBACK(reset_data_treepath), data); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
291 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
292 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
293 | static gboolean |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
294 | pidgin_tooltip_timeout(gpointer data) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
295 | { |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
296 | PidginTooltipData *tdata = data; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
297 | pidgin_tooltip.timeout = 0; |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
298 | if (GTK_IS_TREE_VIEW(tdata->widget)) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
299 | pidgin_tooltip_draw_tree(data); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
300 | else |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
301 | pidgin_tooltip_draw(data); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
302 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
303 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
304 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
305 | static gboolean |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
306 | row_motion_cb(GtkWidget *tv, GdkEventMotion *event, gpointer userdata) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
307 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
308 | GtkTreePath *path; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
309 | |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
310 | if (event->window != gtk_tree_view_get_bin_window(GTK_TREE_VIEW(tv))) |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
311 | return FALSE; /* The cursor is probably on the TreeView's header. */ |
|
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
312 | |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
313 | initialize_tooltip_delay(); |
|
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
314 | if (!enable_tooltips) |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
315 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
316 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
317 | if (pidgin_tooltip.timeout) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
318 | if ((event->y >= pidgin_tooltip.tip_rect.y) && ((event->y - pidgin_tooltip.tip_rect.height) <= pidgin_tooltip.tip_rect.y)) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
319 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
320 | /* We've left the cell. Remove the timeout and create a new one below */ |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
321 | pidgin_tooltip_destroy(); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
322 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
323 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
324 | gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
325 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
326 | if (path == NULL) { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
327 | pidgin_tooltip_destroy(); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
328 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
329 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
330 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
331 | gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &pidgin_tooltip.tip_rect); |
|
21998
3dbae318c88d
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21997
diff
changeset
|
332 | gtk_tree_path_free(path); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
333 | |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
334 | pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, userdata); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
335 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
336 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
337 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
338 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
339 | static gboolean |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
340 | widget_leave_cb(GtkWidget *tv, GdkEvent *event, gpointer userdata) |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
341 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
342 | pidgin_tooltip_destroy(); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
343 | return FALSE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
344 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
345 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
346 | gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
347 | PidginTooltipCreateForTree create_tooltip, PidginTooltipPaint paint_tooltip) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
348 | { |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
349 | PidginTooltipData *tdata = g_new0(PidginTooltipData, 1); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
350 | tdata->widget = tree; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
351 | tdata->userdata = userdata; |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
352 | tdata->common.treeview.create_tooltip = create_tooltip; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
353 | tdata->paint_tooltip = paint_tooltip; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
354 | |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
355 | g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), tdata); |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
356 | g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); |
|
25607
ce654025996e
Prevent tooltips from lingering while scrolling in the buddy list window.
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25605
diff
changeset
|
357 | g_signal_connect(G_OBJECT(tree), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
358 | g_signal_connect_swapped(G_OBJECT(tree), "destroy", G_CALLBACK(destroy_tooltip_data), tdata); |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
359 | return TRUE; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
360 | } |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
361 | |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
362 | static gboolean |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
363 | widget_motion_cb(GtkWidget *widget, GdkEvent *event, gpointer data) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
364 | { |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
365 | initialize_tooltip_delay(); |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
366 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
367 | pidgin_tooltip_destroy(); |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
368 | if (!enable_tooltips) |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
369 | return FALSE; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
370 | |
|
24558
7d4379a9536e
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents:
23901
diff
changeset
|
371 | pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, data); |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
372 | return FALSE; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
373 | } |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
374 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
375 | gboolean pidgin_tooltip_setup_for_widget(GtkWidget *widget, gpointer userdata, |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
376 | PidginTooltipCreate create_tooltip, PidginTooltipPaint paint_tooltip) |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
377 | { |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
378 | PidginTooltipData *wdata = g_new0(PidginTooltipData, 1); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
379 | wdata->widget = widget; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
380 | wdata->userdata = userdata; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
381 | wdata->common.widget.create_tooltip = create_tooltip; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
382 | wdata->paint_tooltip = paint_tooltip; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
383 | |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
384 | g_signal_connect(G_OBJECT(widget), "motion-notify-event", G_CALLBACK(widget_motion_cb), wdata); |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
385 | g_signal_connect(G_OBJECT(widget), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); |
|
25607
ce654025996e
Prevent tooltips from lingering while scrolling in the buddy list window.
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25605
diff
changeset
|
386 | g_signal_connect(G_OBJECT(widget), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); |
|
25435
812799377532
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <datallah@pidgin.im>
parents:
24566
diff
changeset
|
387 | g_signal_connect_swapped(G_OBJECT(widget), "destroy", G_CALLBACK(destroy_tooltip_data), wdata); |
|
22064
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
388 | return TRUE; |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
389 | } |
|
8b35fd51087d
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22022
diff
changeset
|
390 |