Merge lp:~unity-team/compiz-core/compiz-core.one_property_decor into lp:compiz-core/trunk

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2751
Proposed branch: lp:~unity-team/compiz-core/compiz-core.one_property_decor
Merge into: lp:compiz-core/trunk
Prerequisite: lp:~unity-team/compiz-core/compiz-core.bits_and_pieces_2011_05_21
Diff against target: 711 lines (+226/-170)
12 files modified
gtk/window-decorator/decorator.c (+63/-124)
gtk/window-decorator/gtk-window-decorator.c (+8/-1)
gtk/window-decorator/gtk-window-decorator.h (+2/-3)
gtk/window-decorator/wnck.c (+8/-8)
include/decoration.h (+0/-1)
kde/window-decorator-kde4/decorator.cpp (+9/-2)
kde/window-decorator-kde4/decorator.h (+19/-2)
kde/window-decorator-kde4/utils.cpp (+0/-2)
kde/window-decorator-kde4/window.cpp (+105/-15)
kde/window-decorator-kde4/window.h (+1/-1)
plugins/decor/src/decor.cpp (+9/-8)
plugins/decor/src/decor.h (+2/-3)
To merge this branch: bzr merge lp:~unity-team/compiz-core/compiz-core.one_property_decor
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Sam Spilsbury Pending
Review via email: mp+61801@code.launchpad.net

Commit message

Fixes LP#795071

