Bug 3484 - Plugination of frame and frame render.
Status: ASSIGNED
Alias: None
Product: Openbox
Classification: Unclassified
Component: general
Version: unspecified
Hardware: PC Linux
: P3 enhancement
Assignee: Mikachu
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2007-12-21 05:36 EST by Benoît Gschwind (Noth)
Modified: 2008-03-15 10:42:16 EDT
0 users

See Also:


Attachments
openbox with plugin support (First Draft) (905.73 KB, application/x-gzip)
2007-12-21 05:44 EST, Benoît Gschwind (Noth)
patch (321.83 KB, patch)
2007-12-21 08:57 EST, Mikachu
New patch (607.52 KB, application/x-gzip)
2007-12-25 06:03 EST, Benoît Gschwind (Noth)
Update version that patch openbox 3.4.5 (630.33 KB, patch)
2008-01-10 18:29 EST, Benoît Gschwind (Noth)
Patch with plugin for themes suport (86.09 KB, patch)
2008-01-27 07:04 EST, Benoît Gschwind (Noth)
Patch folow master git. (114.65 KB, application/x-gzip)
2008-02-09 08:37 EST, Benoît Gschwind (Noth)
path to remove tabs and make code more closer to openbox source layout (724.86 KB, text/x-patch)
2008-02-14 15:25 EST, Benoît Gschwind (Noth)
Incremental patch (9.18 KB, patch)
2008-02-16 08:40 EST, Benoît Gschwind (Noth)
Incremental patch 0004 (12.55 KB, patch)
2008-02-16 08:46 EST, Benoît Gschwind (Noth)
Incremental patch 0005 (5.83 KB, patch)
2008-02-16 10:45 EST, Benoît Gschwind (Noth)
Improve interface by removing some stuff (68.36 KB, patch)
2008-02-16 20:46 EST, Benoît Gschwind (Noth)
Remove the keep border option (2.62 KB, patch)
2008-02-18 04:55 EST, Benoît Gschwind (Noth)
Keep border is a part of plugin option (no a global option) (140.34 KB, patch)
2008-02-18 04:56 EST, Benoît Gschwind (Noth)
Fixed patch story (25.84 KB, application/x-gzip)
2008-02-20 15:14 EST, Benoît Gschwind (Noth)

Description Benoît Gschwind (Noth) 2007-12-21 05:36:48 EST
Hello,

I fill this bug to support topic "Plugin for render" in mailing list.

I purpose to change architecture of frame and frame render.  Frame and Frame render are responsible of drawing the boder of windows. Currently this part is build in the openbox core.  My purpose is to make this part of render in plugins. This is a high level of render which define the layout of windows and their design.  This idea come from GTK which provide an GTK-engine architecture that allow to define how GTK widget are draw.

Some features (not exhaustive):
 - Plugin Draw boder of frame, shaded windows, maximized windows : vertically, horizontally, both, etc.
 - Plugin can use their own configuration options,
 - Plugin provides animations for maximize, minimize, move, etc.
Comment 1 Benoît Gschwind (Noth) 2007-12-21 05:44:31 EST
Created attachment 1626 [details]
openbox with plugin support (First Draft)

In this archive, I separate frame and frame render into plugin. The path of plugin is currently hard coded and loaded at earliest as posible. The interface is weak and, imo, will be re-thought.
Comment 2 Mikachu 2007-12-21 08:57:51 EST
Created attachment 1628 [details]
patch
Comment 3 Benoît Gschwind (Noth) 2007-12-25 06:03:23 EST
Created attachment 1629 [details]
New patch

Patch note :

 * Split configuration of frame from original theme.h.
 * Add support of per theme plugin load
 * Load module from HOME directory in .config/openbox/frameplugins/
 * Provide 3 plugin :  default, concept and minimal
   - minimal is 0 conf from default one
   - default is same as the default theme of openbox
   - concept is a minimal like nodecor, keepborder of openbox.
 * fall back to minimal plugin if no plugin is define.

Note: I can't compile openbox-gnome-control-center from this patch.

To use this patch : 

./configure
make

