What is a GTK "render detail"? - c

I was having temporary difficulties setting the icon of a window in my C program to a stock icon, and I almost asked how to do it, but then I created the GdkPixbuf I needed like this:
gtk_widget_render_icon(GTK_WIDGET(window),GTK_STOCK_CONVERT,-1,NULL)
The last argument is described by the documentation as "render detail to pass to theme engine. [allow-none]" (here). Since I have no idea what an appropriate value for that might be, I set it to NULL and hoped it would work. It did work, but now I want to know why.
What is this value supposed to be? Is there any possible repercussion if I leave it as NULL?

From the documentation you linked to:
detail should be a string that identifies the widget or code doing the rendering, so that theme engines can special-case rendering for that widget or code.
The way I interpret that is that you might set it to "Wutaz-window-icon" and then if theme writers needed to write a special case for your application, they could match that string.
However, the point is moot; as #MrEricSir points out, the function is deprecated.

Related

Is there a way to have a function where given some arguments, it returns state and/or actions?

I am currently building a simple web element editor with React using Redux. It works as it should work with a small number of elements. I can see though that when the number of elements gets on a two digit scale, it will be frustrating to organize and maintain. The reason is because I have to pass [IDs and names (local to the function data), State, Actions] to the function I call which in turn filters the arguments and calls other functions with the right arguments etc. I think it is more ifs than it is needed. Can it be done with a function where I can have all the state and the actions, pass it some arguments, choose the correct path and done?
I do not think that providing code will help with this question, you would have see my file system as well to have the whole picture.
I am a junior developer so please forgive me if this is a stupid question or similar. Thank you in advance!

What is the purpose of uvm_component 'name' property?

Inside the agent, I have seen uvm_component creation like
apb_monitor m_monitor;
m_monitor=apb_monitor::type_id::create("monitor_name_aaa", this);
m_monitor.analysis_port.connect(analysis_port);
Here we can see that when referring to the hierarchy, we still need to put m_monitor.* rather than monitor_name_aaa.*.
My questions are
What is exactly the purpose of this name property 'monitor_name_aaa'
for?
I have seen in many places people says best way is to put the name = 'm_monitor', same as the m_monitor. If this is true, then why not the methodology just built in this feature directly?
Another point is that If I do get_type_name(), then I see the it is using the name property, like m_env.m_agent.monitor_name_aaa instead.
Thanks!
In UVM it is useful to be able to refer to components either using their SystemVerilog hierarchical name directly or as the string equivalent. (There's the answer to Q1.) Unlike in VHDL, in SystemVerilog there is no way of finding out what the name of a variable is. So, when you create a component, you have to manually set this up. (There's the answer to Q2).
As you point out, you must always make the name of the component the same as the name of the variable pointing to it ("m_monitor" in this case), otherwise you will not have this useful ability to refer to components either by SystemVerilog hierarchical reference or by the equivalent string.

Sanity PatchEvent functions are not very clear on what they do

I'm using sanity and trying to figure out what exactly the set, unset, insert functions do. As well there are methods on the PatchEvent class itself and I can't seem to find any documentation on that either.
For example I can see that set in the example takes one argument. But through more research of the code set actually takes two arguments, one being the path and the other being the value. It is unclear how path works and what it exactly does.
Since I am trying to update an object in array it looks like this is something I should be doing as this is what is done in the default ArrayInput. I tried to make it work, but no errors and no updates are happening. This is what I have:
PatchEvent.from(key ? set(key, [idx, '_key']) : unset())
On top of all this I can see that there are methods directly on the PatchEvent that are also being used like prefixAll, prepend, and append. I more or less would just like some good documentation on all of this otherwise I might as well just stick with the HTTP Api and update/manage everything on my own for the custom components.

CEF disable address bar

I am using CEF3 and want to hardcode and disable the address bar of the browser. I am not finding the right place in the code base to do the same. Any pointers would be of great help.
Either through the C++ or Javascript methods would help.
Thanks,
Ashwin
Are you using cefclient? I don't think there's a clean way to turn it off in the standard version of cefclient.
However, in the brackets-shell fork of cefclient there's a #define you can use to toggle it on/off cleanly. Just search for references to SHOW_TOOLBAR_UI (it's only used in four files). I'm guessing it wouldn't be too hard to manually apply those diffs back onto a clean copy of cefclient (you probably don't want to take the brackets-shell fork as-is – it's not very generic).
You can build a CEF application using the binary, just like the WIKI does. Please see the github project for a reference https://github.com/acristoffers/CEF3SimpleSample
I realize this question is old but I had the same question and found the solution.
In the cefclient example, the address bar is drawn within the RootWindowGtk::CreateRootWindow function.
Delete the gtk_container_add function call that adds the GtkToolItem* corresponding to the address bar and the address bar will be gone.

How to tell whether a font is monospace using GTK and Pango?

I have a PangoFontDescription and I want to know whether it describes a monospace font.
I have seen the function pango_font_family_is_monospace() in the Pango API documentation but after several hours of puzzling it is still not clear to me what the relationships are between PangoFontFamily, PangoFontMap, PangoFont, PangoFontset, PangoContext, and PangoFontDescription and whether I need any or all of these to achieve what I want. So far, PangoFontDescription is the only part of Pango I've needed to use, as GTK manages to abstract everything else away.
Can anyone who has done this before help me out?
You can use pango_font_description_get_family() and after that call pango_font_family_is_monospace() on the result.
EDIT:
Since pango_font_description_get_family() returns only a name you can do this: call pango_context_list_families() and search for a family object that has that name. After that, call pango_font_family_is_monospace() on the found object. Not sure what to do if no family object with that name is found, though.

Resources