Showing posts with label gtk. Show all posts
Showing posts with label gtk. Show all posts

Wednesday, February 7, 2018

Optimizing animation performance in WebKit on Linux

Leave a Comment

How does one optimize a compiled WebKit browser to take the best advantage of the GPU?

Background

My team and I are working on configuring a Linux box (CentOS) to display full screen HTML with smooth, CSS-driven animations. The box has more than adequate GPU and CPU power and is able to play back these animations easily in Chromium.

However, we are attempting to use pure WebKit to render these animations both by using WebKitGTK+ in Python and by compiling WebKit to a simplistic browser from the source.

Current Status

In both "pure" webkit applications, the animations are vastly slower than on Chromium, which is making us scratch our heads to answer what exactly is different between the two. We understand Chromium uses Blink, a fork of WebKit, and we currently believe the difference in performance is due to the fact that Chromium, Safari, and other WebKit-based browsers each use their own graphics component that is separate from WebKit and Web Core itself, based on what we've read.

It would be great if we could customize our WebKit build to perform even to half the specs of what we're seeing in Chromium but we're not sure where to start.

I'm wondering...

  1. Is our assumption about the separate graphics component correct?
  2. What options exist for us to optimize CSS animation performance in a "pure" WebKit browser such as ours?

0 Answers

Read More

Thursday, May 11, 2017

No themes are shown when I recompile Gtk

Leave a Comment

I recompiled Gtk (I wanted to make a minor change to fix something that annoyed me), and I wanted to install it at /usr/local, so I didn't specify any prefix, I just used

./configure make sudo make install 

When I do this, however, only a few themes are shown in lxappearance, and some of them don't work. There should be 20-30 themes if the standard lib at /usr is used.

How can I fix that? I assume maybe I need to compile some other package as well, since the Gtk lib would be looking at /usr/local for modules and themes and such.

I'm on Ubuntu Xenial 16.04.

enter image description here

0 Answers

Read More

Tuesday, June 14, 2016

meld - gi._glib.GError: Icon 'meld-change-apply-right' not present in theme. What is wrong with the installation?

Leave a Comment

I have managed to install the meld 3.14.2 and all the dependency packages, by compiling each package from source and all are installed on a NFS share with --prefix=<base>/meldfor the meld tool && --prefix=<base>/meld/deps for the dependencies.

Finally, I invoked the tool and I can see the GUI. But when I try to do some functionality testing, it throws me errors. I have never used the tool. So, I don't know how it is supposed to work exactly. But users have pointed out the following error, and there can be many other errors too I guess. But the following is one of it.

$meld GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications. II 1 Traceback (most recent call last): File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/newdifftab.py", line 117, in on_button_compare_clicked tab = self.diff_methods[self.diff_type](compare_paths) File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/meldwindow.py", line 647, in append_filediff doc = filediff.FileDiff(len(files)) File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/filediff.py", line 281, in __init__ from meld.gutterrendererchunk import GutterRendererChunkAction File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 33, in <module> class GutterRendererChunkAction(GtkSource.GutterRendererPixbuf): File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 38, in GutterRendererChunkAction MODE_REPLACE: load("meld-change-apply-right"), File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 30, in load return icon_theme.load_icon(icon_name, LINE_HEIGHT, 0) File "/applics/platform/meld/meld-3.14.2/dependencies/lib/python2.7/site-packages/gi/types.py", line 113, in function return info.invoke(*args, **kwargs) gi._glib.GError: Icon 'meld-change-apply-right' not present in theme 

Please tell me what could be wrong?

The following variables I have used throughout the installation and while using the tool.

PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH, PYTHONPATH, GSETTINGS_SCHEMA_DIR

The reason for using all these paths is it is completely customized installation, as there were already existing GTK etc versions running on the servers and we don't want to disturb them and want a separate setup for meld, and also in a way that the same installation shared on NFS can be used from multiple servers.

But, unlike the other tools that we usually install, meld has very serious dependencies and we need to compile complex packages like GTK.

