On Fri, Oct 20, 2017 at 1:01 PM, Lokesh Chakka
<lvenkatakumarcha...@gmail.com> wrote:
> Hello,
>
> I am using simple program
>
> #include <gtk/gtk.h>
>
> int main(int argc, char *argv[])
> {
>     GtkWidget *window;
>     gtk_init(NULL, NULL);
>     window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>     gtk_widget_show(window);
>     g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>     gtk_main();
>     return 0;
> }
>
> I compiled it using gcc simple.c `pkg-config --cflags gtk+-3.0 --libs`
> if I do ./a.out, GUI is showing up.
>
> but if I do "sudo ./a.out", I am seeing the following error :
>
> ================================================
> $ sudo ./a.out
> No protocol specified
> Unable to init server: Could not connect: Connection refused
>
> (a.out:7961): Gtk-WARNING **: cannot open display: :0
> ================================================
>
> As my application back end needs root privileges, I need to open the GUI
> using sudo only.
> Can some one help in fixing this issue ?
>
> The same code was working fine in Ubuntu 17.04. But I am facing this issue
> after upgrading to Ubuntu 17.10.

Ubuntu 17.10 has switched to the Wayland display server, which is
designed to fix the security issues existent in X.

Wayland only allows the user who started the X server to connect clients to it.

For more info, see https://bugzilla.redhat.com/1266771

>
> Thanks
> --
> Lokesh Chakka,
> Mobile: 9731023458
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to