scorninpc/php-gtk3

Widget::has_focus return integer

d47081 opened this issue · 3 comments

Widget::has_focus return integer not boolean type
https://docs.gtk.org/gtk3/method.Widget.has_focus.html

I need working code for that

My code returning boolean too

gboolean ret = gtk_widget_has_focus (GTK_WIDGET(instance));

This is a nice example about i'm talking about d47081

I wrote a code to test your problem, you understand?

<?php

Gtk::init();

$win = new GtkWindow();
$win->set_default_size(300, 200);
$win->connect("destroy", "GtkWindowDestroy");

$button = \GtkButton::new_with_label("OK");
$win->add($button);
$button->connect("clicked", function($button) use ($win) {
	echo "OK\n";

	var_dump($win->has_focus());
	var_dump($button->has_focus());
});

$win->show_all();

Gtk::main();

and just after that i can confirm your problem

image

and now i can search the problem:

image

gboolean are a alias for integer

and now i can help

image

you see all work just to change gboolean to bool?

as a dev, i'm just asking to you help me too :)

btw, the problem fixed

Just opened your comment, and too late.. it's fixed

I'm not much experienced in cpp (to operate data types there) but in php it may cause errors, so thanks