Anyhow, can any one tell us what's the wrong with the current installation? And do I need to set more variables and references or do I need to install the modules again with extra options? Now, I have only installed recommended dependencies for each package and left optional package dependencies.

And coming to the error, I can find the png file in my installation <base>/meld/share/icons/hicolor/16x16/actions/meld-change-apply-right.png, then why the tool is unable to find it? What is theme means here?

I was actually quite proud of myself after seeing the window, but now it seems it's just an empty window with zero functionality :(

enter image description here

1 Answers

Answers 1

I had a similar problem running Meld 3.16.0 on Archlinux. In my case the specific error message was GLib.Error: gtk-icon-theme-error-quark: Icon 'meld-change-apply-right' not present in theme gnome (0).

I "fixed" it by creating symbolic links from the directory the Meld icons were installed in to the place Meld is apparently looking for these icons. In my case that that meant ln -s /usr/share/icons/hicolor/16x16/actions/meld* /usr/share/icons/gnome/16x16/actions/.

I consider this a work around rather than a real solution, but at least Meld is working correctly now.

Read More

Sunday, April 24, 2016

Pygtk color for drag_highlight

Leave a Comment

I'm trying to change the highlight color for a gtk.EventBox. It has a certain background color, and I want to draw a line around it with its complementary color. I have found drag_highlight, which draws a line around the widget, but I have not figured out how to change the color: it's always black. Any ideas?

1 Answers

Answers 1

To make the line around the EventBox, it is possible to put it into the Frame or another EventBox (in this case it is possible to set the width of the "border"), here is how it looks:

enter image description here

And here is the code (it is a modified EventBox example):

#!/usr/bin/env python  # example eventbox.py  import pygtk pygtk.require('2.0') import gtk  class EventBoxExample:     def __init__(self):         window = gtk.Window(gtk.WINDOW_TOPLEVEL)         window.set_title("Event Box")         window.connect("destroy", lambda w: gtk.main_quit())         window.set_border_width(10)          # Create an EventBox and add it to our toplevel window         frame = gtk.EventBox() # gtk.Frame()         window.add(frame)         frame.show()         frame.set_border_width(2)         frame.modify_bg(gtk.STATE_NORMAL,                             frame.get_colormap().alloc_color("blue"))          event_box = gtk.EventBox()         frame.add(event_box)         event_box.set_border_width(10)         event_box.show()          # Create a long label         label = gtk.Label("Click here to quit, quit, quit, quit, quit")         event_box.add(label)         label.show()          # Clip it short.         label.set_size_request(110, 20)          # And bind an action to it         event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK)         event_box.connect("button_press_event", lambda w,e: gtk.main_quit())          # More things you need an X window for ...         event_box.realize()         event_box.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))          # Set background color to green         event_box.modify_bg(gtk.STATE_NORMAL,                             event_box.get_colormap().alloc_color("green"))          window.show()  def main():     gtk.main()     return 0  if __name__ == "__main__":     EventBoxExample()     main() 
Read More

Saturday, March 19, 2016

GTK window, how to get window decoration sizes?

Leave a Comment

I am looking for an equivalent of AdjustWindowRect function that allows to get widths/heights of window caption and borders.

Do we have this functionality in GTK 3 at all? Seems like not. I've looked through all gtk_window_xxx, gtk_widget_xxx and gdk_window_xxx* functions...

Update:

In principle I am able to determine window-chrome/decoration dimensions as a delta of gdk_window_get_frame_extents() and gtk_widget_get_allocation() / gdk_window_get_origin() but

  1. it works only after window appeared on the screen. I need it before that - to calculate initial window position.
  2. it is really a hack.

2 Answers

Answers 1

It's up to Window Manager to decide. You can request it by sending a message _NET_REQUEST_FRAME_EXTENTS as explained in the specification of EWMH (Extended Window Manager Hints):

_NET_REQUEST_FRAME_EXTENTS   window = window for which to set _NET_FRAME_EXTENTS   message_type = _NET_REQUEST_FRAME_EXTENTS 

