gtk2 and gtk3 : how do you apply a style onto the default button? - gtk

In gtk2 (.rc) and GTk3 (.css) how do you theme the default button in a dialog ?
(The one that will be activated when hitting enter)

In Lubuntu 12.10, the default theme (/usr/share/themes/Lubuntu-default) has a file in the gtk-2.0 folder called button.rc. There are five "states" listed: normal, prelight, insensitive, active, and focus. It is my impression (from a bit of fiddling), that the "focus" state represents the one you are interested in. In other words, if a window with a few buttons is present, it is the button in the focus state that will be "pressed" or "clicked" by hitting enter.
In Lubuntu 12.10, the screen that appears when you click "Logout" from the main menu (or run lubuntu-logout from a terminal) illustrates this well. Of the seven "buttons" that appear, the topmost one, Shutdown, is shaded slightly differently (or has a focus ring) whereas the other six are similar to each other except for the text. Hitting "enter" without doing anything else is equivalent to clicking the "Shutdown" button.
I too am trying to figure out how to make the button in focus, if we call it that, a bit more contrasty.
For the gtk2 side of things, if you're happy with making the focus ring more obvious (but a bit more ugly), editing the theme's gtkrc may be one way. Look for a section captioned style "default" and then for a line that has something like
GtkWidget ::focus-line-width = 1
Changing 1 to 2 or 3 will make the focus ring more obvious.
(I haven't got round to looking at gtk3 apps.)

Related

How to modify the button's behavior on mouse over event in Graphical Installer for NSIS?

I'm new to NSIS. When I truned into Graphical Installer, I found the button's reaction on mouse over event is a litter bit different from Win10's default, which supposed to turn on highlight when mouse moves in (otherwise, turn off). But buttons under Graphical Installer look dummy when mouse moves over, and highlight only when mouse clicks, just like older windows versions.
How can I modify the button's behavior to match the effect in Win10?
Buttons in Graphical Installer for NSIS are defined like this:
It is a bitmap (.bmp) file with 4 button states inside of it: normal, focused pressed and disabled.
Size (of each state) is 83 (width) x 26 (height) pixels, together 83 x 104 pixels.
I assume you are talking about Focused state - you need to make the picture for this state "highlighted" - e.g. in Gimp use a function to add brightness to this area of bitmap (see the provided buttons in examples folder).
Focused state is applied when button has focus (changed e.g. by pressing the Tab button) to signalize "active" button that can be triggered by pressing the Enter key.
So this works a little different, but we will consider this "highlight" feature.
See http://graphical-installer.com/files/manuals/nsis/source/html/intro%20-%20project-graphics.html for more info
P.S. I am developer of this tool, feel free to ask any question, also asking here on SO is fine.

Enable clicking on the Green circles in Eclipse to jump to code

How can I enable clicking on this bubble (or perhaps the name) to instantly jump to the underlined place in code? By pressing f2 and clicking on a small box, the same effect can be achieved, but I remember being able to work far faster doing this on one of my old projects.
Hold Ctrl and hover over the method name. You can then choose to jump to the declaration or super implementation.

GTK3 ComboboxText on touchscreen

I have a problem with above mentioned widget on touchscreen (Elo). List of options is visible only while widget is pressed. This is different behavior to that one with mouse as pointer. After mouse left click list of options appears and waits for user choice.
I`m using Perl 5.22, and GTK3 (3.18.2) and Perl Gtk3 wrapper library (0.025).
I think this is likely due to this bug (which has not yet been fixed) in GTK3:
https://bugzilla.gnome.org/show_bug.cgi?id=333470
It seems that if you move the mouse pointer at all after pressing on the combo box (which is likely to happen on a touchscreen) it will be interpreted as a selection, instead of keeping the options open for selection.

Stop GTK from dragging the window when grabbed by background

I'm using GTK on Linux. (Both GTK2 and GTK3 exhibit this behavior.)
When you grab the window on some free space or menubar, the window itself gets dragged.
I'm using the window as a giant OpenGL canvas, and this prevents the primary mouse button presses from ever reaching the window. Double-clicks and secondary button presses arrive just fine.
How do I disable or work around this behavior? I've also tried adding a GtkDrawingArea to the window, but it still gets dragged.
This is not possible. GTK overrides the function of primary mouse button unconditionally. However, simply adding an empty GtkLabel to the window worked just well for me.
Edit: eventually I just used a GtkDrawingArea, because I also wanted a scroll/menubar. That works just as well.
Gtk does grab unconditionally, but you have full control of what that specific "click" will do.
Returning True from any "button-xxx" method will stop further processing from Gtk. See "Return type" here.

ipython-qtconsole: strange behavior when switching windows

I am experiencing following problem with ipython-qtconsole:
I type in ipython-qtconsole window, then I switch to another application window with Alt+Tab. When I switch back again into ipython-qtconsole the text area is no longer selected/activated, but rather the menu. That means, when I start typing or hit enter, I am actually in the top menu. I have to click with the mouse in the text area first, and then I can start typing.
Is this normal behavior? I cannot imagine that anybody would want this "functionality". Is it possible to change it, so that when ipython-qtconsole window is activated, the text area is automatically active (i.e. the cursor is there) ?