Move WindowPreviewLayout from JS to C
This layout manager is used quite often and the time we spend calling it's allocate and get_preferred_width/heigth functions increases with every open window. We can save a lot of precious time during the layout cycle by moving this layout manager from JS to C, thus avoiding the overhead of trampolining between C and JS land. In a measurement where the average time spent in vfunc_allocate() of the Workspace actor was measured while opening an overview with 20 windows, the average time spent went down from 3.1 ms to 2.3 ms. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
This commit is contained in:
33
src/shell-window-preview-layout.h
Normal file
33
src/shell-window-preview-layout.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef __SHELL_WINDOW_PREVIEW_LAYOUT_H__
|
||||
#define __SHELL_WINDOW_PREVIEW_LAYOUT_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#define SHELL_TYPE_WINDOW_PREVIEW_LAYOUT (shell_window_preview_layout_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (ShellWindowPreviewLayout, shell_window_preview_layout,
|
||||
SHELL, WINDOW_PREVIEW_LAYOUT, ClutterLayoutManager)
|
||||
|
||||
typedef struct _ShellWindowPreviewLayout ShellWindowPreviewLayout;
|
||||
typedef struct _ShellWindowPreviewLayoutPrivate ShellWindowPreviewLayoutPrivate;
|
||||
|
||||
struct _ShellWindowPreviewLayout
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterLayoutManager parent;
|
||||
|
||||
ShellWindowPreviewLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
ClutterActor * shell_window_preview_layout_add_window (ShellWindowPreviewLayout *self,
|
||||
MetaWindow *window);
|
||||
|
||||
void shell_window_preview_layout_remove_window (ShellWindowPreviewLayout *self,
|
||||
MetaWindow *window);
|
||||
|
||||
GList * shell_window_preview_layout_get_windows (ShellWindowPreviewLayout *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SHELL_WINDOW_PREVIEW_LAYOUT_H__ */
|
Reference in New Issue
Block a user