@@ -1672,76 +1672,6 @@ status_icon_popup_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer dat
16721672#define OUTPUT_TITLE_ITEM_BORDER 2
16731673#define OUTPUT_TITLE_ITEM_PADDING 4
16741674
1675- /* This is an expose-event hander for the title label for each MateRROutput.
1676- * We want each title to have a colored background, so we paint that background, then
1677- * return FALSE to let GtkLabel expose itself (i.e. paint the label's text), and then
1678- * we have a signal_connect_after handler as well. See the comments below
1679- * to see why that "after" handler is needed.
1680- */
1681- static gboolean
1682- output_title_label_draw_cb (GtkWidget * widget , cairo_t * cr , gpointer data )
1683- {
1684- MsdXrandrManager * manager = MSD_XRANDR_MANAGER (data );
1685- struct MsdXrandrManagerPrivate * priv = manager -> priv ;
1686- MateRROutputInfo * output ;
1687- GdkRGBA color ;
1688- GtkAllocation allocation ;
1689-
1690- g_assert (GTK_IS_LABEL (widget ));
1691-
1692- output = g_object_get_data (G_OBJECT (widget ), "output" );
1693- g_assert (output != NULL );
1694-
1695- g_assert (priv -> labeler != NULL );
1696-
1697- /* Draw a black rectangular border, filled with the color that corresponds to this output */
1698- mate_rr_labeler_get_rgba_for_output (priv -> labeler , output , & color );
1699-
1700- cairo_set_source_rgb (cr , 0 , 0 , 0 );
1701- cairo_set_line_width (cr , OUTPUT_TITLE_ITEM_BORDER );
1702- gtk_widget_get_allocation (widget , & allocation );
1703- cairo_rectangle (cr ,
1704- allocation .x + OUTPUT_TITLE_ITEM_BORDER / 2.0 ,
1705- allocation .y + OUTPUT_TITLE_ITEM_BORDER / 2.0 ,
1706- allocation .width - OUTPUT_TITLE_ITEM_BORDER ,
1707- allocation .height - OUTPUT_TITLE_ITEM_BORDER );
1708- cairo_stroke (cr );
1709-
1710- gdk_cairo_set_source_rgba (cr , & color );
1711- cairo_rectangle (cr ,
1712- allocation .x + OUTPUT_TITLE_ITEM_BORDER ,
1713- allocation .y + OUTPUT_TITLE_ITEM_BORDER ,
1714- allocation .width - 2 * OUTPUT_TITLE_ITEM_BORDER ,
1715- allocation .height - 2 * OUTPUT_TITLE_ITEM_BORDER );
1716-
1717- cairo_fill (cr );
1718-
1719- /* We want the label to always show up as if it were sensitive
1720- * ("style->fg[GTK_STATE_NORMAL]"), even though the label is insensitive
1721- * due to being inside an insensitive menu item. So, here we have a
1722- * HACK in which we frob the label's state directly. GtkLabel's expose
1723- * handler will be run after this function, so it will think that the
1724- * label is in GTK_STATE_NORMAL. We reset the label's state back to
1725- * insensitive in output_title_label_after_expose_event_cb().
1726- *
1727- * Yay for fucking with GTK+'s internals.
1728- */
1729-
1730- gtk_widget_set_state (widget , GTK_STATE_NORMAL );
1731-
1732- return FALSE;
1733- }
1734-
1735- /* See the comment in output_title_event_box_expose_event_cb() about this funny label widget */
1736- static gboolean
1737- output_title_label_after_draw_cb (GtkWidget * widget , cairo_t * cr , gpointer data )
1738- {
1739- g_assert (GTK_IS_LABEL (widget ));
1740- gtk_widget_set_state (widget , GTK_STATE_INSENSITIVE );
1741-
1742- return FALSE;
1743- }
1744-
17451675static void
17461676title_item_size_allocate_cb (GtkWidget * widget , GtkAllocation * allocation , gpointer data )
17471677{
@@ -1808,17 +1738,6 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *ou
18081738
18091739 gtk_container_add (GTK_CONTAINER (item ), label );
18101740
1811- /* We want to paint a colored box as the background of the label, so we connect
1812- * to its expose-event signal. See the comment in *** to see why need to connect
1813- * to the label both 'before' and 'after'.
1814- */
1815- g_signal_connect (label , "draw" ,
1816- G_CALLBACK (output_title_label_draw_cb ), manager );
1817- g_signal_connect_after (label , "draw" ,
1818- G_CALLBACK (output_title_label_after_draw_cb ) , manager );
1819-
1820- g_object_set_data (G_OBJECT (label ), "output" , output );
1821-
18221741 gtk_widget_set_sensitive (item , FALSE); /* the title is not selectable */
18231742 gtk_widget_show_all (item );
18241743
0 commit comments