After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761828 - add a menu demo to foreigndrawing
add a menu demo to foreigndrawing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-02-10 13:54 UTC by Caolan McNamara
Modified: 2016-02-10 21:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to add a menu demo to foreigndrawing (4.67 KB, patch)
2016-02-10 13:54 UTC, Caolan McNamara
none Details | Review
updated patch (4.68 KB, patch)
2016-02-10 17:21 UTC, Caolan McNamara
committed Details | Review

Description Caolan McNamara 2016-02-10 13:54:45 UTC
Created attachment 320802 [details] [review]
patch to add a menu demo to foreigndrawing

Setting GTK_STATE_FLAG_DIR_LTR/GTK_STATE_FLAG_DIR_RTL is required to get block arrows in menu context. Hacking foreigndrawing enabled me to realize that, so seems useful to add a menu demo there permanently.
Comment 1 Emmanuele Bassi (:ebassi) 2016-02-10 14:02:34 UTC
Review of attachment 320802 [details] [review]:

Looks interesting.

Minor coding style fixes.

::: demos/gtk-demo/foreigndrawing.c
@@ +157,3 @@
+  /* arrow for left to right */
+  arrowmenuitem_context = get_style (menuitem_context, "arrow");
+  /* This information is taken from the GtkMenu docs, see "CSS nodes" */

Coding style: missing space between function name and open parenthesis.

@@ +158,3 @@
+  arrowmenuitem_context = get_style (menuitem_context, "arrow");
+  gtk_style_context_set_state(arrowmenuitem_context, GTK_STATE_FLAG_DIR_LTR);
+  menu_context = get_style (NULL, "menu");

Coding style: missing space between function name and open parenthesis.

Coding style: missing spaces around operators.

@@ +161,3 @@
+
+  gtk_render_background (menuitem_context, cr, x, y+20, width, 20);
+

Coding style: missing spaces around operators.

@@ +163,3 @@
+  gtk_render_frame (menuitem_context, cr, x, y+20, width, 20);
+
+  gtk_render_background (menu_context, cr, x, y, width, height);

Coding style: same as above.

@@ +329,2 @@
   width = gtk_widget_get_allocated_width (widget);
+  panewidth = width/2;

Coding style: missing spaces around operator.

@@ +348,3 @@
+  draw_progress (widget, cr, 10, 160, panewidth - 20, 6, 50);
+
+  draw_menu(widget, cr, 10 + panewidth, 10, panewidth - 20, 160);

Coding style: missing space between function name and open parenthesis.
Comment 2 Caolan McNamara 2016-02-10 17:21:50 UTC
Created attachment 320809 [details] [review]
updated patch