Stuff all data into one single property, so that we aren't using two and aren't chained to the idea of having to have an active and inactive default decoration (esp when it might not be necessary, though that optimization hasn't been made yet).

Also add workaround for KDE4 Support.

Description of the change

Stuff all data into one single property, so that we aren't using two and aren't chained to the idea of having to have an active and inactive default decoration (esp when it might not be necessary, though that optimization hasn't been made yet).

Also add workaround for KDE4 Support.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1 code looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/decorator.c'
--- gtk/window-decorator/decorator.c 2011-05-20 16:52:31 +0000
+++ gtk/window-decorator/decorator.c 2011-05-20 16:52:31 +0000
@@ -1070,15 +1070,12 @@
1070{1070{
1071 unsigned int frame_state = 0;1071 unsigned int frame_state = 0;
10721072
1073 if (!d->win)1073 WnckWindowState win_state;
1074 return frame_state;
1075
1076 WnckWindowState win_state = wnck_window_get_state (d->win);
1077 const unsigned int n_state_bits = 3;1074 const unsigned int n_state_bits = 3;
1078 unsigned int i;1075 unsigned int i;
10791076
1080 if (d->active)1077 if (d->active)
1081 frame_state &= DECOR_WINDOW_STATE_FOCUS;1078 frame_state |= DECOR_WINDOW_STATE_FOCUS;
10821079
1083 struct typestrings {1080 struct typestrings {
1084 unsigned int wnck_flag;1081 unsigned int wnck_flag;
@@ -1090,6 +1087,13 @@
1090 { WNCK_WINDOW_STATE_SHADED, DECOR_WINDOW_STATE_SHADED }1087 { WNCK_WINDOW_STATE_SHADED, DECOR_WINDOW_STATE_SHADED }
1091 };1088 };
10921089
1090 /* Not possible to match further than active or not if there is
1091 * no window but FIXME we might want to do that later down the line */
1092 if (!d->win)
1093 return frame_state == 0;
1094
1095 win_state = wnck_window_get_state (d->win);
1096
1093 for (i = 0; i < n_state_bits; i++)1097 for (i = 0; i < n_state_bits; i++)
1094 {1098 {
1095 if (win_state & state_bits[i].wnck_flag)1099 if (win_state & state_bits[i].wnck_flag)
@@ -1256,11 +1260,11 @@
1256void1260void
1257update_default_decorations (GdkScreen *screen)1261update_default_decorations (GdkScreen *screen)
1258{1262{
1259 long *active_data, *inactive_data;1263 long *data;
1260 Window xroot;1264 Window xroot;
1261 GdkDisplay *gdkdisplay = gdk_display_get_default ();1265 GdkDisplay *gdkdisplay = gdk_display_get_default ();
1262 Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);1266 Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);
1263 Atom bareAtom, normalAtom, activeAtom;1267 Atom bareAtom, activeAtom;
1264 decor_frame_t *frame;1268 decor_frame_t *frame;
1265 decor_frame_t *bare_frame = gwd_get_decor_frame ("bare");1269 decor_frame_t *bare_frame = gwd_get_decor_frame ("bare");
1266 decor_extents_t extents;1270 decor_extents_t extents;
@@ -1269,7 +1273,6 @@
1269 xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));1273 xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));
12701274
1271 bareAtom = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE);1275 bareAtom = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE);
1272 normalAtom = XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, FALSE);
1273 activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE);1276 activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE);
12741277
1275 if (bare_frame->border_shadow)1278 if (bare_frame->border_shadow)
@@ -1302,11 +1305,6 @@
1302 if (minimal)1305 if (minimal)
1303 {1306 {
1304 XChangeProperty (xdisplay, xroot,1307 XChangeProperty (xdisplay, xroot,
1305 normalAtom,
1306 XA_INTEGER,
1307 32, PropModeReplace, (guchar *) data,
1308 PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
1309 XChangeProperty (xdisplay, xroot,
1310 activeAtom,1308 activeAtom,
1311 XA_INTEGER,1309 XA_INTEGER,
1312 32, PropModeReplace, (guchar *) data,1310 32, PropModeReplace, (guchar *) data,
@@ -1321,7 +1319,6 @@
13211319
1322 if (minimal)1320 if (minimal)
1323 {1321 {
1324 XDeleteProperty (xdisplay, xroot, normalAtom);
1325 XDeleteProperty (xdisplay, xroot, activeAtom);1322 XDeleteProperty (xdisplay, xroot, activeAtom);
1326 }1323 }
1327 }1324 }
@@ -1335,63 +1332,40 @@
1335 XDeleteProperty (xdisplay, xroot,1332 XDeleteProperty (xdisplay, xroot,
1336 activeAtom);1333 activeAtom);
13371334
1338 XDeleteProperty (xdisplay, xroot,1335 data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM * 2, WINDOW_DECORATION_TYPE_PIXMAP);
1339 normalAtom);1336
13401337 /* All active states and all inactive states */
1341 active_data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM, WINDOW_DECORATION_TYPE_PIXMAP);1338 for (i = 0; i < WINDOW_TYPE_FRAMES_NUM * 2; i++)
1342 inactive_data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM, WINDOW_DECORATION_TYPE_PIXMAP);
1343
1344 for (i = 0; i < WINDOW_TYPE_FRAMES_NUM; i++)
1345 {1339 {
1346 frame = gwd_get_decor_frame (default_frames[i].name);1340 frame = gwd_get_decor_frame (default_frames[i].name);
1347 extents = frame->win_extents;1341 extents = frame->win_extents;
13481342
1349 if (default_frames[i].active_d)1343 if (default_frames[i].d)
1350 {1344 {
1351 if (default_frames[i].active_d->pixmap)1345 if (default_frames[i].d->pixmap)
1352 g_object_unref (G_OBJECT (default_frames[i].active_d->pixmap));1346 g_object_unref (G_OBJECT (default_frames[i].d->pixmap));
13531347
1354 free (default_frames[i].active_d);1348 free (default_frames[i].d);
1355 }1349 }
13561350
1357 if (default_frames[i].inactive_d)1351 default_frames[i].d = calloc (1, sizeof (decor_t));
1358 {1352
1359 if (default_frames[i].inactive_d->pixmap)1353 default_frames[i].d->context = &frame->window_context;
1360 g_object_unref (G_OBJECT (default_frames[i].inactive_d->pixmap));1354 default_frames[i].d->shadow = frame->border_shadow;
13611355 default_frames[i].d->layout = pango_layout_new (frame->pango_context);
1362 free (default_frames[i].inactive_d);1356
1363 }1357 decor_get_default_layout (default_frames[i].d->context, 1, 1, &default_frames[i].d->border_layout);
13641358
1365 default_frames[i].active_d = calloc (1, sizeof (decor_t));1359 default_frames[i].d->width = default_frames[i].d->border_layout.width;
1366 default_frames[i].inactive_d = calloc (1, sizeof (decor_t));1360 default_frames[i].d->height = default_frames[i].d->border_layout.height;
13671361
1368 default_frames[i].active_d->context = &frame->window_context;1362 default_frames[i].d->frame = frame;
1369 default_frames[i].inactive_d->context = &frame->window_context;1363 default_frames[i].d->active = i < WINDOW_TYPE_FRAMES_NUM ? TRUE : FALSE;
1370 default_frames[i].active_d->shadow = frame->border_shadow;
1371 default_frames[i].inactive_d->shadow = frame->border_shadow;
1372 default_frames[i].active_d->layout = pango_layout_new (frame->pango_context);
1373 default_frames[i].inactive_d->layout = pango_layout_new (frame->pango_context);
1374
1375 decor_get_default_layout (default_frames[i].active_d->context, 1, 1, &default_frames[i].active_d->border_layout);
1376 decor_get_default_layout (default_frames[i].inactive_d->context, 1, 1, &default_frames[i].inactive_d->border_layout);
1377
1378 default_frames[i].active_d->width = default_frames[i].active_d->border_layout.width;
1379 default_frames[i].active_d->height = default_frames[i].active_d->border_layout.height;
1380
1381 default_frames[i].active_d->frame = frame;
1382
1383 default_frames[i].inactive_d->width = default_frames[i].inactive_d->border_layout.width;
1384 default_frames[i].inactive_d->height = default_frames[i].inactive_d->border_layout.height;
1385
1386 default_frames[i].inactive_d->frame = frame;
13871364
1388 extents.top += frame->titlebar_height;1365 extents.top += frame->titlebar_height;
13891366
1390 default_frames[i].inactive_d->draw = theme_draw_window_decoration;1367 default_frames[i].d->draw = theme_draw_window_decoration;
1391 default_frames[i].active_d->draw = theme_draw_window_decoration;1368 default_frames[i].d->pixmap = create_pixmap (default_frames[i].d->width, default_frames[i].d->height, frame->style_window_rgba);
1392
1393 default_frames[i].active_d->pixmap = create_pixmap (default_frames[i].active_d->width, default_frames[i].active_d->height, frame->style_window_rgba);
1394 default_frames[i].inactive_d->pixmap = create_pixmap (default_frames[i].active_d->width, default_frames[i].active_d->height, frame->style_window_rgba);
13951369
1396 unsigned int j, k;1370 unsigned int j, k;
13971371
@@ -1399,61 +1373,34 @@
1399 {1373 {
1400 for (k = 0; k < 3; k++)1374 for (k = 0; k < 3; k++)
1401 {1375 {
1402 default_frames[i].active_d->event_windows[j][k].window = None;1376 default_frames[i].d->event_windows[j][k].window = None;
1403 default_frames[i].inactive_d->event_windows[j][k].window = None;
1404 }1377 }
1405 }1378 }
14061379
1407 for (j = 0; j < BUTTON_NUM; j++)1380 for (j = 0; j < BUTTON_NUM; j++)
1408 {1381 {
1409 default_frames[i].active_d->button_windows[j].window = None;1382 default_frames[i].d->button_windows[j].window = None;
1410 default_frames[i].active_d->button_states[j] = 0;1383 default_frames[i].d->button_states[j] = 0;
1411 default_frames[i].inactive_d->button_windows[j].window = None;
1412 default_frames[i].inactive_d->button_states[j] = 0;
1413 }1384 }
14141385
1415 if (default_frames[i].active_d->pixmap)1386 if (default_frames[i].d->pixmap)
1416 {1387 {
1417 gint nQuad;1388 gint nQuad;
1418 unsigned int frame_type = populate_frame_type (default_frames[i].active_d);1389 unsigned int frame_type = populate_frame_type (default_frames[i].d);
1419 unsigned int frame_state = populate_frame_state (default_frames[i].active_d);1390 unsigned int frame_state = populate_frame_state (default_frames[i].d);
1420 unsigned int frame_actions = populate_frame_actions (default_frames[i].active_d);1391 unsigned int frame_actions = populate_frame_actions (default_frames[i].d);
1421 decor_quad_t quads[N_QUADS_MAX];1392 decor_quad_t quads[N_QUADS_MAX];
14221393
1423 nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].active_d->context,1394 nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].d->context,
1424 &default_frames[i].active_d->border_layout);1395 &default_frames[i].d->border_layout);
14251396
1426 default_frames[i].active_d->active = TRUE;1397 default_frames[i].d->picture = XRenderCreatePicture (xdisplay,
1427 default_frames[i].active_d->picture = XRenderCreatePicture (xdisplay,1398 GDK_PIXMAP_XID (default_frames[i].d->pixmap),
1428 GDK_PIXMAP_XID (default_frames[i].active_d->pixmap),1399 xformat_rgba, 0, NULL);
1429 xformat_rgba, 0, NULL);1400
14301401 (*default_frames[i].d->draw) (default_frames[i].d);
1431 (*default_frames[i].active_d->draw) (default_frames[i].active_d);1402
14321403 decor_quads_to_property (data, i, GDK_PIXMAP_XID (default_frames[i].d->pixmap),
1433 decor_quads_to_property (active_data, i, GDK_PIXMAP_XID (default_frames[i].active_d->pixmap),
1434 &extents, &extents,
1435 &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);
1436 }
1437
1438 if (default_frames[i].inactive_d->pixmap)
1439 {
1440 gint nQuad;
1441 unsigned int frame_type = populate_frame_type (default_frames[i].inactive_d);
1442 unsigned int frame_state = populate_frame_state (default_frames[i].inactive_d);
1443 unsigned int frame_actions = populate_frame_actions (default_frames[i].inactive_d);
1444 decor_quad_t quads[N_QUADS_MAX];
1445
1446 nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].inactive_d->context,
1447 &default_frames[i].inactive_d->border_layout);
1448
1449 default_frames[i].inactive_d->active = FALSE;
1450 default_frames[i].inactive_d->picture = XRenderCreatePicture (xdisplay,
1451 GDK_PIXMAP_XID (default_frames[i].inactive_d->pixmap),
1452 xformat_rgba, 0, NULL);
1453
1454 (*default_frames[i].inactive_d->draw) (default_frames[i].inactive_d);
1455
1456 decor_quads_to_property (inactive_data, i, GDK_PIXMAP_XID (default_frames[i].inactive_d->pixmap),
1457 &extents, &extents,1404 &extents, &extents,
1458 &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);1405 &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);
1459 }1406 }
@@ -1464,18 +1411,10 @@
1464 XChangeProperty (xdisplay, xroot,1411 XChangeProperty (xdisplay, xroot,
1465 activeAtom,1412 activeAtom,
1466 XA_INTEGER,1413 XA_INTEGER,
1467 32, PropModeAppend, (guchar *) active_data,1414 32, PropModeAppend, (guchar *) data,
1468 PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX));1415 PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM * 2) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX));
14691416
14701417 free (data);
1471 XChangeProperty (xdisplay, xroot,
1472 normalAtom,
1473 XA_INTEGER,
1474 32, PropModeAppend, (guchar *) inactive_data,
1475 PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX));
1476
1477 free (active_data);
1478 free (inactive_data);
14791418
1480 gwd_decor_frame_unref (bare_frame);1419 gwd_decor_frame_unref (bare_frame);
1481}1420}
14821421
=== modified file 'gtk/window-decorator/gtk-window-decorator.c'
--- gtk/window-decorator/gtk-window-decorator.c 2011-05-20 16:52:31 +0000
+++ gtk/window-decorator/gtk-window-decorator.c 2011-05-20 16:52:31 +0000
@@ -83,7 +83,14 @@
83};83};
8484
85#define WINDOW_TYPE_FRAMES_NUM 585#define WINDOW_TYPE_FRAMES_NUM 5
86struct _default_frame_references default_frames[WINDOW_TYPE_FRAMES_NUM] = {86struct _default_frame_references default_frames[WINDOW_TYPE_FRAMES_NUM * 2] = {
87 /* active */
88 {"normal", NULL },
89 {"dialog", NULL },
90 {"modal_dialog", NULL },
91 {"menu", NULL },
92 {"utility", NULL},
93 /* inactive */
87 {"normal", NULL },94 {"normal", NULL },
88 {"dialog", NULL },95 {"dialog", NULL },
89 {"modal_dialog", NULL },96 {"modal_dialog", NULL },
9097
=== modified file 'gtk/window-decorator/gtk-window-decorator.h'
--- gtk/window-decorator/gtk-window-decorator.h 2011-05-20 16:52:31 +0000
+++ gtk/window-decorator/gtk-window-decorator.h 2011-05-20 16:52:31 +0000
@@ -459,9 +459,8 @@
459struct _default_frame_references459struct _default_frame_references
460{460{
461 char *name;461 char *name;
462 decor_t *active_d;462 decor_t *d;
463 decor_t *inactive_d;463} extern default_frames[WINDOW_TYPE_FRAMES_NUM * 2];
464} extern default_frames[WINDOW_TYPE_FRAMES_NUM];
465const gchar * window_type_frames[WINDOW_TYPE_FRAMES_NUM];464const gchar * window_type_frames[WINDOW_TYPE_FRAMES_NUM];
466465
467void (*theme_draw_window_decoration) (decor_t *d);466void (*theme_draw_window_decoration) (decor_t *d);
468467
=== modified file 'gtk/window-decorator/wnck.c'
--- gtk/window-decorator/wnck.c 2011-05-20 16:52:31 +0000
+++ gtk/window-decorator/wnck.c 2011-05-20 16:52:31 +0000
@@ -690,19 +690,19 @@
690 GList *windows;690 GList *windows;
691691
692 g_signal_connect_object (G_OBJECT (screen), "active_window_changed",692 g_signal_connect_object (G_OBJECT (screen), "active_window_changed",
693 G_CALLBACK (active_window_changed),693 G_CALLBACK (active_window_changed),
694 0, 0);694 0, 0);
695 g_signal_connect_object (G_OBJECT (screen), "window_opened",695 g_signal_connect_object (G_OBJECT (screen), "window_opened",
696 G_CALLBACK (window_opened),696 G_CALLBACK (window_opened),
697 0, 0);697 0, 0);
698 g_signal_connect_object (G_OBJECT (screen), "window_closed",698 g_signal_connect_object (G_OBJECT (screen), "window_closed",
699 G_CALLBACK (window_closed),699 G_CALLBACK (window_closed),
700 0, 0);700 0, 0);
701701
702 windows = wnck_screen_get_windows (screen);702 windows = wnck_screen_get_windows (screen);
703 while (windows != NULL)703 while (windows != NULL)
704 {704 {
705 window_opened (screen, windows->data);705 window_opened (screen, windows->data);
706 windows = windows->next;706 windows = windows->next;
707 }707 }
708}708}
709709
=== modified file 'include/decoration.h'
--- include/decoration.h 2011-05-20 16:52:31 +0000
+++ include/decoration.h 2011-05-20 16:52:31 +0000
@@ -38,7 +38,6 @@
3838
39#define DECOR_SUPPORTING_DM_CHECK_ATOM_NAME "_COMPIZ_SUPPORTING_DM_CHECK"39#define DECOR_SUPPORTING_DM_CHECK_ATOM_NAME "_COMPIZ_SUPPORTING_DM_CHECK"
40#define DECOR_BARE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_BARE"40#define DECOR_BARE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_BARE"
41#define DECOR_NORMAL_ATOM_NAME "_COMPIZ_WINDOW_DECOR_NORMAL"
42#define DECOR_ACTIVE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_ACTIVE"41#define DECOR_ACTIVE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_ACTIVE"
43#define DECOR_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR"42#define DECOR_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR"
44#define DECOR_BLUR_ATOM_NAME "_COMPIZ_WM_WINDOW_BLUR_DECOR"43#define DECOR_BLUR_ATOM_NAME "_COMPIZ_WM_WINDOW_BLUR_DECOR"
4544
=== modified file 'kde/window-decorator-kde4/decorator.cpp'
--- kde/window-decorator-kde4/decorator.cpp 2011-05-20 16:52:31 +0000
+++ kde/window-decorator-kde4/decorator.cpp 2011-05-20 16:52:31 +0000
@@ -63,6 +63,10 @@
63WId KWD::Decorator::mActiveId;63WId KWD::Decorator::mActiveId;
64decor_shadow_options_t KWD::Decorator::mShadowOptions;64decor_shadow_options_t KWD::Decorator::mShadowOptions;
6565
66KWD::Window *KWD::Decorator::mDecorNormal = NULL;
67KWD::Window *KWD::Decorator::mDecorActive = NULL;
68KWD::Decorator *KWD::Decorator::mSelf = NULL;
69
66struct _cursor cursors[3][3] = {70struct _cursor cursors[3][3] = {
67 { C (top_left_corner), C (top_side), C (top_right_corner) },71 { C (top_left_corner), C (top_side), C (top_right_corner) },
68 { C (left_side), C (left_ptr), C (right_side) },72 { C (left_side), C (left_ptr), C (right_side) },
@@ -88,6 +92,8 @@
88 XSetWindowAttributes attr;92 XSetWindowAttributes attr;
89 int i, j;93 int i, j;
9094
95 mSelf = this;
96
91 mRootInfo = new NETRootInfo (QX11Info::display (), 0);97 mRootInfo = new NETRootInfo (QX11Info::display (), 0);
9298
93 mActiveId = 0;99 mActiveId = 0;
@@ -192,9 +198,10 @@
192198
193 updateShadow ();199 updateShadow ();
194200
201 /* FIXME: Implement proper decoration lists and remove this */
195 mDecorNormal = new KWD::Window (mCompositeWindow,202 mDecorNormal = new KWD::Window (mCompositeWindow,
196 QX11Info::appRootWindow (),203 QX11Info::appRootWindow (),
197 0, Window::Default);204 0, Window::Default);
198 mDecorActive = new KWD::Window (mCompositeWindow,205 mDecorActive = new KWD::Window (mCompositeWindow,
199 QX11Info::appRootWindow (),206 QX11Info::appRootWindow (),
200 0, Window::DefaultActive);207 0, Window::DefaultActive);
201208
=== modified file 'kde/window-decorator-kde4/decorator.h'
--- kde/window-decorator-kde4/decorator.h 2010-08-20 15:29:13 +0000
+++ kde/window-decorator-kde4/decorator.h 2011-05-20 16:52:31 +0000
@@ -108,6 +108,21 @@
108 return &mShadowOptions;108 return &mShadowOptions;
109 }109 }
110110
111 static KWD::Window *defaultNormal ()
112 {
113 return mDecorNormal;
114 }
115
116 static KWD::Window *defaultActive ()
117 {
118 return mDecorActive;
119 }
120
121 static KWD::Decorator *self ()
122 {
123 return mSelf;
124 }
125
111 static void sendClientMessage (WId eventWid,126 static void sendClientMessage (WId eventWid,
112 WId wid,127 WId wid,
113 Atom atom,128 Atom atom,
@@ -152,8 +167,8 @@
152 static NETRootInfo *mRootInfo;167 static NETRootInfo *mRootInfo;
153 static WId mActiveId;168 static WId mActiveId;
154169
155 KWD::Window *mDecorNormal;170 static KWD::Window *mDecorNormal;
156 KWD::Window *mDecorActive;171 static KWD::Window *mDecorActive;
157 QMap <WId, KWD::Window *>mClients;172 QMap <WId, KWD::Window *>mClients;
158 QMap <WId, KWD::Window *>mFrames;173 QMap <WId, KWD::Window *>mFrames;
159 KConfig *mConfig;174 KConfig *mConfig;
@@ -162,6 +177,8 @@
162 WId mCompositeWindow;177 WId mCompositeWindow;
163178
164 Switcher *mSwitcher;179 Switcher *mSwitcher;
180
181 static KWD::Decorator *mSelf; /* XXX: Remove */
165 };182 };
166}183}
167184
168185
=== modified file 'kde/window-decorator-kde4/utils.cpp'
--- kde/window-decorator-kde4/utils.cpp 2010-10-24 14:42:07 +0000
+++ kde/window-decorator-kde4/utils.cpp 2011-05-20 16:52:31 +0000
@@ -221,8 +221,6 @@
221 compizShadowColor =221 compizShadowColor =
222 XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_COLOR", false);222 XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_COLOR", false);
223 netWindowDecor = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, false);223 netWindowDecor = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, false);
224 netWindowDecorNormal =
225 XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, false);
226 netWindowDecorActive =224 netWindowDecorActive =
227 XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, false);225 XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, false);
228 netWindowDecorBare =226 netWindowDecorBare =
229227
=== modified file 'kde/window-decorator-kde4/window.cpp'
--- kde/window-decorator-kde4/window.cpp 2011-05-20 16:52:31 +0000
+++ kde/window-decorator-kde4/window.cpp 2011-05-20 16:52:31 +0000
@@ -185,6 +185,8 @@
185{185{
186 if (mType == DefaultActive)186 if (mType == DefaultActive)
187 return true;187 return true;
188 else if (mType == Default)
189 return false;
188190
189 return Decorator::activeId () == mClientId;191 return Decorator::activeId () == mClientId;
190}192}
@@ -1004,7 +1006,30 @@
1004 if (mPaintRedirector)1006 if (mPaintRedirector)
1005 mUpdateProperty = true;1007 mUpdateProperty = true;
1006 else1008 else
1007 updateProperty ();1009 {
1010 long *data = NULL;
1011 unsigned int propSize = 0;
1012 KWD::Window *otherUpdate = NULL;
1013
1014 if (mType == Default || mType == DefaultActive)
1015 {
1016 propSize = 2;
1017 data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP);
1018
1019 if (mType == Default)
1020 otherUpdate = KWD::Decorator::self ()->defaultActive ();
1021 else if (mType == DefaultActive)
1022 otherUpdate = KWD::Decorator::self ()->defaultNormal ();
1023 }
1024
1025 data = updateProperty (data, propSize);
1026
1027 if (otherUpdate && data)
1028 {
1029 otherUpdate->updateProperty (data, propSize);
1030 free (data);
1031 }
1032 }
1008}1033}
10091034
1010void1035void
@@ -1111,22 +1136,50 @@
1111 }1136 }
1112}1137}
11131138
1114void1139long *
1115KWD::Window::updateProperty (void)1140KWD::Window::updateProperty (long *data,
1141 unsigned int propSize)
1116{1142{
1117 Atom atom = Atoms::netWindowDecor;1143 Atom atom = Atoms::netWindowDecor;
1118 decor_extents_t maxExtents, normExtents;1144 decor_extents_t maxExtents, normExtents;
1119 decor_quad_t quads[N_QUADS_MAX];1145 decor_quad_t quads[N_QUADS_MAX];
1146 unsigned int nOffset = 1;
1147 unsigned int frameType = 0xffffff;
1148 unsigned int frameState = 0;
1149 unsigned int frameActions = 0;
1120 int nQuad = 0;1150 int nQuad = 0;
1121 unsigned int nOffset = 1, frameType = 0, frameState = 0, frameActions = 0;
1122 long *data = NULL;
1123 int left, right, top, bottom, width, height;1151 int left, right, top, bottom, width, height;
1124 unsigned int saveState;1152 unsigned int saveState;
11251153 bool allocated = false;
1126 if (mType == Default)1154
1127 atom = Atoms::netWindowDecorNormal;1155 if (!propSize)
1128 else if (mType == DefaultActive)1156 propSize = nOffset;
1129 atom = Atoms::netWindowDecorActive;1157
1158 /* FIXME: This is essentially a hack to put the default
1159 * active and inactive decorations in the same property,
1160 * since we take an existing allocated property and return
1161 * the data in there and then pass it to the next KWD::Window
1162 * to update the property again. That's sub-optimal, but
1163 * its the best solution until we implement proper decoration
1164 * lists inside of kde4-window-decorator */
1165
1166 if (mType != Normal && mType != Normal2D)
1167 {
1168 atom = Atoms::netWindowDecorActive;
1169
1170 if (mType == Default)
1171 {
1172 frameState &= ~(DECOR_WINDOW_STATE_FOCUS);
1173 nOffset = 2;
1174 }
1175 else if (mType == DefaultActive)
1176 {
1177 frameState |= DECOR_WINDOW_STATE_FOCUS;
1178 nOffset = 1;
1179 }
1180 }
1181 else if (!propSize)
1182 propSize = nOffset;
11301183
1131 saveState = mState;1184 saveState = mState;
1132 mState = NET::MaxVert | NET::MaxHoriz;1185 mState = NET::MaxVert | NET::MaxHoriz;
@@ -1148,7 +1201,11 @@
11481201
1149 if (mType != Normal2D)1202 if (mType != Normal2D)
1150 {1203 {
1151 data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);1204 if (!data)
1205 {
1206 allocated = true;
1207 data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP);
1208 }
1152 if (mType == Normal)1209 if (mType == Normal)
1153 {1210 {
1154 decor_quad_t *q = quads;1211 decor_quad_t *q = quads;
@@ -1246,7 +1303,11 @@
1246 }1303 }
1247 else1304 else
1248 {1305 {
1249 data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_WINDOW);1306 if (!data)
1307 {
1308 allocated = true;
1309 data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP);
1310 }
1250 decor_gen_window_property (data, nOffset - 1, &normExtents, &maxExtents, 1, 0, frameType, frameState, frameActions);1311 decor_gen_window_property (data, nOffset - 1, &normExtents, &maxExtents, 1, 0, frameType, frameState, frameActions);
1251 }1312 }
12521313
@@ -1254,12 +1315,18 @@
1254 XChangeProperty (QX11Info::display(), mClientId, atom,1315 XChangeProperty (QX11Info::display(), mClientId, atom,
1255 XA_INTEGER,1316 XA_INTEGER,
1256 32, PropModeReplace, (unsigned char *) data,1317 32, PropModeReplace, (unsigned char *) data,
1257 PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);1318 PROP_HEADER_SIZE + propSize * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX));
1258 KWD::popXError ();1319 KWD::popXError ();
12591320
1260 free (data);1321 if (allocated)
1322 {
1323 free (data);
1324 data = NULL;
1325 }
12611326
1262 mUpdateProperty = false;1327 mUpdateProperty = false;
1328
1329 return data;
1263}1330}
12641331
1265void1332void
@@ -1874,7 +1941,30 @@
1874 }1941 }
18751942
1876 if (mUpdateProperty)1943 if (mUpdateProperty)
1877 updateProperty ();1944 {
1945 long *data = NULL;
1946 unsigned int propSize = 0;
1947 KWD::Window *otherUpdate = NULL;
1948
1949 if (mType == Default || mType == DefaultActive)
1950 {
1951 propSize = 2;
1952 data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP);
1953
1954 if (mType == Default)
1955 otherUpdate = KWD::Decorator::self ()->defaultActive ();
1956 else if (mType == DefaultActive)
1957 otherUpdate = KWD::Decorator::self ()->defaultNormal ();
1958 }
1959
1960 data = updateProperty (data, propSize);
1961
1962 if (otherUpdate && data)
1963 {
1964 otherUpdate->updateProperty (data, propSize);
1965 free (data);
1966 }
1967 }
1878}1968}
18791969
1880QWidget *1970QWidget *
18811971
=== modified file 'kde/window-decorator-kde4/window.h'
--- kde/window-decorator-kde4/window.h 2010-02-12 20:11:21 +0000
+++ kde/window-decorator-kde4/window.h 2011-05-20 16:52:31 +0000
@@ -206,7 +206,7 @@
206 int bottomOffset,206 int bottomOffset,
207 int leftOffset,207 int leftOffset,
208 int rightOffset);208 int rightOffset);
209 void updateProperty (void);209 long * updateProperty (long *, unsigned int);
210 void getWindowProtocols (void);210 void getWindowProtocols (void);
211211
212 Options::MouseCommand buttonToCommand (Qt::MouseButtons button);212 Options::MouseCommand buttonToCommand (Qt::MouseButtons button);
213213
=== modified file 'plugins/decor/src/decor.cpp'
--- plugins/decor/src/decor.cpp 2011-05-20 16:52:31 +0000
+++ plugins/decor/src/decor.cpp 2011-05-20 16:52:31 +0000
@@ -558,6 +558,12 @@
558 decoration->maxBorder.top = maxBorder.top;558 decoration->maxBorder.top = maxBorder.top;
559 decoration->maxBorder.bottom = maxBorder.bottom;559 decoration->maxBorder.bottom = maxBorder.bottom;
560560
561 /* Decoration info */
562
563 decoration->frameType = frameType;
564 decoration->frameState = frameState;
565 decoration->frameActions = frameActions;
566
561 decoration->refCount = 1;567 decoration->refCount = 1;
562 decoration->type = type;568 decoration->type = type;
563569
@@ -645,7 +651,7 @@
645 Decoration *d = Decoration::create (id, prop, n, type, i);651 Decoration *d = Decoration::create (id, prop, n, type, i);
646652
647 if (!d)653 if (!d)
648 {654 {
649 XFree (data);655 XFree (data);
650 mList.clear ();656 mList.clear ();
651 return false;657 return false;
@@ -1067,10 +1073,7 @@
1067 !(dScreen->dmSupports & WINDOW_DECORATION_TYPE_WINDOW &&1073 !(dScreen->dmSupports & WINDOW_DECORATION_TYPE_WINDOW &&
1068 pixmapFailed))1074 pixmapFailed))
1069 {1075 {
1070 if (window->id () == screen->activeWindow ())1076 decoration = dScreen->decor[DECOR_ACTIVE].findMatchingDecoration (window, false);
1071 decoration = dScreen->decor[DECOR_ACTIVE].findMatchingDecoration (window, false);
1072 else
1073 decoration = dScreen->decor[DECOR_NORMAL].findMatchingDecoration (window, false);
10741077
1075 if (!decoration)1078 if (!decoration)
1076 compLogMessage ("decor", CompLogLevelWarn, "No default decoration found, placement will not be correct");1079 compLogMessage ("decor", CompLogLevelWarn, "No default decoration found, placement will not be correct");
@@ -2218,9 +2221,7 @@
2218 winDecorAtom =2221 winDecorAtom =
2219 XInternAtom (s->dpy (), DECOR_WINDOW_ATOM_NAME, 0);2222 XInternAtom (s->dpy (), DECOR_WINDOW_ATOM_NAME, 0);
2220 decorAtom[DECOR_BARE] =2223 decorAtom[DECOR_BARE] =
2221 XInternAtom (s->dpy (), DECOR_BARE_ATOM_NAME, 0);2224 XInternAtom (s->dpy (), DECOR_BARE_ATOM_NAME, 0);
2222 decorAtom[DECOR_NORMAL] =
2223 XInternAtom (s->dpy (), DECOR_NORMAL_ATOM_NAME, 0);
2224 decorAtom[DECOR_ACTIVE] =2225 decorAtom[DECOR_ACTIVE] =
2225 XInternAtom (s->dpy (), DECOR_ACTIVE_ATOM_NAME, 0);2226 XInternAtom (s->dpy (), DECOR_ACTIVE_ATOM_NAME, 0);
2226 inputFrameAtom =2227 inputFrameAtom =
22272228
=== modified file 'plugins/decor/src/decor.h'
--- plugins/decor/src/decor.h 2011-05-20 16:52:31 +0000
+++ plugins/decor/src/decor.h 2011-05-20 16:52:31 +0000
@@ -45,9 +45,8 @@
4545
46/* FIXME: Remove */46/* FIXME: Remove */
47#define DECOR_BARE 047#define DECOR_BARE 0
48#define DECOR_NORMAL 148#define DECOR_ACTIVE 1
49#define DECOR_ACTIVE 249#define DECOR_NUM 2
50#define DECOR_NUM 3
5150
52class DecorTexture {51class DecorTexture {
5352

Subscribers

People subscribed via source and target branches

to all changes: