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

Linux specific forum
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

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

Post 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
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post by idle »

libwebkit-dev

should get all you need
Last edited by idle on Wed Aug 15, 2012 6:33 am, edited 1 time in total.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

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

Post 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)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post by idle »

same warnings with ubuntu 12.04 x64 with unity
Windows 11, Manjaro, Raspberry Pi OS
Image
lakomet
User
User
Posts: 53
Joined: Mon Apr 04, 2011 3:56 am
Location: Russia,Angarsk

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

Post 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.
Linux Mint Maya(Mate), x86, PureBasic 5.00(5.10b1)
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post 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
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

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

Post 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
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

It's a warning which comes from the lib, sounds more like a debug message than a warning anyway.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

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

Post by Guimauve »

@Fred

Nothing to worry about, fine and thanks your work.

Best regards
Guimauve
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

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

Post 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
User avatar
Frarth
Enthusiast
Enthusiast
Posts: 241
Joined: Tue Jul 21, 2009 11:11 am
Location: On the planet
Contact:

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

Post 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.
PureBasic 5.41 LTS | Xubuntu 16.04 (x32) | Windows 7 (x64)
User avatar
Frarth
Enthusiast
Enthusiast
Posts: 241
Joined: Tue Jul 21, 2009 11:11 am
Location: On the planet
Contact:

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

Post 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.
PureBasic 5.41 LTS | Xubuntu 16.04 (x32) | Windows 7 (x64)
Post Reply