A Client whose window has not yet been mapped can request of the Window Manager an estimate of the frame extents it will be given upon mapping. To retrieve such an estimate, the Client MUST send a _NET_REQUEST_FRAME_EXTENTS message to the root window. The Window Manager MUST respond by estimating the prospective frame extents and setting the window's _NET_FRAME_EXTENTS property accordingly. The Client MUST handle the resulting _NET_FRAME_EXTENTS PropertyNotify event. So that the Window Manager has a good basis for estimation, the Client MUST set any window properties it intends to set before sending this message. The Client MUST be able to cope with imperfect estimates.

Rationale: A client cannot calculate the dimensions of its window's frame before the window is mapped, but some toolkits need this information. Asking the window manager for an estimate of the extents is a workable solution. The estimate may depend on the current theme, font sizes or other window properties. The client can track changes to the frame's dimensions by listening for _NET_FRAME_EXTENTS PropertyNotify events.

https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472648576

So, in two words, you send a _NET_REQUEST_FRAME_EXTENTS msg to WM (to the root window - it's gdk_get_default_root_window() in case of gdk), then wait for the reply (_NET_FRAME_EXTENTS PropertyNotify), and get the desired data from your window's _NET_FRAME_EXTENTS property.

Answers 2

You are correct that the functionality is not there. GTK is agnostic of the decorations that the window manager places on the window; for all that your application is aware of, there may be giant decorations, or there may be none.

What you can do, is use gtk_window_set_titlebar() to tell the window manager to let you use your own decorations; then you have full control over their size.

Read More

Sunday, March 13, 2016

meld - gi._glib.GError: Icon 'meld-change-apply-right' not present in theme. What is wrong with the installation?

Leave a Comment

I have managed to install the meld 3.14.2 and all the dependency packages, by compiling each package from source and all are installed on a NFS share with --prefix=<base>/meldfor the meld tool && --prefix=<base>/meld/deps for the dependencies.

Finally, I invoked the tool and I can see the GUI. But when I try to do some functionality testing, it throws me errors. I have never used the tool. So, I don't know how it is supposed to work exactly. But users have pointed out the following error, and there can be many other errors too I guess. But the following is one of it.

$meld GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications. II 1 Traceback (most recent call last): File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/newdifftab.py", line 117, in on_button_compare_clicked tab = self.diff_methods[self.diff_type](compare_paths) File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/meldwindow.py", line 647, in append_filediff doc = filediff.FileDiff(len(files)) File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/filediff.py", line 281, in __init__ from meld.gutterrendererchunk import GutterRendererChunkAction File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 33, in <module> class GutterRendererChunkAction(GtkSource.GutterRendererPixbuf): File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 38, in GutterRendererChunkAction MODE_REPLACE: load("meld-change-apply-right"), File "/applics/platform/meld/meld-3.14.2/lib/python2.7/site-packages/meld/gutterrendererchunk.py", line 30, in load return icon_theme.load_icon(icon_name, LINE_HEIGHT, 0) File "/applics/platform/meld/meld-3.14.2/dependencies/lib/python2.7/site-packages/gi/types.py", line 113, in function return info.invoke(*args, **kwargs) gi._glib.GError: Icon 'meld-change-apply-right' not present in theme 

Please tell me what could be wrong?

The following variables I have used throughout the installation and while using the tool.

PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH, PYTHONPATH, GSETTINGS_SCHEMA_DIR

The reason for using all these paths is it is completely customized installation, as there were already existing GTK etc versions running on the servers and we don't want to disturb them and want a separate setup for meld, and also in a way that the same installation shared on NFS can be used from multiple servers.

But, unlike the other tools that we usually install, meld has very serious dependencies and we need to compile complex packages like GTK.

Anyhow, can any one tell us what's the wrong with the current installation? And do I need to set more variables and references or do I need to install the modules again with extra options? Now, I have only installed recommended dependencies for each package and left optional package dependencies.

And coming to the error, I can find the png file in my installation <base>/meld/share/icons/hicolor/16x16/actions/meld-change-apply-right.png, then why the tool is unable to find it? What is theme means here?

I was actually quite proud of myself after seeing the window, but now it seems it's just an empty window with zero functionality :(

enter image description here

0 Answers

Read More