Page 1 of 1

[Done] PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 12:53 am
by Guimauve
Hello everyone,

Apparently, I don't have any luck with the WebGadget(). As reported by Fred, the WebGadget() on Linux should work. If it's true, can someone tell me why the Debugger tell me :
The WebGadget() don't work !
when I run this tiny source code :

Code: Select all

If OpenWindow(0,0,0,600,300,"WebGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  
  WebGadget(0,10,10,580,280,"http://www.purebasic.com")
  
  If IsGadget(0)
    Debug "The WebGadget() work !"
  Else
    Debug "The WebGadget() not work !"
  EndIf
  
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf 
The WebGadget() is now based on Webkit libs but which one ? This is the installed lib list about Webkit GTK
  • libwebkitgtk-1.0-common --> 1.8.1-0ubuntu0.12.04.1
    libwebkitgtk-3.0-common --> 1.8.1-0ubuntu0.12.04.1
    libwebkitgtk-3.0-0 --> 1.8.1-0ubuntu0.12.04.1
    libwebkitgtk-1.0-0 --> 1.8.1-0ubuntu0.12.04.1
    gir1.2-webkit-3.0 --> 1.8.1-0ubuntu0.12.04.1
Something else is needed ?

PureBasic V4.70 Beta 1 x64
LinuxMint 13 x64 + Gnome-Shell 3.4.2

Best regards
Guimauve

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 5:59 am
by idle
libwebkit-dev

should get all you need

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 6:26 am
by ts-soft
Debugger-Output wrote:The WebGadget() work !
IDE-Output wrote:[07:23:36] Warte auf den Start des Executable...
[07:23:36] Executable-Typ: Linux - x64 (64bit)
[07:23:36] Executable gestartet.
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize succeeded
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] GnomeShellBrowserPlugin (DEBUG): plugin loaded
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize succeeded
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize succeeded
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize
[07:23:36] [WARNING] Zeile: 12
[07:23:36] [WARNING] DEBUG: NP_Initialize succeeded
works, but with warnings.
Ubuntu 12.04 (x86_64) with Gnome3-Shell

PB 4.70 Beta 1 (x64)

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 6:36 am
by idle
same warnings with ubuntu 12.04 x64 with unity

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 6:50 am
by lakomet
XUbuntu 12.10 kernel 3.5.0-5 PureBasic 4.70b1 - The WebGadget() work !
log
[14:43:33] Waiting for executable to start...
[14:43:33] Executable type: Linux - x86 (32bit, Unicode)
[14:43:33] Executable started.
[14:43:50] The Program execution has finished.

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 10:18 am
by Fred
Guillaume: so you have a lib named "libwebkitgtk-1.0-0.so" ? If yes, please try this new lib: www.purebasic.com/beta/linux_x64/gadgetweb

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 12:45 pm
by Guimauve
Fred wrote:Guillaume: so you have a lib named "libwebkitgtk-1.0-0.so" ? If yes, please try this new lib: http://www.purebasic.com/beta/linux_x64/gadgetweb
About libwebkitgtk-1.0-0
/usr
/usr/lib
/usr/lib/libwebkitgtk-1.0.so.0 <--- The closest is this one with an extra ".0 "
/usr/lib/libwebkitgtk-1.0.so.0.13.2
/usr/lib/webkitgtk-1.0-0
/usr/lib/webkitgtk-1.0-0/libexec
/usr/lib/webkitgtk-1.0-0/libexec/GtkLauncher
/usr/share
/usr/share/doc
/usr/share/doc/libwebkitgtk-1.0-0
/usr/share/doc/libwebkitgtk-1.0-0/changelog.Debian.gz
/usr/share/doc/libwebkitgtk-1.0-0/copyright
Edit :

With the new librairy, the WebGadget() finally work but I get a [WARNING] DEBUG: NP_Initialize succeeded

Best regards
Guimauve

Re: PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 12:54 pm
by Fred
It's a warning which comes from the lib, sounds more like a debug message than a warning anyway.

Re: [Done] PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Aug 15, 2012 3:41 pm
by Guimauve
@Fred

Nothing to worry about, fine and thanks your work.

Best regards
Guimauve

Re: [Done] PB V4.70B1 - No luck with the WebGadget()

Posted: Wed Mar 13, 2013 9:46 pm
by Shardik
Guimauve wrote:With the new librairy, the WebGadget() finally work but I get a [WARNING] DEBUG: NP_Initialize succeeded
Fred wrote:It's a warning which comes from the lib, sounds more like a debug message than a warning anyway.
This WebKit warning is displayed if the embedding of scripting lanuages is enabled which is the WebKit default setting. By disabling the embedding of scripts the above warning will disappear:

Code: Select all

#G_TYPE_INT = 6 << 2

ImportC "-lwebkitgtk-1.0"
  webkit_web_settings_new()
  webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport

Define Value.GValue

OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")

; ----- Get current webkit settings
WebkitSettings = webkit_web_settings_new()

; ----- Disable embedding of scripting languages
Value\g_type = #G_TYPE_INT
g_value_set_int_(Value, 0)
g_object_set_property_(WebkitSettings, "enable-scripts", @Value)

; ----- Store changed settings
webkit_web_view_set_settings(GadgetID(0), WebkitSettings)

Repeat 
Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: [Done] PB V4.70B1 - No luck with the WebGadget()

Posted: Sun Jun 12, 2016 8:22 am
by Frarth
Shardik wrote:
Guimauve wrote:With the new librairy, the WebGadget() finally work but I get a [WARNING] DEBUG: NP_Initialize succeeded
Fred wrote:It's a warning which comes from the lib, sounds more like a debug message than a warning anyway.
This WebKit warning is displayed if the embedding of scripting lanuages is enabled which is the WebKit default setting. By disabling the embedding of scripts the above warning will disappear:

Code: Select all

#G_TYPE_INT = 6 << 2

ImportC "-lwebkitgtk-1.0"
  webkit_web_settings_new()
  webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport

Define Value.GValue

OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")

; ----- Get current webkit settings
WebkitSettings = webkit_web_settings_new()

; ----- Disable embedding of scripting languages
Value\g_type = #G_TYPE_INT
g_value_set_int_(Value, 0)
g_object_set_property_(WebkitSettings, "enable-scripts", @Value)

; ----- Store changed settings
webkit_web_view_set_settings(GadgetID(0), WebkitSettings)

Repeat 
Until WaitWindowEvent() = #PB_Event_CloseWindow
How would that be for gtk3? when I use this code the debugger crashes with a message that mixing gtk2 and gtk3 symbols is not allowed.

Re: [Done] PB V4.70B1 - No luck with the WebGadget()

Posted: Sun Jun 12, 2016 11:34 am
by Frarth
OK found it, "-lwebkitgtk-3.0" should be used.

It may have been mentioned already, but to simply load a html string into the WebGadget on Linux a workaround is needed, like:

Code: Select all

ImportC "-lwebkitgtk-3.0" ; should be 3, not 1
  webkit_web_settings_new()
  webkit_web_view_load_string(*WebView, Content.P-UTF8, *MIMEType, *Encoding, *BaseURI)
  webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport

Procedure WebGadgetText(gadget.l, html.s)
  ; replaces SetGadgetText for the WebGadget in Linux to set/change text
  webkit_web_view_load_string(GadgetID(gadget), html, 0, 0, 0)
  WebkitSettings = webkit_web_settings_new()
  webkit_web_view_set_settings(GadgetID(gadget), WebkitSettings)
EndProcedure
I pulled this from the net and adjusted it a little. Seems to work fine. But I suppress debug warnings. There's no harm, but they are annoying.