diff options
author | Danny Baumann <dannybaumann@web.de> | 2010-04-28 09:57:39 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2010-04-28 09:57:39 +0200 |
commit | 1d038ec135a85d98134fcc221ef75ffbf06adaee (patch) | |
tree | 2747b370b9e5214e41783273ef063c427052bf8a | |
parent | a4c0bd14fe7011a056f25b4875534fac411c07a0 (diff) | |
parent | 47194772a3f233afec289064806e7addc9b4d0b5 (diff) | |
download | zcomp-1d038ec135a85d98134fcc221ef75ffbf06adaee.tar.gz zcomp-1d038ec135a85d98134fcc221ef75ffbf06adaee.tar.bz2 |
Merge branch 'master' of git+ssh://git.compiz-fusion.org/git/compiz/core
-rw-r--r-- | cmake/CompizCommon.cmake | 5 | ||||
-rw-r--r-- | cmake/CompizDefaults.cmake | 4 | ||||
-rw-r--r-- | gtk/window-decorator/gtk-window-decorator.c | 350 | ||||
-rw-r--r-- | plugins/blur/CMakeLists.txt | 4 | ||||
-rw-r--r-- | plugins/composite/include/composite/composite.h | 216 | ||||
-rw-r--r-- | plugins/cube/cube.xml.in | 1 | ||||
-rw-r--r-- | plugins/cube/include/cube/cube.h | 8 | ||||
-rw-r--r-- | plugins/dbus/CMakeLists.txt | 1 | ||||
-rw-r--r-- | plugins/dbus/dbus.xml.in | 5 | ||||
-rw-r--r-- | plugins/glib/glib.xml.in | 4 | ||||
-rw-r--r-- | plugins/imgpng/imgpng.xml.in | 4 | ||||
-rw-r--r-- | plugins/imgsvg/imgsvg.xml.in | 4 | ||||
-rw-r--r-- | plugins/ini/ini.xml.in | 4 | ||||
-rw-r--r-- | plugins/inotify/inotify.xml.in | 6 | ||||
-rw-r--r-- | plugins/kde/kde.xml.in | 4 | ||||
-rw-r--r-- | plugins/opengl/include/opengl/fragment.h | 8 | ||||
-rw-r--r-- | plugins/opengl/include/opengl/opengl.h | 202 | ||||
-rw-r--r-- | plugins/opengl/include/opengl/texture.h | 91 | ||||
-rw-r--r-- | plugins/opengl/include/opengl/vector.h | 50 | ||||
-rw-r--r-- | plugins/place/place.xml.in | 4 | ||||
-rw-r--r-- | plugins/regex/regex.xml.in | 4 | ||||
-rw-r--r-- | src/option.cpp | 2 | ||||
-rw-r--r-- | src/window.cpp | 12 |
23 files changed, 747 insertions, 246 deletions
diff --git a/cmake/CompizCommon.cmake b/cmake/CompizCommon.cmake index ed37a85..6d33fb6 100644 --- a/cmake/CompizCommon.cmake +++ b/cmake/CompizCommon.cmake @@ -13,6 +13,11 @@ cmake_policy (SET CMP0003 NEW) cmake_policy (SET CMP0005 OLD) cmake_policy (SET CMP0011 OLD) +set (COMPIZ_DATADIR ${CMAKE_INSTALL_PREFIX}/share) +set (COMPIZ_METADATADIR ${CMAKE_INSTALL_PREFIX}/share/compiz) +set (COMPIZ_IMAGEDIR ${CMAKE_INSTALL_PREFIX}/share/compiz/images) +set (COMPIZ_PLUGINDIR ${libdir}/compiz) +set (COMPIZ_SYSCONFDIR ${sysconfdir}) set ( VERSION ${VERSION} CACHE STRING diff --git a/cmake/CompizDefaults.cmake b/cmake/CompizDefaults.cmake index 21c7e0e..aad551c 100644 --- a/cmake/CompizDefaults.cmake +++ b/cmake/CompizDefaults.cmake @@ -1,7 +1,7 @@ - set (COMPIZ_PREFIX ${CMAKE_INSTALL_PREFIX}) set (COMPIZ_INCLUDEDIR ${includedir}) set (COMPIZ_LIBDIR ${libdir}) + list (APPEND COMPIZ_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include) list (APPEND COMPIZ_INCLUDE_DIRS ${CMAKE_BINARY_DIR}) @@ -12,4 +12,4 @@ set (COMPIZ_GCONF_SCHEMAS_XSLT ${CMAKE_SOURCE_DIR}/xslt/compiz_gconf_schemas.xsl set (COMPIZ_PLUGIN_INSTALL_TYPE "package") -set (_COMPIZ_INTERNAL 1)
\ No newline at end of file +set (_COMPIZ_INTERNAL 1) diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c index 7eee355..793e4a9 100644 --- a/gtk/window-decorator/gtk-window-decorator.c +++ b/gtk/window-decorator/gtk-window-decorator.c @@ -473,8 +473,8 @@ gboolean (*theme_get_button_position) (decor_t *d, static char *program_name; -static GtkWidget *sytle_window_rgba; -static GtkWidget *sytle_window_rgb; +static GtkWidget *style_window_rgba; +static GtkWidget *style_window_rgb; static GtkWidget *switcher_label; static GHashTable *frame_table; @@ -720,15 +720,15 @@ create_pixmap (int w, int h, int depth) { - if (w == 0 || h ==0) + GtkWidget *widget; + GdkWindow *window; + + if (w == 0 || h == 0) abort (); - if (depth > 24) - return gdk_pixmap_new (GDK_DRAWABLE (sytle_window_rgba->window), - w, h, depth); - else - return gdk_pixmap_new (GDK_DRAWABLE (sytle_window_rgb->window), - w, h, depth); + widget = (depth > 24) ? style_window_rgba : style_window_rgb; + window = gtk_widget_get_window (widget); + return gdk_pixmap_new (GDK_DRAWABLE (window), w, h, depth); } #define CORNER_TOPLEFT (1 << 0) @@ -1021,7 +1021,7 @@ draw_window_decoration (decor_t *d) if (!d->pixmap) return; - style = gtk_widget_get_style (sytle_window_rgba); + style = gtk_widget_get_style (style_window_rgba); if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)) @@ -1033,11 +1033,11 @@ draw_window_decoration (decor_t *d) if (d->frame_window) { - GdkColormap *cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); + GdkColormap *cmap; + cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); gdk_drawable_set_colormap (GDK_DRAWABLE (d->pixmap), cmap); gdk_drawable_set_colormap (GDK_DRAWABLE (d->buffer_pixmap), cmap); - drawable = GDK_DRAWABLE (d->buffer_pixmap); } else if (d->buffer_pixmap) @@ -1423,10 +1423,11 @@ draw_window_decoration (decor_t *d) if (d->frame_window) { GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window); + gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL); gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height); - - gdk_window_reparent (gdk_frame_window, d->frame_window, -_win_extents.left - 2, -_win_extents.top - 2); + gdk_window_reparent (gdk_frame_window, d->frame_window, + -_win_extents.left - 2, -_win_extents.top - 2); gdk_window_lower (gdk_frame_window); } @@ -1494,17 +1495,13 @@ decor_update_meta_window_property (decor_t *d, max_extents.top += max_titlebar_height; if (d->frame_window) - { decor_gen_window_property (data, &extents, &max_extents, 20, 20); - } else - { decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap), &extents, &max_extents, ICON_SPACE + d->button_width, 0, quads, nQuad); - } gdk_error_trap_push (); XChangeProperty (xdisplay, d->prop_xid, @@ -1525,9 +1522,9 @@ decor_update_meta_window_property (decor_t *d, static void meta_get_corner_radius (const MetaFrameGeometry *fgeom, - int *top_left_radius, + int *top_left_radius, int *top_right_radius, - int *bottom_left_radius, + int *bottom_left_radius, int *bottom_right_radius) { @@ -1969,7 +1966,7 @@ meta_draw_window_decoration (decor_t *d) Region right_region = NULL; double alpha = (d->active) ? meta_active_opacity : meta_opacity; gboolean shade_alpha = (d->active) ? meta_active_shade_opacity : - meta_shade_opacity; + meta_shade_opacity; MetaFrameStyle *frame_style; GtkWidget *style_window; GdkColor bg_color; @@ -1981,14 +1978,14 @@ meta_draw_window_decoration (decor_t *d) x2 = d->width - d->context->right_space + _win_extents.right; y2 = d->height - d->context->bottom_space + _win_extents.bottom; - if (!d->pixmap || !d->picture) return; if (d->frame_window) { - GdkColormap *cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); - + GdkColormap *cmap; + + cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); gdk_drawable_set_colormap (GDK_DRAWABLE (d->pixmap), cmap); gdk_drawable_set_colormap (GDK_DRAWABLE (d->buffer_pixmap), cmap); } @@ -1998,13 +1995,13 @@ meta_draw_window_decoration (decor_t *d) if (gdk_drawable_get_depth (GDK_DRAWABLE (d->pixmap)) == 32) { - style = gtk_widget_get_style (sytle_window_rgba); - style_window = sytle_window_rgba; + style = gtk_widget_get_style (style_window_rgba); + style_window = style_window_rgba; } else { - style = gtk_widget_get_style (sytle_window_rgb); - style_window = sytle_window_rgb; + style = gtk_widget_get_style (style_window_rgb); + style_window = style_window_rgb; } drawable = d->buffer_pixmap ? d->buffer_pixmap : d->pixmap; @@ -2060,7 +2057,7 @@ meta_draw_window_decoration (decor_t *d) { int depth; GdkColormap *cmap; - + cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); depth = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window)); pixmap = create_pixmap (rect.width, size, depth); @@ -2311,7 +2308,7 @@ meta_draw_window_decoration (decor_t *d) gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL); gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height); - gdk_window_reparent (gdk_frame_window, d->frame_window, -(d->context->left_space - extents.left), -(extents.top + extents.bottom - 2)); + gdk_window_reparent (gdk_frame_window, d->frame_window, -(d->context->left_space - extents.left), -d->context->bottom_space + extents.bottom + 2); gdk_window_lower (gdk_frame_window); } @@ -2368,7 +2365,7 @@ decor_update_switcher_property (decor_t *d) &_switcher_extents, &_switcher_extents, 0, 0, quads, nQuad); - style = gtk_widget_get_style (sytle_window_rgba); + style = gtk_widget_get_style (style_window_rgba); fgColor[0] = style->fg[GTK_STATE_NORMAL].red; fgColor[1] = style->fg[GTK_STATE_NORMAL].green; @@ -2403,7 +2400,7 @@ draw_switcher_background (decor_t *d) if (!d->buffer_pixmap) return; - style = gtk_widget_get_style (sytle_window_rgba); + style = gtk_widget_get_style (style_window_rgba); color.r = style->bg[GTK_STATE_NORMAL].red / 65535.0; color.g = style->bg[GTK_STATE_NORMAL].green / 65535.0; @@ -2602,7 +2599,7 @@ draw_switcher_foreground (decor_t *d) if (!d->pixmap || !d->buffer_pixmap) return; - style = gtk_widget_get_style (sytle_window_rgba); + style = gtk_widget_get_style (style_window_rgba); cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap)); @@ -2945,9 +2942,21 @@ get_event_window_position (decor_t *d, gint *w, gint *h) { - *x = pos[i][j].x + pos[i][j].xw * width; - *y = pos[i][j].y + pos[i][j].yh * height + pos[i][j].yth * - (titlebar_height - 17); + if (d->frame_window) + { + *x = pos[i][j].x + pos[i][j].xw * width + _win_extents.left; + *y = pos[i][j].y + _win_extents.top + + pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17); + + if (i == 0 && (j == 0 || j == 2)) + *y -= titlebar_height; + } + else + { + *x = pos[i][j].x + pos[i][j].xw * width; + *y = pos[i][j].y + + pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17); + } if ((d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) && (j == 0 || j == 2)) @@ -2966,8 +2975,8 @@ get_event_window_position (decor_t *d, } else { - *h = pos[i][j].h + pos[i][j].hh * height + pos[i][j].hth * - (titlebar_height - 17); + *h = pos[i][j].h + + pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17); } } @@ -2984,9 +2993,19 @@ get_button_position (decor_t *d, if (i > BUTTON_MENU) return FALSE; - *x = bpos[i].x + bpos[i].xw * width; - *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * - (titlebar_height - 17); + if (d->frame_window) + { + *x = bpos[i].x + bpos[i].xw * width + _win_extents.left + 4; + *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * + (titlebar_height - 17) + _win_extents.top + 2; + } + else + { + *x = bpos[i].x + bpos[i].xw * width; + *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * + (titlebar_height - 17); + } + *w = bpos[i].w + bpos[i].ww * width; *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth + (titlebar_height - 17); @@ -3032,14 +3051,26 @@ meta_get_event_window_position (decor_t *d, case 2: /* bottom */ switch (j) { case 2: /* bottom right */ - *x = width - fgeom.right_width - RESIZE_EXTENDS; - *y = height - fgeom.bottom_height - RESIZE_EXTENDS; + if (d->frame_window) + { + *x = width - fgeom.right_width - RESIZE_EXTENDS + + _win_extents.left + 2; + *y = height - fgeom.bottom_height - RESIZE_EXTENDS + + _win_extents.top + 2; + } + else + { + *x = width - fgeom.right_width - RESIZE_EXTENDS; + *y = height - fgeom.bottom_height - RESIZE_EXTENDS; + } *w = fgeom.right_width + RESIZE_EXTENDS; *h = fgeom.bottom_height + RESIZE_EXTENDS; break; case 1: /* bottom */ *x = fgeom.left_width + RESIZE_EXTENDS; *y = height - fgeom.bottom_height; + if (d->frame_window) + *y += _win_extents.top + 2; *w = width - fgeom.left_width - fgeom.right_width - (2 * RESIZE_EXTENDS); *h = fgeom.bottom_height; @@ -3048,6 +3079,11 @@ meta_get_event_window_position (decor_t *d, default: *x = 0; *y = height - fgeom.bottom_height - RESIZE_EXTENDS; + if (d->frame_window) + { + *x += _win_extents.left + 4; + *y += _win_extents.bottom + 2; + } *w = fgeom.left_width + RESIZE_EXTENDS; *h = fgeom.bottom_height + RESIZE_EXTENDS; break; @@ -3057,7 +3093,8 @@ meta_get_event_window_position (decor_t *d, switch (j) { case 2: /* right */ *x = width - fgeom.right_width; - *y = fgeom.top_height + RESIZE_EXTENDS; + if (d->frame_window) + *x += _win_extents.left + 2; *w = fgeom.right_width; *h = height - fgeom.top_height - fgeom.bottom_height - (2 * RESIZE_EXTENDS); @@ -3071,6 +3108,8 @@ meta_get_event_window_position (decor_t *d, case 0: /* left */ default: *x = 0; + if (d->frame_window) + *x += _win_extents.left + 4; *y = fgeom.top_height + RESIZE_EXTENDS; *w = fgeom.left_width; *h = height - fgeom.top_height - fgeom.bottom_height - @@ -3084,12 +3123,19 @@ meta_get_event_window_position (decor_t *d, case 2: /* top right */ *x = width - fgeom.right_width - RESIZE_EXTENDS; *y = 0; + if (d->frame_window) + { + *x += _win_extents.left + 2; + *y += _win_extents.top + 2 - fgeom.title_rect.height; + } *w = fgeom.right_width + RESIZE_EXTENDS; *h = fgeom.top_height + RESIZE_EXTENDS; break; case 1: /* top */ *x = fgeom.left_width + RESIZE_EXTENDS; *y = 0; + if (d->frame_window) + *y += _win_extents.top + 2; *w = width - fgeom.left_width - fgeom.right_width - (2 * RESIZE_EXTENDS); *h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT; @@ -3098,6 +3144,11 @@ meta_get_event_window_position (decor_t *d, default: *x = 0; *y = 0; + if (d->frame_window) + { + *x += _win_extents.left + 4; + *y += _win_extents.top + 2 - fgeom.title_rect.height; + } *w = fgeom.left_width + RESIZE_EXTENDS; *h = fgeom.top_height + RESIZE_EXTENDS; break; @@ -3258,6 +3309,12 @@ meta_get_button_position (decor_t *d, *h = space->height; #endif + if (d->frame_window) + { + *x += _win_extents.left + 4; + *y += _win_extents.top + 2; + } + return TRUE; } @@ -3472,8 +3529,8 @@ update_window_decoration_name (WnckWindow *win) { gint width; - wnck_window_get_client_window_geometry (win, NULL, NULL, &width, - NULL); + wnck_window_get_client_window_geometry (win, NULL, NULL, + &width, NULL); w = width - ICON_SPACE - 2 - d->button_width; if (w < 1) @@ -3532,8 +3589,12 @@ update_window_decoration_icon (WnckWindow *win) g_object_ref (G_OBJECT (d->icon_pixbuf)); - d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf, - 24); + if (d->frame_window) + d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf, + 24); + else + d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf, + 32); cr = gdk_cairo_create (GDK_DRAWABLE (d->icon_pixmap)); d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr)); cairo_destroy (cr); @@ -3633,10 +3694,11 @@ calc_decoration_size (decor_t *d, if (w < top_width) top_width = MAX (ICON_SPACE + d->button_width, w); - decor_get_default_layout (&window_context, top_width, 1, &layout); + decor_get_default_layout (&window_context, + d->client_width, d->client_height, &layout); - *width = d->client_width + (_win_extents.left + _win_extents.right) * 1.5; - *height = d->client_height + _win_extents.bottom + layout.height; + *width = layout.width; + *height = layout.height; d->border_layout = layout; d->context = &window_context; @@ -3656,7 +3718,7 @@ meta_calc_button_size (decor_t *d) gint i, min_x, x, y, w, h, width; width = d->border_layout.top.x2 - d->border_layout.top.x1 - - d->context->left_space - d->context->right_space; + d->context->left_space - d->context->right_space; min_x = width; for (i = 0; i < 3; i++) @@ -3669,10 +3731,7 @@ meta_calc_button_size (decor_t *d) if (d->actions & button_actions[i]) { - if (meta_get_button_position (d, - i, - width, - 256, + if (meta_get_button_position (d, i, width, 256, &x, &y, &w, &h)) { if (x > width / 2 && x < min_x) @@ -3729,21 +3788,15 @@ meta_calc_decoration_size (decor_t *d, else { if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) - decor_get_default_layout (context, d->client_width - - _max_win_extents.left - - _max_win_extents.right, - d->client_height - 20, &layout); + decor_get_default_layout (context, d->client_width, + d->client_height - titlebar_height, + &layout); else - decor_get_default_layout (context, d->client_width - - _win_extents.left - - _win_extents.right, - d->client_height - - context->top_space + - _win_extents.bottom, &layout); + decor_get_default_layout (context, d->client_width, + d->client_height, &layout); *width = layout.width; - *height = d->client_height + _win_extents.bottom + - titlebar_height; + *height = layout.height; d->border_layout = layout; @@ -4185,12 +4238,8 @@ close_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) - { wnck_window_close (win, gtkwd_event->time); - } - } break; default: break; @@ -4261,10 +4310,8 @@ min_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) wnck_window_minimize (win); - } break; default: break; @@ -4438,16 +4485,10 @@ above_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) - { - #ifdef HAVE_LIBWNCK_2_18_1 wnck_window_make_above (win); #endif - - } - } break; default: break; @@ -4468,10 +4509,8 @@ stick_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) wnck_window_stick (win); - } break; default: break; @@ -4492,10 +4531,8 @@ unshade_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) wnck_window_unshade (win); - } break; default: break; @@ -4516,14 +4553,10 @@ unabove_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) - { #ifdef HAVE_LIBWNCK_2_18_1 wnck_window_unmake_above (win); #endif - } - } break; default: break; @@ -4544,10 +4577,8 @@ unstick_button_event (WnckWindow *win, switch (gtkwd_type) { case GButtonRelease: if (gtkwd_event->button == 1) - { if (state == BUTTON_EVENT_ACTION_STATE) wnck_window_unstick (win); - } break; default: break; @@ -4624,8 +4655,8 @@ dist (double x1, double y1, } static void -title_event (WnckWindow *win, - decor_event *gtkwd_event, +title_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { static int last_button_num = 0; @@ -4638,8 +4669,7 @@ title_event (WnckWindow *win, if (d->frame_window && gtkwd_type == GEnterNotify) { - GdkCursor* cursor; - cursor = gdk_cursor_new (GDK_LEFT_PTR); + GdkCursor* cursor = gdk_cursor_new (GDK_LEFT_PTR); gdk_window_set_cursor (d->frame_window, cursor); gdk_cursor_unref (cursor); } @@ -4695,9 +4725,9 @@ title_event (WnckWindow *win, } static void -frame_common_event (WnckWindow *win, - int direction, - decor_event *gtkwd_event, +frame_common_event (WnckWindow *win, + int direction, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { @@ -4764,8 +4794,8 @@ frame_common_event (WnckWindow *win, } static void -top_left_event (WnckWindow *win, - decor_event *gtkwd_event, +top_left_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { frame_common_event (win, WM_MOVERESIZE_SIZE_TOPLEFT, @@ -4773,39 +4803,39 @@ top_left_event (WnckWindow *win, } static void -top_event (WnckWindow *win, - decor_event *gtkwd_event, +top_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { - frame_common_event (win, WM_MOVERESIZE_SIZE_TOP, gtkwd_event, gtkwd_type); + frame_common_event (win, WM_MOVERESIZE_SIZE_TOP, + gtkwd_event, gtkwd_type); } static void -top_right_event (WnckWindow *win, - decor_event *gtkwd_event, +top_right_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { - frame_common_event (win, WM_MOVERESIZE_SIZE_TOPRIGHT, gtkwd_event, gtkwd_type); } static void -left_event (WnckWindow *win, - decor_event *gtkwd_event, +left_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { - - frame_common_event (win, WM_MOVERESIZE_SIZE_LEFT, gtkwd_event, gtkwd_type); + frame_common_event (win, WM_MOVERESIZE_SIZE_LEFT, + gtkwd_event, gtkwd_type); } static void -right_event (WnckWindow *win, - decor_event *gtkwd_event, +right_event (WnckWindow *win, + decor_event *gtkwd_event, decor_event_type gtkwd_type) { - - frame_common_event (win, WM_MOVERESIZE_SIZE_RIGHT, gtkwd_event, gtkwd_type); + frame_common_event (win, WM_MOVERESIZE_SIZE_RIGHT, + gtkwd_event, gtkwd_type); } static void @@ -4813,7 +4843,6 @@ bottom_left_event (WnckWindow *win, decor_event *gtkwd_event, decor_event_type gtkwd_type) { - frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMLEFT, gtkwd_event, gtkwd_type); } @@ -4823,8 +4852,8 @@ bottom_event (WnckWindow *win, decor_event *gtkwd_event, decor_event_type gtkwd_type) { - - frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOM, gtkwd_event, gtkwd_type); + frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOM, + gtkwd_event, gtkwd_type); } static void @@ -4832,21 +4861,21 @@ bottom_right_event (WnckWindow *win, decor_event *gtkwd_event, decor_event_type gtkwd_type) { - frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMRIGHT, gtkwd_event, gtkwd_type); } void frame_window_realized (GtkWidget *widget, - gpointer data) + gpointer data) { decor_t *d = (decor_t *) data; if (d) { GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window); - gdk_window_reparent (gdk_frame_window, d->frame_window, -_win_extents.left - 2, -_win_extents.top - 2); + gdk_window_reparent (gdk_frame_window, d->frame_window, + -_win_extents.left - 2, -_win_extents.top - 2); gdk_window_lower (gdk_frame_window); } @@ -4931,9 +4960,9 @@ find_leave_event_callback (decor_t *d) } static void -frame_handle_button_press (GtkWidget *widget, +frame_handle_button_press (GtkWidget *widget, GdkEventButton *event, - gpointer user_data) + gpointer user_data) { decor_t *d = (decor_t *) user_data; @@ -4965,9 +4994,9 @@ frame_handle_button_press (GtkWidget *widget, } static void -frame_handle_button_release (GtkWidget *widget, +frame_handle_button_release (GtkWidget *widget, GdkEventButton *event, - gpointer user_data) + gpointer user_data) { decor_t *d = (decor_t *) user_data; @@ -4996,9 +5025,9 @@ frame_handle_button_release (GtkWidget *widget, } static void -frame_handle_motion (GtkWidget *widget, +frame_handle_motion (GtkWidget *widget, GdkEventMotion *event, - gpointer user_data) + gpointer user_data) { decor_t *d = (decor_t *) user_data; @@ -5037,7 +5066,7 @@ frame_handle_motion (GtkWidget *widget, (*leave_cb) (d->win, >kwd_event, GLeaveNotify); } - + if (send_enter) d->last_pos_entered = entered_box; } @@ -5092,8 +5121,8 @@ window_geometry_changed (WnckWindow *win) { int width, height; - wnck_window_get_client_window_geometry (win, NULL, NULL, &width, - &height); + wnck_window_get_client_window_geometry (win, NULL, NULL, + &width, &height); if (width != d->client_width || height != d->client_height) { @@ -5191,20 +5220,15 @@ add_frame_window (WnckWindow *win, * event_filter_func */ - if (d->created) - { - if (mode && d->frame_window) - { - return; - } - } + if (d->created && mode && d->frame_window) + return; d->active = wnck_window_is_active (win); d->win = win; d->last_pos_entered = NULL; - attr.event_mask = ButtonPressMask | EnterWindowMask | LeaveWindowMask | - ExposureMask; + attr.event_mask = ButtonPressMask | EnterWindowMask | + LeaveWindowMask | ExposureMask; attr.override_redirect = TRUE; gdk_error_trap_push (); @@ -6132,16 +6156,17 @@ event_filter_func (GdkXEvent *gdkxevent, { gint i, j; event_callback cb = NULL; + Window w = xevent->xany.window; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) - if (d->event_windows[i][j].window == xevent->xany.window) + if (d->event_windows[i][j].window == w) cb = d->event_windows[i][j].callback; if (!cb) { for (i = 0; i < BUTTON_NUM; i++) - if (d->button_windows[i].window == xevent->xany.window) + if (d->button_windows[i].window == w) cb = d->button_windows[i].callback; } @@ -6150,7 +6175,7 @@ event_filter_func (GdkXEvent *gdkxevent, decor_event gtkwd_event; decor_event_type gtkwd_type; - gtkwd_event.window = xevent->xany.window; + gtkwd_event.window = w; switch (xevent->type) { @@ -6221,7 +6246,6 @@ selection_event_filter_func (GdkXEvent *gdkxevent, return GDK_FILTER_CONTINUE; } - /* from clearlooks theme */ static void rgb_to_hls (gdouble *r, @@ -7693,63 +7717,63 @@ init_settings (WnckScreen *screen) } #endif - sytle_window_rgba = gtk_window_new (GTK_WINDOW_POPUP); + style_window_rgba = gtk_window_new (GTK_WINDOW_POPUP); gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ()); colormap = gdk_screen_get_rgba_colormap (gdkscreen); if (colormap) - gtk_widget_set_colormap (sytle_window_rgba, colormap); + gtk_widget_set_colormap (style_window_rgba, colormap); - gtk_widget_realize (sytle_window_rgba); + gtk_widget_realize (style_window_rgba); switcher_label = gtk_label_new (""); switcher_label_obj = gtk_widget_get_accessible (switcher_label); atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); - gtk_container_add (GTK_CONTAINER (sytle_window_rgba), switcher_label); + gtk_container_add (GTK_CONTAINER (style_window_rgba), switcher_label); - gtk_widget_set_size_request (sytle_window_rgba, 0, 0); - gtk_window_move (GTK_WINDOW (sytle_window_rgba), -100, -100); - gtk_widget_show_all (sytle_window_rgba); + gtk_widget_set_size_request (style_window_rgba, 0, 0); + gtk_window_move (GTK_WINDOW (style_window_rgba), -100, -100); + gtk_widget_show_all (style_window_rgba); - g_signal_connect_object (sytle_window_rgba, "style-set", + g_signal_connect_object (style_window_rgba, "style-set", G_CALLBACK (style_changed), 0, 0); - settings = gtk_widget_get_settings (sytle_window_rgba); + settings = gtk_widget_get_settings (style_window_rgba); g_object_get (G_OBJECT (settings), "gtk-double-click-time", &double_click_timeout, NULL); - pango_context = gtk_widget_create_pango_context (sytle_window_rgba); + pango_context = gtk_widget_create_pango_context (style_window_rgba); - sytle_window_rgb = gtk_window_new (GTK_WINDOW_POPUP); + style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP); gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ()); colormap = gdk_screen_get_rgb_colormap (gdkscreen); if (colormap) - gtk_widget_set_colormap (sytle_window_rgb, colormap); + gtk_widget_set_colormap (style_window_rgb, colormap); - gtk_widget_realize (sytle_window_rgb); + gtk_widget_realize (style_window_rgb); switcher_label = gtk_label_new (""); switcher_label_obj = gtk_widget_get_accessible (switcher_label); atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); - gtk_container_add (GTK_CONTAINER (sytle_window_rgb), switcher_label); + gtk_container_add (GTK_CONTAINER (style_window_rgb), switcher_label); - gtk_widget_set_size_request (sytle_window_rgb, 0, 0); - gtk_window_move (GTK_WINDOW (sytle_window_rgb), -100, -100); - gtk_widget_show_all (sytle_window_rgb); + gtk_widget_set_size_request (style_window_rgb, 0, 0); + gtk_window_move (GTK_WINDOW (style_window_rgb), -100, -100); + gtk_widget_show_all (style_window_rgb); - g_signal_connect_object (sytle_window_rgb, "style-set", + g_signal_connect_object (style_window_rgb, "style-set", G_CALLBACK (style_changed), 0, 0); - settings = gtk_widget_get_settings (sytle_window_rgb); + settings = gtk_widget_get_settings (style_window_rgb); g_object_get (G_OBJECT (settings), "gtk-double-click-time", &double_click_timeout, NULL); - pango_context = gtk_widget_create_pango_context (sytle_window_rgb); + pango_context = gtk_widget_create_pango_context (style_window_rgb); #ifdef USE_GCONF use_system_font = gconf_client_get_bool (gconf, @@ -7760,8 +7784,8 @@ init_settings (WnckScreen *screen) button_layout_changed (gconf); #endif - update_style (sytle_window_rgba); - update_style (sytle_window_rgb); + update_style (style_window_rgba); + update_style (style_window_rgb); #ifdef USE_GCONF titlebar_font_changed (gconf); #endif diff --git a/plugins/blur/CMakeLists.txt b/plugins/blur/CMakeLists.txt index 22690a7..d3ba697 100644 --- a/plugins/blur/CMakeLists.txt +++ b/plugins/blur/CMakeLists.txt @@ -4,5 +4,5 @@ include (CompizPlugin) find_package (OpenGL) if (OPENGL_GLU_FOUND) - compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) -endif ()
\ No newline at end of file + compiz_plugin(blur PLUGINDEPS composite opengl PKGDEPS libdecoration LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) +endif () diff --git a/plugins/composite/include/composite/composite.h b/plugins/composite/include/composite/composite.h index 85627b3..8593b53 100644 --- a/plugins/composite/include/composite/composite.h +++ b/plugins/composite/include/composite/composite.h @@ -1,6 +1,3 @@ - - - /* * Copyright © 2008 Dennis Kasprzyk * Copyright © 2007 Novell, Inc. @@ -47,12 +44,38 @@ #define COLOR 0xffff #define BRIGHT 0xffff +/** + * Used to indicate only part of the screen is being redrawn + */ #define PAINT_SCREEN_REGION_MASK (1 << 0) +/** + * Used to indicate that the whole screen is being redrawn + */ #define PAINT_SCREEN_FULL_MASK (1 << 1) +/** + * Used to indicate that every window on this screen will be + * transformed, so non-painted areas should be + * double-buffered + */ #define PAINT_SCREEN_TRANSFORMED_MASK (1 << 2) +/** + * Used to indicate that some windows on this screen will + * be drawn transformed + */ #define PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK (1 << 3) +/** + * Used to indicate that nothing is being drawn on this pass + */ #define PAINT_SCREEN_CLEAR_MASK (1 << 4) +/** + * Used to indicate that occlusion detection is not in use + * on this pass + */ #define PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK (1 << 5) +/** + * Used to indicate that no background will be drawn on this + * pass + */ #define PAINT_SCREEN_NO_BACKGROUND_MASK (1 << 6) @@ -68,32 +91,43 @@ class PrivateCompositeWindow; class CompositeScreen; class CompositeWindow; -/// -/// Interface for painting to composite output. -/// +/** + * Wrapable function interface for CompositeScreen + */ class CompositeScreenInterface : public WrapableInterface<CompositeScreen, CompositeScreenInterface> { public: - /// - /// Pre-paint hook - /// + /** + * Hook which activates just before the screen is painted, + * plugins should use this to calculate animation parameters + * + * @param msSinceLastPaint Describes how many milliseconds have passed + * since the last screen repaint + */ virtual void preparePaint (int); - /// - /// Post-paint hook - /// + /** + * Hook which activates right after the screen is painted, + * plugins should use this to run post-paint cleanup, damage handling + * and setting next paint variables + * + */ virtual void donePaint (); - /// - /// Paint to composite (multiple) outputs - /// + /** + * Hookable function which dispatches painting of outputs + * to rendering plugins such as OpenGL. Hook this function + * to change which outputs are painted, or to paint them + * manually if you are rendering + */ virtual void paint (CompOutput::ptrList &outputs, unsigned int); - /// - /// Gets a list of windows that need to evaluated for repainting - /// + /** + * Hookable function which gets a list of windows that need to be + * evaluated for repainting + */ virtual const CompWindowList & getWindowPaintList (); }; @@ -125,16 +159,33 @@ class CompositeScreen : CompOption::Vector & getOptions (); bool setOption (const CompString &name, CompOption::Value &value); + /** + * Register a dispatch PaintHandler for a rendering plugin + */ bool registerPaintHandler (PaintHandler *pHnd); void unregisterPaintHandler (); bool compositingActive (); + /** + * Returns the value of an XDamage Extension event signature + */ int damageEvent (); + /** + * Causes the entire screen to be redrawn on the next + * event loop + */ void damageScreen (); + + /** + * Adds a specific region to be redrawn on the next + * event loop + */ void damageRegion (const CompRegion &); void damagePending (); + + unsigned int damageMask (); const CompRegion & currentDamage () const; @@ -150,6 +201,9 @@ class CompositeScreen : void setWindowPaintOffset (int x, int y); CompPoint windowPaintOffset (); + /** + * Limits the number of redraws per second + */ void setFPSLimiterMode (CompositeFPSLimiterMode newMode); CompositeFPSLimiterMode FPSLimiterMode (); @@ -188,55 +242,62 @@ class CompositeScreen : that is used to optimize rendering. */ -/* - this flag is present when window is being painted - on a transformed screen. -*/ +/** + * this flag is present when window is being painted + * on a transformed screen. + */ #define PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK (1 << 0) -/* - this flag is present when window is being tested - for occlusion of other windows. -*/ +/** + * this flag is present when window is being tested + * for occlusion of other windows. + */ #define PAINT_WINDOW_OCCLUSION_DETECTION_MASK (1 << 1) -/* - this flag indicates that the window ist painted with - an offset -*/ +/** + * this flag indicates that the window ist painted with + * an offset + */ #define PAINT_WINDOW_WITH_OFFSET_MASK (1 << 2) -/* - flag indicate that window is translucent. -*/ +/** + * flag indicate that window is translucent. + */ #define PAINT_WINDOW_TRANSLUCENT_MASK (1 << 16) -/* - flag indicate that window is transformed. -*/ +/** + * flag indicate that window is transformed. + */ #define PAINT_WINDOW_TRANSFORMED_MASK (1 << 17) -/* - flag indicate that core PaintWindow function should - not draw this window. -*/ +/** + * flag indicate that core PaintWindow function should + * not draw this window. + */ #define PAINT_WINDOW_NO_CORE_INSTANCE_MASK (1 << 18) -/* - flag indicate that blending is required. -*/ +/** + * flag indicate that blending is required. + */ #define PAINT_WINDOW_BLEND_MASK (1 << 19) class CompositeWindowInterface : public WrapableInterface<CompositeWindow, CompositeWindowInterface> { public: - virtual bool damageRect (bool, const CompRect &); + + /** + * Hookable function to determine which parts of the + * screen for this window to redraw on the next pass + * + * @param initial Indicates if this is the first time + * this window is being redrawn + * @param rect Reference to a rect which describes which + * parts of the screen need to be redrawn on next pass + */ + virtual bool damageRect (bool initial, const CompRect &rect); }; -/// -/// A Window that has compositing effects -/// class CompositeWindow : public WrapableHandler<CompositeWindowInterface, 1>, public PluginClassHandler<CompositeWindow, CompWindow, COMPIZ_COMPOSITE_ABI> @@ -246,20 +307,39 @@ class CompositeWindow : CompositeWindow (CompWindow *w); ~CompositeWindow (); + /** + * Binds the window contents of this window to some offscreen pixmap + */ bool bind (); - /// - /// Releases the pixmap data for this window with XFreePixmap. - /// + /** + * Releases the pixmap data for this window with XFreePixmap. + */ void release (); - /// - /// Gets the X server pixel map for this - /// + /** + * Returns the window pixmap + */ Pixmap pixmap (); + /** + * Forces this window to be composited so that the X Server + * stops drawing it and all output is redirected to an + * offscreen pixmap + */ void redirect (); + + /** + * Stops this window from being composited, so that the X Server + * draws the window on-screen normally and output is not redirected + * to an offscreen pixmap + */ + void unredirect (); + + /** + * Returns true if a window is redirected + */ bool redirected (); bool overlayWindow (); @@ -270,19 +350,49 @@ class CompositeWindow : const CompRect &rect); void damageOutputExtents (); + + /** + * Causes an area of the window to be redrawn on the + * next event loop + */ void addDamageRect (const CompRect &); + + /** + * Causes the window to be redrawn on the next + * event loop + */ void addDamage (bool force = false); + /** + * Returns true if this window will be redrawn or + * partially redrawn on the next event loop + */ bool damaged (); + /** + * Sets screen redraw hints for "damaged" areas + * as stated by XDamageNotifyEvent + * + * @param de An XDamageNotifyEvent to be used to + * calculate areas to redraw on the next event loop + */ void processDamage (XDamageNotifyEvent *de); void updateOpacity (); void updateBrightness (); void updateSaturation (); + /** + * Returns the window opacity + */ unsigned short opacity (); + /** + * Returns the window brightness + */ unsigned short brightness (); + /** + * Returns the window saturation + */ unsigned short saturation (); WRAPABLE_HND (0, CompositeWindowInterface, bool, damageRect, diff --git a/plugins/cube/cube.xml.in b/plugins/cube/cube.xml.in index 61cbd01..f31b7f6 100644 --- a/plugins/cube/cube.xml.in +++ b/plugins/cube/cube.xml.in @@ -129,6 +129,7 @@ <option name="skydome_image" type="string"> <_short>Skydome Image</_short> <_long>Image to use as texture for the skydome</_long> + <hints>file;image;</hints> </option> <option name="skydome_animated" type="bool"> <_short>Animate Skydome</_short> diff --git a/plugins/cube/include/cube/cube.h b/plugins/cube/include/cube/cube.h index 46c4f1f..24ff802 100644 --- a/plugins/cube/include/cube/cube.h +++ b/plugins/cube/include/cube/cube.h @@ -48,6 +48,14 @@ class CubeScreenInterface : public WrapableInterface<CubeScreen, CubeScreenInterface> { public: + + /** + * Hookable function to get the current state of rotation + * + * @param x X rotation + * @param v Y Rotation + * @param progress + */ virtual void cubeGetRotation (float &x, float &v, float &progress); virtual void cubeClearTargetOutput (float xRotate, float vRotate); virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib, diff --git a/plugins/dbus/CMakeLists.txt b/plugins/dbus/CMakeLists.txt index d1db970..5ed4b89 100644 --- a/plugins/dbus/CMakeLists.txt +++ b/plugins/dbus/CMakeLists.txt @@ -5,7 +5,6 @@ include (CompizPlugin) add_definitions ( -DHAVE_CONFIG_H -DPLUGINDIR=\\\"${compiz_plugindir}\\\" - -DIMAGEDIR=\\\"${compiz_imagedir}\\\" -DMETADATADIR=\\\"${compiz_metadatadir}\\\" ) diff --git a/plugins/dbus/dbus.xml.in b/plugins/dbus/dbus.xml.in index b1cc166..2d55563 100644 --- a/plugins/dbus/dbus.xml.in +++ b/plugins/dbus/dbus.xml.in @@ -2,5 +2,10 @@ <plugin name="dbus"> <_short>D-Bus</_short> <_long>D-Bus Control Backend</_long> + <category>General</category> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/glib/glib.xml.in b/plugins/glib/glib.xml.in index b2329ca..66cc0ce 100644 --- a/plugins/glib/glib.xml.in +++ b/plugins/glib/glib.xml.in @@ -3,5 +3,9 @@ <_short>GLib</_short> <_long>GLib main loop support</_long> <category>General</category> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/imgpng/imgpng.xml.in b/plugins/imgpng/imgpng.xml.in index ee1d6ae..84a699e 100644 --- a/plugins/imgpng/imgpng.xml.in +++ b/plugins/imgpng/imgpng.xml.in @@ -5,5 +5,9 @@ <category>Image Loading</category> <feature>imageext:png</feature> <feature>imagemime:image/png</feature> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/imgsvg/imgsvg.xml.in b/plugins/imgsvg/imgsvg.xml.in index ec1b37e..a70e884 100644 --- a/plugins/imgsvg/imgsvg.xml.in +++ b/plugins/imgsvg/imgsvg.xml.in @@ -5,6 +5,10 @@ <category>Image Loading</category> <feature>imageext:svg</feature> <feature>imagemime:image/svg+xml</feature> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> <options> <option name="set" type="action"> <_short>Set overlay</_short> diff --git a/plugins/ini/ini.xml.in b/plugins/ini/ini.xml.in index 3c3b32b..bc7628f 100644 --- a/plugins/ini/ini.xml.in +++ b/plugins/ini/ini.xml.in @@ -2,5 +2,9 @@ <plugin name="ini"> <_short>Ini</_short> <_long>Ini Flat File Backend</_long> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/inotify/inotify.xml.in b/plugins/inotify/inotify.xml.in index 2f17e97..472ace9 100644 --- a/plugins/inotify/inotify.xml.in +++ b/plugins/inotify/inotify.xml.in @@ -1,7 +1,11 @@ <compiz> <plugin name="inotify"> - <_short>Inotify</_short> + <_short>File Watcher</_short> <_long>File change notification plugin</_long> <category>Utility</category> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/kde/kde.xml.in b/plugins/kde/kde.xml.in index 1b38f73..0c6ff24 100644 --- a/plugins/kde/kde.xml.in +++ b/plugins/kde/kde.xml.in @@ -4,5 +4,9 @@ <_short>KDE/Qt Event Loop</_short> <_long>Integrates the KDE/Qt event loop into Compiz</_long> <category>General</category> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/plugins/opengl/include/opengl/fragment.h b/plugins/opengl/include/opengl/fragment.h index b1a3f96..253bd07 100644 --- a/plugins/opengl/include/opengl/fragment.h +++ b/plugins/opengl/include/opengl/fragment.h @@ -37,6 +37,10 @@ struct GLWindowPaintAttrib; class GLScreen; +/** + * Describes a texture modification fragment program + * for a texture + */ namespace GLFragment { class Storage; @@ -51,6 +55,10 @@ namespace GLFragment { FunctionData (); ~FunctionData (); + /** + * Returns the status of this fragment program + * (valid or invalid) + */ bool status (); void addTempHeaderOp (const char *name); diff --git a/plugins/opengl/include/opengl/opengl.h b/plugins/opengl/include/opengl/opengl.h index 2e314eb..5b4045c 100644 --- a/plugins/opengl/include/opengl/opengl.h +++ b/plugins/opengl/include/opengl/opengl.h @@ -39,7 +39,9 @@ #include <core/pluginclasshandler.h> -/* camera distance from screen, 0.5 * tan (FOV) */ +/** + * camera distance from screen, 0.5 * tan (FOV) + */ #define DEFAULT_Z_CAMERA 0.866025404f #define RED_SATURATION_WEIGHT 0.30f @@ -236,15 +238,61 @@ class GLScreenInterface : public WrapableInterface<GLScreen, GLScreenInterface> { public: - virtual bool glPaintOutput (const GLScreenPaintAttrib &, - const GLMatrix &, const CompRegion &, - CompOutput *, unsigned int); - virtual void glPaintTransformedOutput (const GLScreenPaintAttrib &, - const GLMatrix &, - const CompRegion &, - CompOutput *, unsigned int); - virtual void glApplyTransform (const GLScreenPaintAttrib &, - CompOutput *, GLMatrix *); + + /** + * Hookable function used for plugins to use openGL to draw on an output + * + * @param attrib Describes some basic drawing attribs for the screen + * including translation, rotation and scale + * @param matrix Describes a 4x4 3D modelview matrix for which this + * screen should be drawn in + * @param region Describes the region of the screen being redrawn + * @param output Describes the output being redrawn + * @param mask Bitmask which describes how the screen is being redrawn' + */ + virtual bool glPaintOutput (const GLScreenPaintAttrib &attrib, + const GLMatrix &matrix, + const CompRegion ®ion, + CompOutput *output, + unsigned int mask); + + + /** + * Hookable function used for plugins to use openGL to draw on an output + * when the screen is transformed + * + * There is little difference between this and glPaintOutput, however + * this will be called when the entire screen is being transformed + * (eg cube) + * + * @param attrib Describes some basic drawing attribs for the screen + * including translation, rotation and scale + * @param matrix Describes a 4x4 3D modelview matrix for which this + * screen should be drawn in + * @param region Describes the region of the screen being redrawn + * @param output Describes the output being redrawn + * @param mask Bitmask which describes how the screen is being redrawn' + */ + virtual void glPaintTransformedOutput (const GLScreenPaintAttrib &attrib, + const GLMatrix &matrix, + const CompRegion ®ion, + CompOutput *output, + unsigned int mask); + + /** + * Hookable function to apply elements from a GLScreenPaintAttrib + * to a GLMatrix in the context of a CompOutput + * + * @param attrib Describes the basic drawing attribs of a screen + * including translation, rotation and scale to be applies to a matrix + * @param output Describes the output in which these operations take + * place + * @param matrix Pointer to a matrix where transformations will + * be applied + */ + virtual void glApplyTransform (const GLScreenPaintAttrib &attrib, + CompOutput *output, + GLMatrix *mask); virtual void glEnableOutputClipping (const GLMatrix &, const CompRegion &, @@ -266,22 +314,51 @@ class GLScreen : CompOption::Vector & getOptions (); bool setOption (const CompString &name, CompOption::Value &value); + /** + * Returns the current compiz-wide openGL texture filter + */ GLenum textureFilter (); + + /** + * Sets a new compiz-wide openGL texture filter + */ void setTextureFilter (GLenum); void clearTargetOutput (unsigned int mask); + /** + * Gets the libGL address of a particular openGL functor + */ GL::FuncPtr getProcAddress (const char *name); void updateBackground (); + /** + * Returns the current compiz-wide texture filter + */ GLTexture::Filter filter (int); + + /** + * Sets a new compiz-wide texture filter + */ void setFilter (int, GLTexture::Filter); GLFragment::Storage * fragmentStorage (); + /** + * Sets a new compiz-wid openGL texture environment mode + */ void setTexEnvMode (GLenum mode); + + /** + * Turns lighting on and off + */ + void setLighting (bool lighting); + + /** + * Returns true if lighting is enabled + */ bool lighting (); void clearOutput (CompOutput *output, unsigned int mask); @@ -293,10 +370,17 @@ class GLScreen : GLFBConfig * glxPixmapFBConfig (unsigned int depth); + /** + * Returns a default icon texture + */ GLTexture *defaultIcon (); void resetRasterPos (); + /** + * Returns a 4x4 const float array which + * represents the current projection matrix + */ const float * projectionMatrix (); WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput, @@ -335,14 +419,61 @@ class GLWindowInterface : public WrapableInterface<GLWindow, GLWindowInterface> { public: - virtual bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, - const CompRegion &, unsigned int); - virtual bool glDraw (const GLMatrix &, GLFragment::Attrib &, - const CompRegion &, unsigned int); - virtual void glAddGeometry (const GLTexture::MatrixList &, - const CompRegion &,const CompRegion &, - unsigned int = MAXSHORT, - unsigned int = MAXSHORT); + + /** + * Hookable function to paint a window on-screen + * + * @param attrib Describes basic drawing attribs of this window; + * opacity, brightness, saturation + * @param matrix A 4x4 matrix which describes the transformation of + * this window + * @param region Describes the region of the window being drawn + * @param mask Bitmask which describes how this window is drawn + */ + virtual bool glPaint (const GLWindowPaintAttrib &attrib, + const GLMatrix &matrix, + const CompRegion ®ion, + unsigned int mask); + + /** + * Hookable function to draw a window on-screen + * + * Unlike glPaint, when glDraw is called, the window is + * drawn immediately + * + * @param matrix A 4x4 matrix which describes the transformation of + * this window + * @param attrib A Fragment attrib which describes the texture + * modification state of this window + * @param region Describes which region will be drawn + * @param mask Bitmask which describes how this window is drawn + */ + virtual bool glDraw (const GLMatrix &matrix, + GLFragment::Attrib &attrib, + const CompRegion ®ion, + unsigned int mask); + + /** + * Hookable function to add points to a window + * texture geometry + * + * This function adds rects to a window's texture geometry + * and modifies their points by the values in the GLTexture::MatrixList + * + * It is used for texture transformation to set points + * for where the texture should be skewed + * + * @param matrices Describes the matrices by which the texture exists + * @param region + * @param clipRegion + * @param min + * @param max + */ + virtual void glAddGeometry (const GLTexture::MatrixList &matrices, + const CompRegion ®ion, + const CompRegion &clipRegion, + unsigned int min = MAXSHORT, + unsigned int max = MAXSHORT); virtual void glDrawTexture (GLTexture *texture, GLFragment::Attrib &, unsigned int); virtual void glDrawGeometry (); @@ -354,6 +485,10 @@ class GLWindow : { public: + /** + * Class which describes the texture geometry and transformation points + * of a window + */ class Geometry { public: Geometry (); @@ -361,7 +496,14 @@ class GLWindow : void reset (); + /** + * Set the number of vertices in the texture geometry + */ bool moreVertices (int newSize); + + /** + * Set the number of indices in the texture geometry + */ bool moreIndices (int newSize); public: @@ -384,19 +526,43 @@ class GLWindow : const CompRegion & clip () const; + /** + * Returns the current paint attributes for this window + */ GLWindowPaintAttrib & paintAttrib (); + + /** + * Returns the last paint attributes for this window + */ GLWindowPaintAttrib & lastPaintAttrib (); unsigned int lastMask () const; + /** + * Binds this window to an openGL texture + */ bool bind (); + + /** + * Releases this window from an openGL texture + */ void release (); + /** + * Returns the tiled textures for this window + */ const GLTexture::List & textures () const; + + /** + * Returns the matrices for the tiled textures for this windwo + */ const GLTexture::MatrixList & matrices () const; void updatePaintAttribs (); + /** + * Returns the window texture geometry + */ Geometry & geometry (); GLTexture *getIcon (int width, int height); diff --git a/plugins/opengl/include/opengl/texture.h b/plugins/opengl/include/opengl/texture.h index eb64dba..3d0ddba 100644 --- a/plugins/opengl/include/opengl/texture.h +++ b/plugins/opengl/include/opengl/texture.h @@ -38,16 +38,31 @@ #define POWER_OF_TWO(v) ((v & (v - 1)) == 0) +/** + * Returns a 2D matrix adjusted texture co-ordinate x + */ #define COMP_TEX_COORD_X(m, vx) ((m).xx * (vx) + (m).x0) +/** + * Returns a 2D matrix adjusted texture co-ordinate y + */ #define COMP_TEX_COORD_Y(m, vy) ((m).yy * (vy) + (m).y0) +/** + * Returns a 2D matrix adjusted texture co-ordinate xy + */ #define COMP_TEX_COORD_XY(m, vx, vy) \ ((m).xx * (vx) + (m).xy * (vy) + (m).x0) +/** + * Returns a 2D matrix adjusted texture co-ordinate yx + */ #define COMP_TEX_COORD_YX(m, vx, vy) \ ((m).yx * (vx) + (m).yy * (vy) + (m).y0) class PrivateTexture; +/** + * Class which represents an openGL texture + */ class GLTexture : public CompRect { public: @@ -64,6 +79,10 @@ class GLTexture : public CompRect { typedef std::vector<Matrix> MatrixList; + /** + * Class which represents a list of openGL textures, + * usually used for texture tiling + */ class List : public std::vector <GLTexture *> { public: @@ -81,28 +100,93 @@ class GLTexture : public CompRect { typedef unsigned int BindPixmapHandle; public: + + /** + * Returns the openGL texture name + */ GLuint name () const; + + /** + * Returns the openGL texture target + */ GLenum target () const; + + /** + * Returns the openGL texture filter + */ GLenum filter () const; + /** + * Returns a 2D 2x3 matrix describing the transformation of + * the texture + */ const Matrix & matrix () const; + /** + * Establishes the texture as the current drawing texture + * in the openGL context + * + * @param filter Defines what kind of filtering level this + * texture should be drawn with + */ virtual void enable (Filter filter); + + /** + * Stops the textures from being the current drawing texture + * in the openGL context + */ virtual void disable (); + /** + * Returns true if this texture is MipMapped + */ bool mipmap () const; + + /** + * Sets if this texture should be MipMapped + */ void setMipmap (bool); + + /** + * Sets the openGL filter which should be used on this + * texture + */ void setFilter (GLenum); void setWrap (GLenum); + /** + * Increases the reference count of a texture + */ static void incRef (GLTexture *); + + /** + * Decreases the reference count of a texture + */ static void decRef (GLTexture *); + /** + * Returns a GLTexture::List with the contents of + * some pixmap + * + * @param pixmap Specifies the pixmap data which should be converted + * into texture data + * @param width Specifies the width of the texture + * @param height Specifies the height of the texture + * @param depth Specifies the color depth of the texture + */ static List bindPixmapToTexture (Pixmap pixmap, int width, int height, int depth); + /** + * Returns a GLTexture::List with the contents of of + * a raw image buffer + * + * @param image Specifies a raw image buffer which should be converted + * into texture data + * @param size Specifies the size of this new texture + */ static List imageBufferToTexture (const char *image, CompSize size); @@ -111,6 +195,13 @@ class GLTexture : public CompRect { GLenum format, GLenum type); + /** + * Uses image loading plugins to read an image from the disk and + * return a GLTexture::List with its contents + * + * @param imageFileName The filename of the image + * @param size The size of this new texture + */ static List readImageToTexture (CompString &imageFileName, CompSize &size); diff --git a/plugins/opengl/include/opengl/vector.h b/plugins/opengl/include/opengl/vector.h index 20176b7..525cbfd 100644 --- a/plugins/opengl/include/opengl/vector.h +++ b/plugins/opengl/include/opengl/vector.h @@ -26,6 +26,10 @@ #ifndef _GLVECTOR_H #define _GLVECTOR_H +/** + * Class which describes a point or vector + * in 3D space + */ class GLVector { public: typedef enum { @@ -38,20 +42,66 @@ class GLVector { GLVector (); GLVector (float x, float y, float z, float w); + /** + * Returns a reference to the x, y, z or w value by using + * 0, 1, 2, 3 as array-access items + */ float& operator[] (int item); + + /** + * Returns a reference to the x, y, z or w value by using + * x, y, z, w as array-access items + */ float& operator[] (VectorCoordsEnum coord); + /** + * Returns a readonly x, y, z or w value by using + * 0, 1, 2, 3 as array-access items + */ const float operator[] (int item) const; + + /** + * Returns a readonly x, y, z or w value by using + * x, y, z, w as array-access items + */ const float operator[] (VectorCoordsEnum coord) const; + /** + * Adds all elements in a GLVector + */ GLVector& operator+= (const GLVector& rhs); + + /** + * Subtracts all elements in a GLVector + */ GLVector& operator-= (const GLVector& rhs); + + /** + * Scales all elements in a vector + * @param k Scale factor + */ GLVector& operator*= (const float k); + + /** + * Scales all elements in a vector by 1 / k + * @param k Scale factor + */ GLVector& operator/= (const float k); GLVector& operator^= (const GLVector& rhs); + /** + * Returns the norm of this vector + */ float norm (); + + /** + * Returns the normalized version of the vector + */ GLVector& normalize (); + + /** + * Returns the homogenized version of the vector + */ GLVector& homogenize (); private: diff --git a/plugins/place/place.xml.in b/plugins/place/place.xml.in index 8109412..a3aa3b5 100644 --- a/plugins/place/place.xml.in +++ b/plugins/place/place.xml.in @@ -4,7 +4,9 @@ <_long>Place windows at appropriate positions when mapped</_long> <category>Window Management</category> <relation type="after"> - <plugin>decoration</plugin> + <plugin>opengl</plugin> + <plugin>composite</plugin> + <plugin>decor</plugin> </relation> <options> <option name="workarounds" type="bool"> diff --git a/plugins/regex/regex.xml.in b/plugins/regex/regex.xml.in index 31dbd8d..6222958 100644 --- a/plugins/regex/regex.xml.in +++ b/plugins/regex/regex.xml.in @@ -3,5 +3,9 @@ <_short>Regex Matching</_short> <_long>Regex window matching</_long> <category>Utility</category> + <relation type="after"> + <plugin>opengl</plugin> + <plugin>composite</plugin> + </relation> </plugin> </compiz> diff --git a/src/option.cpp b/src/option.cpp index a301e7d..1fb69f0 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -486,7 +486,7 @@ CompOption::Restriction::Restriction () : { } -CompOption::Restriction::Restriction (const CompOption::Restriction::Restriction &r) : +CompOption::Restriction::Restriction (const CompOption::Restriction &r) : priv (new PrivateRestriction (*r.priv)) { } diff --git a/src/window.cpp b/src/window.cpp index eb5243f..6072f96 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -4064,18 +4064,22 @@ CompWindow::getIcon (int width, if (result == Success && data) { - CARD32 *p; - CARD32 alpha, red, green, blue; - int iw, ih, j; + CARD32 *p; + CARD32 alpha, red, green, blue; + unsigned long iw, ih; for (i = 0; i + 2 < n; i += iw * ih + 2) { unsigned long *idata = (unsigned long *) data; + unsigned long j; iw = idata[i]; ih = idata[i + 1]; - if (iw * ih + 2 > (int) (n - i)) + /* iw * ih may be larger than the value range of unsigned + * long, so better do some checking for extremely weird + * icon sizes first */ + if (iw > 2048 || ih > 2048 || iw * ih + 2 > n - i) break; if (iw && ih) |