<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Menu doesn&#39;t show in linux - Allegro 5</title>
		<link>http://www.allegro.cc/forums/view/618484</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 22 Aug 2021 23:11:01 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, i don&#39;t know why, but the dialog interface of Allegro 5 isn&#39;t showing the menu in linux. I tried fedora and ubuntu. It shows up in Windows but not linuxes.</p><p>Any idea?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Thu, 19 Aug 2021 13:48:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Could you give a bit more context? What function are you calling? Do you have some sample code? What do you expect to happen exactly?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Thu, 19 Aug 2021 14:55:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Linux needs GTK3+, and there is one menu function that I believe doesn&#39;t work.</p><p>We need more details please.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 19 Aug 2021 22:30:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Im creating a simple menu using allegro DIALOG functions. Since &quot;OpenFileDialog()&quot; in win32 worked in Windows through Allegro, i mean it showed fine the dialog in linux. So when i created the allegro window menu i tought that in the VM or Real Machine would show the menu in my window, but it doesn&#39;t. </p><p>Maybe im compiling with different versions of Allegro?? i don&#39;t know im not to savy to linux, </p><p>The program compiles fine under linux using g++ and allegro libs, but could it be a version problem?</p><p>I have 2 VM of linux: one for Fedora 34 and the other one for Ubuntu 12.04. I have a real dual booting installation of Win 10 and Ubuntu.</p><p>My code basically creates a menu and appends other menus to it (no bitmap, no special things). I think code isn&#39;t needed since it&#39;s too basic.</p><p>Thanks in advance
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Fri, 20 Aug 2021 07:47:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey Lucas,</p><ul><li><p><a href="https://liballeg.org/stabledocs/en/alleg035.html">DIALOG</a> is a Allegro 4 thing, not Allegro 5. Can you confirm your Allegro version? Is it allegro 4 or 5?
</p></li><li><p>In Allegro 5, you would show a file dialog using <a href="https://liballeg.org/a5docs/trunk/native_dialog.html#al_show_native_file_dialog">al_show_native_file_dialog()</a> and co, not with OpenFileDialog().</p></li></ul><p>I&#39;m still not very clear on what the problem is exactly. If you can show some of your code, then perhaps we can help you better.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Fri, 20 Aug 2021 11:28:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I didn&#39;t know that &quot;Dialog&quot; was allegro 4 thing.<br />Im not using win32 &quot;OpenFileDialog()&quot;. I just only said that the allegro lib should could this API.</p><p>Im using Allegro 5 in Visual C++ ver 142 runtime. The one that came with Nuget packages.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Fri, 20 Aug 2021 18:17:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="https://liballeg.org/a5docs/trunk/native_dialog.html">https://liballeg.org/a5docs/trunk/native_dialog.html</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 21 Aug 2021 20:10:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I know, i know that about that link. <br />I did something i installed code:blocks in ubutu and migrated the project to linux. Looking further i discoverd that the error was in al_set_display_menu(), it returns with an error. I read the docs in allegro ubuntu info, but it isn&#39;t clear why fails. <br />I don&#39;t know why it does fail in ubuntu (and im compiling with the latest dev/libs version of allegro 5.</p><p>My code is very simple:</p><p>-------------------------------------------------<br />#pragma once<br />#include &lt;allegro5/allegro5.h&gt;<br />#include &lt;allegro5/allegro_native_dialog.h&gt;<br />enum {<br />	FILE_ID = 1,<br />	FILE_LOADROM_ID,<br />	FILE_CLOSEROM_ID,<br />	FILE_EXIT_ID,<br />	EMULTOR_RESET_ID,<br />	EMULTOR_MUTE_ID,<br />	WINDOW_1X,<br />	WINDOW_2X,<br />	WINDOW_3X,<br />	WINDOW_4X<br />};<br />ALLEGRO_MENU_INFO main_menu_info[] = {<br />   ALLEGRO_START_OF_MENU(&quot;File&quot;, FILE_ID),<br />	  { &quot;Load Rom&quot;, FILE_LOADROM_ID, 0, NULL },<br />	  { &quot;Close Rom&quot;, FILE_CLOSEROM_ID, 0, NULL },<br />	  <i>*ALLEGRO_MENU_SEPARATOR,*</i><br />	  { &quot;Exit&quot;, FILE_EXIT_ID, 0, NULL },<br />	  ALLEGRO_END_OF_MENU,</p><p>   ALLEGRO_START_OF_MENU(&quot;Emulator&quot;, 0),<br />	  { &quot;Reset&quot;, EMULTOR_RESET_ID, 0, NULL },<br />	  <i>*ALLEGRO_MENU_SEPARATOR,*</i><br />	  { &quot;Mute audio&quot;, EMULTOR_MUTE_ID, 0, NULL },<br />	  ALLEGRO_END_OF_MENU,</p><p>   ALLEGRO_START_OF_MENU(&quot;&amp;Window&quot;, 0),<br />	  { &quot;1X&quot;, WINDOW_1X, 0, NULL },<br />	  { &quot;2X&quot;, WINDOW_2X, 0, NULL },<br />	  { &quot;3X&quot;, WINDOW_3X, 0, NULL },<br />	  { &quot;4X&quot;, WINDOW_4X, 0, NULL },<br />	  ALLEGRO_END_OF_MENU,</p><p>   ALLEGRO_END_OF_MENU<br />};<br />class Menu<br />{</p><p>public:<br />	bool Init(ALLEGRO_DISPLAY* allegro_display, ALLEGRO_EVENT_QUEUE * queue)<br />	{<br />		bool ret = al_init_native_dialog_addon();<br />		if (ret == false)<br />        {<br />            std::cout &lt;&lt; &quot;Could not create ALLEGRO menu interface&quot; &lt;&lt; std::endl;<br />            return ret;<br />        }<br />		ALLEGRO_MENU* menu = nullptr;<br />		menu = al_build_menu(main_menu_info);<br />		if (menu == nullptr)<br />		{<br />            std::cout &lt;&lt; &quot;Could not BUILD MENU&quot; &lt;&lt; std::endl;<br />            return false;<br />		}<br />		al_set_display_menu(allegro_display, NULL);<br />		ret = al_set_display_menu(allegro_display, menu);<br />		if (ret == false)<br />        {<br />            std::cout &lt;&lt; &quot;Could not display menu&quot; &lt;&lt; std::endl;<br />            return ret;<br />        }<br />		al_register_event_source(queue, al_get_default_menu_event_source());<br />		return true;<br />	}<br />};<br />-------------------------------------------------</p><p>Anyway it prints to the terminal &quot;Could not display menu&quot; however in Windows dosn&#39;t drop this error.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Sun, 22 Aug 2021 00:44:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can you provide a debugging executable? Can you debug it yourself and get a backtrace of the error inside al_set_display_menu. Can you look at allegro.log and see if there is any message from the dialog channel.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 22 Aug 2021 08:22:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve used your code and managed to reproduce the problem. I ran it on linux and the menu wouldn&#39;t appear. I stepped through the debugger and noticed that the GTK context would not be created. I did manage to fix it with the following tweaks:</p><p>1. Make sure you set the ALLEGRO_GTK_TOPLEVEL flag before calling al_create_display(). You can use this snippet from ex_menu.c:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#ifdef ALLEGRO_GTK_TOPLEVEL</span>
   <span class="c">/* ALLEGRO_GTK_TOPLEVEL is necessary for menus with GTK. */</span>
   <a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_RESIZABLE <span class="k3">|</span> ALLEGRO_GTK_TOPLEVEL<span class="k2">)</span><span class="k2">;</span>
<span class="p">#else</span>
   <a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_RESIZABLE<span class="k2">)</span><span class="k2">;</span>
<span class="p">#endif</span>
   display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>


2. Make sure you call al_init_native_dialog_addon() <b>before</b> you call al_create_display(). If not, the appropriate GTK context is not set up properly. I noticed that your menu init function initializes the addon and creates the menu, but at that time the display is already created. This is probably what&#39;s going wrong on linux. </p><p>If you try these two things, does it work for you then?</p><p>The fact that the call to al_init_native_dialog_addon() succeeds even though the GTK context is not set up, could be considered a bug in allegro. Or at the very least it could generate a more helpful warning here.</p><p>P.S. Seeing your code was essential to solving the problem, and it would still have been easier if you had also shared your display setup code. So here is your takeaway: If you share your code, you will get answers more quickly. <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Sun, 22 Aug 2021 23:11:01 +0000</pubDate>
	</item>
</rss>
