I was drawing on Linux Mint 21 with application drawing - version 1.02 and noticed, that the color select tool
( look at https://github.com/maoschanz/drawing/issues/630 ) is not working.
I cant select any color from screen...
This is a Gtk Widget - Gtk.ColorChooserWidget!
I examined it, using GJS, and checked, if there is any handler pending on the Color-Select button!
Gtk.ColorChooserWidget test:
#!/usr/bin/gjs
"use strict";
imports.gi.versions.Gtk="3.0";
const { Gtk, GObject }= imports.gi;
Gtk.init(null);
const window = new Gtk.Window(), colorChooser= new Gtk.ColorChooserWidget ();
window.set_title("ColorChooserWidget test");
window.connect('destroy', () => { Gtk.main_quit(); });
window.set_size_request(640, 480);
window.add (colorChooser);
window.show_all();
log ("Gtk Version: "+Gtk.get_major_version()+"."+Gtk.get_minor_version()+"."+Gtk.get_micro_version());
//-- Gtk.ColorChooserWidget has only button_colorSelect !!
var button_select, button_cancel, button_colorSelect;
function find_buttons (gtk_children) //-- finds the Color Chooser Dialog buttons Color-Select|Cancel|Select
{
const l=gtk_children.length;
var i, gtk_child, button_child;
for (i=0;i<l;i++)
{
gtk_child=gtk_children[i];
if (gtk_child.get_children) find_buttons (gtk_child.get_children());
if (gtk_child.constructor === Gtk.Button)
{
button_child=gtk_child.get_children()[0];
if (button_child.constructor === Gtk.Image) button_colorSelect=gtk_child; //-- button with image -> colorSelect button
else //-- button with label -> Select or Cancel
{
if (button_child.get_text() == "Select") button_select=gtk_child;
else button_cancel=gtk_child;
}
}
}
}
find_buttons (colorChooser.get_children());
var signal_ID=GObject.signal_lookup ("button_press_event", Gtk.Button.$gtype);
log ("class Gtk.Button - 'button-press-event' signal ID :"+signal_ID);
//-- GObject.signal_has_handler_pending ([GObject object OBJ], [signal ID NUM(int)], [detail GQuark-NUM(int)], [include blocked handlers BOOL]), for non detailed signal 0 can be used as GQuark
log ("button_colorSelect has handler pending on 'button-press-event' :" +GObject.signal_has_handler_pending (button_colorSelect, signal_ID, 0, true));
//-- test, if the button colorSelect is correctly identified - click on it
button_colorSelect.connect ("button-press-event", function () { log ("button colorSelect"); });
Gtk.main();
output:
Gjs-Message: 23:13:23.831: JS LOG: Gtk Version: 3.24.33
Gjs-Message: 23:13:23.833: JS LOG: class Gtk.Button - 'button-press-event' signal ID :66
Gjs-Message: 23:13:23.833: JS LOG: button_colorSelect has handler pending on 'button-press-event' :false
The Color Select button doesnt have any handler pending!!, so its without functionality!
Is that only on Linux Mint ???
Or is it generally on other platforms, and you have to program the functionality yourself?
this is not an answer to my question, but a workaround.
I've appended this functionality, for GJS users, if you want to use
CLASS interface_ColorChooser