and link or copy frameplugins/*.la in $HOME/.config/openbox/frameplugins/
run openbox from openbox directory in source directory

edit themerc of theme and add this line :
frame.theme.engine: libconcept.la
to choose which plugin you want use.

Concept theme use this values :
concept.border_width: 4
concept.focus_border_color: #000000
concept.focus_corner_color: #ff0000
concept.unfocus_border_color: #0000ff
concept.unfocus_corner_color: #00ff00

Some isues still unknow, like how plugin are unloaded. You can give feedback.

Merry Christmas
Comment 4 Benoît Gschwind (Noth) 2007-12-25 06:05:26 EST
Note : The last patch is from original source code of openbox.
Comment 5 Benoît Gschwind (Noth) 2008-01-10 18:29:12 EST
Created attachment 1635 [details]
Update version that patch openbox 3.4.5

Same as last but merged with 3.4.5.
Comment 6 Benoît Gschwind (Noth) 2008-01-27 07:04:03 EST
Created attachment 1651 [details]
Patch with plugin for themes suport

This patch remove all shared data in ObFrame,
And it propose an interface for this plugin,
My oppinion is that FramePlugin must be independant from ObClient, that is not currently the case, i.e. do not need an ObClient.
It's the first step in this direction.

Currently only libdefault.la engines should work, engines plugin are store in $HOME/.config/openbox/engines/

Best regards
Comment 7 Dana Jansens 2008-01-28 09:48:04 EST
Have you looked at openbox.git yet?  I think this stuff should be done against that rather than against 3.4 releases.  You should have a look. :)

I am wondering how come you are linking to gdk pixbuf?

I will look at the patch in detail soon.  In openbox.git, I am working on adding support for compositing.  You may definitely want to take that into account.  Maybe the compositor rendering should be a part of the same plugin, or maybe not.. I'm still pretty confused how to integrate the compositor nicely.
Comment 8 Benoît Gschwind (Noth) 2008-01-30 04:29:51 EST
> Have you looked at openbox.git yet?  I think this stuff should be done against
> that rather than against 3.4 releases.  You should have a look. :)

I just look at git but I don't know how it's work currently (I'm a basic subversion user). I am not opposed to use it.

> I am wondering how come you are linking to gdk pixbuf?

This patch use gdk_pixbuf because I provide an early plugin which use it. It's very simple plugin which draw frame border from picture (PNG and gdk_pixbuf suported format). The default plugin (that make the same layout of current openbox) and openbox-core do not need it.

> I will look at the patch in detail soon.  In openbox.git, I am working on
> adding support for compositing.  You may definitely want to take that into
> account.  Maybe the compositor rendering should be a part of the same plugin,
> or maybe not.. I'm still pretty confused how to integrate the compositor
> nicely.

Do not hesitate to ask any question you think relevant.

The current plugin interface do not include Popup because I prefer to finalize the frame interface before. The main drawback of this cituation is that openbox store some theme configuration twice.

I do not know how the compositor work, but if it only need X11 windows handler, the plugin can be the right place to implement it.

Comment 9 Benoît Gschwind (Noth) 2008-02-09 08:37:29 EST
Created attachment 1658 [details]
Patch folow master git.

I make this patch with git, from the master branch of git://git.icculus.org/mikachu/openbox

To use it you should put libdefault.la in $HOME/.config/openbox/engines . libdefault.la is the default plugin that openbox-core load if themerc don't specify it. This plugin do things as current theme, with some little bugs.
Comment 10 Dana Jansens 2008-02-13 21:04:18 EST
thanks for doing that!  i will put this in a public branch ("plugin") so you and others can see it and make further diffs against it easily
Comment 11 Dana Jansens 2008-02-13 21:05:57 EST
also i should say that i haven't really looked at the changes i earnest yet.  however i am going to be taking a 5 hour bus ride this weekend so I plan to look at them during that in great detail.  and then I will provide some feedback.

do you use IRC?  most of our dev thinking and coordinating happens on IRC and it would make it much more possible for us to collaborate if you were around there.
Comment 12 Dana Jansens 2008-02-13 21:13:45 EST
one thing is:  the indenting style you are using differs a lot from the openbox code, and i'm really very anal about code style.  so that is going to have to get fixed.

here's a quick idea from the HACKING file
Indentation
-----------
For openbox, we aim to have consistent coding style. Some, but surely
not all, guidelines:
 * use 4 space indents
 * tabs should not appear in source files
 * functions should have the opening and closing braces on their own
   lines
 * most other constructs should have braces on the same line as the
   statement
 * else appears on a new line, just like an if
 * when in doubt look at the rest of the source
 * vim users can use "set expandtab tabstop=4 shiftwidth=4
   softtabstop=4" for some of this
Comment 13 Dana Jansens 2008-02-13 21:18:48 EST
one last thing...

i've been working with render and added some nice things to it.

it now has an image type, and an image cache that caches various sizes of the same image.  in thinking about this and plugins, i think that maybe the whole of libobrender would become part of a plugin, or at least would be used by one or more plugins, and provide abstractions to openbox so openbox would not use any of libobrender directly.

what say you?
Comment 14 Benoît Gschwind (Noth) 2008-02-14 07:51:07 EST
> do you use IRC?  most of our dev thinking and coordinating happens on IRC and
> it would make it much more possible for us to collaborate if you were around
> there.

I do not use IRC day-to-day, but I can use it.

> one thing is:  the indenting style you are using differs a lot from the openbox
> code, and i'm really very anal about code style.  so that is going to have to
> get fixed.

I use eclipse to develop. I will see how to setup eclipse to match to openbox code format.

> i've been working with render and added some nice things to it.
> 
> it now has an image type, and an image cache that caches various sizes of the
> same image.  in thinking about this and plugins, i think that maybe the whole
> of libobrender would become part of a plugin, or at least would be used by one
> or more plugins, and provide abstractions to openbox so openbox would not use
> any of libobrender directly.

I do not look at libobrender currently (that why I use gdk_pix_buff), but I agree that libobrender is used by plugins or is a part of plugins. Currently an example is libdefault that use libobrender.

Thanks for git branch :)

Best regards.


Comment 15 Benoît Gschwind (Noth) 2008-02-14 15:25:39 EST
Created attachment 1662 [details]
path to remove tabs and make code more closer to openbox source layout
Comment 16 Dana Jansens 2008-02-14 15:54:43 EST
ok i have applied this.  thanks :)

since it basically changed everything, i merged it with the previous diff, as i think that will just be easier to read in this case. :)
Comment 17 Benoît Gschwind (Noth) 2008-02-16 08:40:28 EST
Created attachment 1663 [details]
Incremental patch
Comment 18 Benoît Gschwind (Noth) 2008-02-16 08:46:23 EST
Created attachment 1664 [details]
Incremental patch 0004
Comment 19 Benoît Gschwind (Noth) 2008-02-16 10:45:36 EST
Created attachment 1665 [details]
Incremental patch 0005

Fix bug of frame title
Comment 20 Benoît Gschwind (Noth) 2008-02-16 10:47:48 EST
Note : currently, I only maintain the default plugin. Others are supposed to not work.
Comment 21 Benoît Gschwind (Noth) 2008-02-16 20:46:32 EST
Created attachment 1666 [details]
Improve interface by removing some stuff
Comment 22 Benoît Gschwind (Noth) 2008-02-18 04:55:52 EST
Created attachment 1678 [details]
Remove the keep border option
Comment 23 Benoît Gschwind (Noth) 2008-02-18 04:56:59 EST
Created attachment 1679 [details]
Keep border is a part of plugin option (no a global option)
Comment 24 Dana Jansens 2008-02-18 20:34:47 EST
hi I read through the first 2 diffs (I haven't looked at anything beyond those in my git tree yet), and it is a really great start!  Here were some of the thoughts I had about where to go with it.  I can help with this stuff, but it's all my thoughts so far on it:

some things i want in openbox, not the engines (some of this is important to
 allow reconfigure to change theme plugins):
  - creation of the frame top level window
  - map/unmap of top level and client windows (can have pre/post funcs for the
    engines) (engine should not deal with ignore_unmaps or grabserver)
  - reparenting of client into/out of the frame top level window
  - shape adjusting from the client (can merge with a shape provided by the
    engine)
  - flashing end-time should come from openbox
  - iconify animation should move to compmgr
  - adjusting the focus_cycle_indicator
  - wrapper around engine funcs to handle root/menus/dialogs/moveresize, and
    it calls plugin-specific one if it cant pick a context
  - frame<->client gravity translations
  - frame_rect_to_frame

80 columns

consistent use of "engine" vs "plugin".  prefer "engine" everywhere

combine set_client_area and update_layout

why is update_skin needed to be public? it should be called internally in updat\
e_layout and when flags change and stuff
the frame_adjust_area->update_layout conversion didn't preserve the same
  booleans in the call in multiple places, are they correct that way?
also moved boolean in update_layout should probably stay (or maybe
  moved/resized can both be implicit if we pass a rect and "fake"
  boolean only, by merging in set_client_area)
avoid using Rect as return type or fn parameter, use a Rect* in the arguments
  instead, avoids excessive copying of rects
consistant render_plugin->func() vs just func()
  - want an engine.c/h that has all the funcs, and wraps calls to the function
    pointers.  for some it will perform functionality (like for grabbing the
    client for example) and can call multiple fn pointers into the actual
    engine
don't make engines depend on X db for the config, actually we will probably
  pass an xml tree to the engine instead, have to dig up the old xmltheme code
  again and forward-port it (96bb892054b, fdc10b75d648, 69a5c9c2344), there are
  more than a few changes to the xdrb themes since then so this needs some
  care
  - have the theme choose the engine, so user chooses a theme, rather than
    having user choose engine and also theme
all variable definitions at the top of the block
why update_layout when focus changes?
make a create/destroy_event_window() function which everyone including
  engines can use that wrap XCreate/DestroyWindow and also calls
  add/remove_window for the event hashtable, pass fn pointer for this to engine
  if we need to. window_map should remain static
there is a bunch of random indenting changes in tests/*.c
what would the plugin1-4 triggers be used for, how would openbox know when to
  fire them?


i will look at the further patches when i can. :) thanks!
Comment 25 Benoît Gschwind (Noth) 2008-02-19 14:20:20 EST
Hello, Thanks for your support and feedback.

(In reply to comment #24)
> hi I read through the first 2 diffs (I haven't looked at anything beyond those
> in my git tree yet), and it is a really great start!  Here were some of the
> thoughts I had about where to go with it.  I can help with this stuff, but it's
> all my thoughts so far on it:
> 
> some things i want in openbox, not the engines (some of this is important to
>  allow reconfigure to change theme plugins):
>   - creation of the frame top level window

It's plan.

>   - map/unmap of top level and client windows (can have pre/post funcs for the
>     engines) (engine should not deal with ignore_unmaps or grabserver)

It's plan.

>   - reparenting of client into/out of the frame top level window

It's plan.

>   - shape adjusting from the client (can merge with a shape provided by the
>     engine)
I don't know well shape, but it could be done ^^
>   - flashing end-time should come from openbox

It's plan.

>   - iconify animation should move to compmgr

Does it mean that I can remove animating structure ?

>   - adjusting the focus_cycle_indicator

It's plan.

>   - wrapper around engine funcs to handle root/menus/dialogs/moveresize, and
>     it calls plugin-specific one if it cant pick a context

It's plan, but I prefere to stabilize frame structure before.

>   - frame<->client gravity translations

I will see what does it mean in term of development.

>   - frame_rect_to_frame

Same as the last one ?

> 
> 80 columns
> 
> consistent use of "engine" vs "plugin".  prefer "engine" everywhere

It's plan ^^

> combine set_client_area and update_layout

It's plan.

> why is update_skin needed to be public?

For granularity issue, but currently I don't know why ^^

> it should be called internally in
> updat\
> e_layout and when flags change and stuff
> the frame_adjust_area->update_layout conversion didn't preserve the same
>   booleans in the call in multiple places, are they correct that way?

The moveresize boolean is disign to specify if the client window must be resized (if we draw a moveresize frame). In the current code the default plugin don't implement this behavious, as far as remember. The source is a draft, I don't change a lot of code of default theme engine. I adapt the code "lazyly".

Note : this behaviour will be deprecated since frame top level window and client window will be managed by client.

> also moved boolean in update_layout should probably stay (or maybe
>   moved/resized can both be implicit if we pass a rect and "fake"
>   boolean only, by merging in set_client_area)

I agree.

> avoid using Rect as return type or fn parameter, use a Rect* in the arguments
>   instead, avoids excessive copying of rects
> consistant render_plugin->func() vs just func()

This feature was done to avoid write access to the rect used by frame. It's can use Rect * with a copy of Rect from frame, it was done in conceptual point of view. Pragmatic view would be done with Rect* on frame.

>   - want an engine.c/h that has all the funcs, and wraps calls to the function
>     pointers.  for some it will perform functionality (like for grabbing the
>     client for example) and can call multiple fn pointers into the actual
>     engine

You want I generalize what I had done on func "plugin_frame_context" in engine_interface ?

> don't make engines depend on X db for the config, actually we will probably
>   pass an xml tree to the engine instead, have to dig up the old xmltheme code
>   again and forward-port it (96bb892054b, fdc10b75d648, 69a5c9c2344), there are
>   more than a few changes to the xdrb themes since then so this needs some
>   care

I'm agree that we can avoid the using of X db, but imo xml is not the best config file fomat (troll ?) but I can follow the guide line. We can provide a library to read config file (obparse ?)

>   - have the theme choose the engine, so user chooses a theme, rather than
>     having user choose engine and also theme
> all variable definitions at the top of the block

Currently the theme engine is selected by theme in themerc by "theme.engine" token and openbox fallback to libdefault.la if it is not set in themerc.

> why update_layout when focus changes?

I do not remember, safe development, I think :p

> make a create/destroy_event_window() function which everyone including
>   engines can use that wrap XCreate/DestroyWindow and also calls
>   add/remove_window for the event hashtable, pass fn pointer for this to engine
>   if we need to. window_map should remain static

It's plan ^^

> there is a bunch of random indenting changes in tests/*.c

I don't remember to edit any tests/*.c, can they be merged/replaced from master branch ?

> what would the plugin1-4 triggers be used for, how would openbox know when to
>   fire them?

They are provided to permit plugins to define their customs behaviours, like, for instance, switch color theme. This event could be binded with key like openbox do for ToggleMaximize. (not currently implemented)
> 
> i will look at the further patches when i can. :) thanks!
> 

Comment 26 Dana Jansens 2008-02-20 11:25:36 EST
0003-add-a-frame-trigger-function.patch doesn't apply cleanly, is there a patch missing in between?
Comment 27 Benoît Gschwind (Noth) 2008-02-20 14:15:50 EST
(In reply to comment #26)
> 0003-add-a-frame-trigger-function.patch doesn't apply cleanly, is there a patch
> missing in between?
> 
The order is from origin/plugin branch : (in my repos)
0001-Implement-exemple-of-trigger-function-use.patch
0002-Fix-bug-that-openbox-don-t-draw-title-on-new-window.patch
0003-Improve-interface-by-removing-display-screen-and-ren.patch
0004-Remove-keep-border-option.patch
0005-keepborder-is-an-theme-option-now.patch

Number can be different.
Comment 28 Benoît Gschwind (Noth) 2008-02-20 15:14:29 EST
Created attachment 1686 [details]
Fixed patch story
Comment 29 Benoît Gschwind (Noth) 2008-02-22 18:33:20 EST
Last update can be downloaded on git :

git://repo.or.cz/openbox/manual.git

the branch used is plugin.
Comment 30 Benoît Gschwind (Noth) 2008-02-22 18:43:31 EST
I had done folowing things:
   - creation of the frame top level window
   - map/unmap of top level and client windows (can have pre/post funcs for the
     engines) (engine should not deal with ignore_unmaps or grabserver)
   - reparenting of client into/out of the frame top level window
   - flashing end-time should come from openbox
   - iconify animation should move to compmgr (remove animation)
   - adjusting the focus_cycle_indicator
   - consistent use of "engine" vs "plugin".  prefer "engine" everywhere
   - combine set_client_area and update_layout
   - also moved boolean in update_layout should probably stay (or maybe
     moved/resized can both be implicit if we pass a rect and "fake"
     boolean only, by merging in set_client_area) Rect was added to
     update_layout
   - avoid using Rect as return type or fn parameter, use a Rect* in the 
     arguments instead, avoids excessive copying of rects consistant
     render_plugin->func() vs just func() : rect and strut are copied to the
     pointer argument.
   - make a create/destroy_event_window() function which everyone including
     engines can use that wrap XCreate/DestroyWindow and also calls
     add/remove_window for the event hashtable, pass fn pointer for this to
     engine (partiali done by code duplication)
   - if we need to. window_map should remain static


Comment 31 Benoît Gschwind (Noth) 2008-03-15 10:42:16 EDT
First draft of inclusion of popup is in plugin_experimental.