summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-09-09 20:55:15 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-09-09 20:55:15 -0400
commita32b0a31a710ff1a74158b30ca07069bd8010356 (patch)
tree2ff1dfb8eba5a2d2a20a4ab9a06d1cfee4b394c3
parent2d120a582b95ab012947eb0399c94d8f657f755f (diff)
init hardest
-rw-r--r--src/compiz.c209
-rw-r--r--src/e_mod_main.h3
-rw-r--r--src/exports/display.c127
-rw-r--r--src/exports/event.c2
-rw-r--r--src/exports/paint.c273
-rw-r--r--src/exports/screen.c136
-rw-r--r--src/exports/texture.c37
-rw-r--r--src/exports/window.c6
8 files changed, 449 insertions, 344 deletions
diff --git a/src/compiz.c b/src/compiz.c
index 05774e7..f842e36 100644
--- a/src/compiz.c
+++ b/src/compiz.c
@@ -28,20 +28,28 @@
28static Eina_Hash *wins; 28static Eina_Hash *wins;
29static Eina_Hash *clients; 29static Eina_Hash *clients;
30static Eina_Hash *textures; 30static Eina_Hash *textures;
31static Eina_Hash *wintextures;
31static Eina_List *handlers; 32static Eina_List *handlers;
32static Eina_List *hooks; 33static Eina_List *hooks;
33static Eina_Array *events; 34static Eina_Array *events;
34static Ecore_Idle_Enterer *compiz_idle; 35static Ecore_Idle_Enterer *compiz_idle;
35 36
37static Eina_Bool init = EINA_FALSE;
38
36E_API int pointerX = 0; 39E_API int pointerX = 0;
37E_API int pointerY = 0; 40E_API int pointerY = 0;
38E_API int lastPointerX = 0; 41E_API int lastPointerX = 0;
39E_API int lastPointerY = 0; 42E_API int lastPointerY = 0;
40 43
41static Evas_GL_Config *glcfg; 44typedef struct
42static Evas_GL_Surface *glsfc; 45{
43EINTERN Evas_GL_Context *glctx = NULL; 46 Evas_GL_Context *ctx;
47 Evas_GL_Surface *sfc;
48 GLuint fbo;
49 int w, h;
50} Compiz_GL;
44EINTERN Evas_GL *gl = NULL; 51EINTERN Evas_GL *gl = NULL;
52static Evas_GL_Config *glcfg = NULL;
45E_API Evas_GL_API *compiz_glapi = NULL; 53E_API Evas_GL_API *compiz_glapi = NULL;
46 54
47EINTERN int compiz_main(void); 55EINTERN int compiz_main(void);
@@ -330,25 +338,10 @@ compiz_client_render(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
330} 338}
331 339
332static void 340static void
333compiz_client_dirty(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 341compiz_client_maximize(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
334{ 342{
335 CompWindow *w = data; 343 E_Client *ec = e_comp_object_client_get(obj);
336 E_Client *ec; 344 maximizeWindow(data, ec->maximized * MAXIMIZE_STATE);
337 GLuint fbo;
338 Evas_Native_Surface ns;
339
340 ec = e_comp_object_client_get(obj);
341
342 fbo = (uintptr_t)eina_hash_find(textures, &w->texture);
343 ns.version = EVAS_NATIVE_SURFACE_VERSION;
344 ns.type = EVAS_NATIVE_SURFACE_OPENGL;
345 ns.data.opengl.texture_id = w->texture->name;
346 ns.data.opengl.framebuffer_id = fbo;
347 ns.data.opengl.internal_format = GL_RGBA;
348 ns.data.opengl.format = GL_BGRA_EXT;
349 ns.data.opengl.x = ns.data.opengl.y = 0;
350 e_pixmap_size_get(ec->pixmap, (int*)&ns.data.opengl.w, (int*)&ns.data.opengl.h);
351 e_comp_object_native_surface_override(obj, &ns);
352} 345}
353 346
354EINTERN void 347EINTERN void
@@ -359,8 +352,9 @@ compiz_win_hash_client(CompWindow *w, E_Client *ec)
359 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FREE, compiz_client_free, w); 352 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FREE, compiz_client_free, w);
360 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, compiz_client_stack, ec); 353 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, compiz_client_stack, ec);
361 evas_object_smart_callback_add(ec->frame, "render", compiz_client_render, w); 354 evas_object_smart_callback_add(ec->frame, "render", compiz_client_render, w);
362 evas_object_smart_callback_add(ec->frame, "dirty", compiz_client_dirty, w);
363 evas_object_smart_callback_add(ec->frame, "damage", compiz_client_damage, w); 355 evas_object_smart_callback_add(ec->frame, "damage", compiz_client_damage, w);
356 evas_object_smart_callback_add(ec->frame, "maximize_done", compiz_client_maximize, w);
357 evas_object_smart_callback_add(ec->frame, "unmaximize_done", compiz_client_maximize, w);
364} 358}
365 359
366EINTERN void 360EINTERN void
@@ -370,25 +364,115 @@ compiz_win_hash_del(CompWindow *w)
370} 364}
371 365
372EINTERN void 366EINTERN void
367compiz_texture_activate(CompTexture *texture, Eina_Bool set)
368{
369 Compiz_GL *cgl;
370
371 if (!set)
372 compiz_glapi->glFinish();
373 if (!set) return;
374 cgl = eina_hash_find(textures, &texture);
375 evas_gl_make_current(gl, cgl->sfc, cgl->ctx);
376
377}
378
379EINTERN void
373compiz_texture_init(CompTexture *texture) 380compiz_texture_init(CompTexture *texture)
374{ 381{
375 GLuint fbo; 382 Compiz_GL *cgl;
383 E_Client *ec;
384 CompWindow *win;
385 int w, h;
386 Evas_Native_Surface ns;
387 GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f };
388 GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 0.0f };
389 GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
390 GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
391
392 win = eina_hash_find(wintextures, &texture);
393 if (!win) abort();
394 evas_gl_make_current(gl, NULL, NULL);
395 ec = compiz_win_to_client(win);
396 e_pixmap_size_get(ec->pixmap, &w, &h);
397 cgl = eina_hash_find(textures, &texture);
398 if (cgl)
399 {
400 if ((cgl->w == w) && (cgl->h == h)) return;
401 evas_gl_surface_destroy(gl, cgl->sfc);
402 }
403 else
404 {
405 cgl = malloc(sizeof(Compiz_GL));
406 cgl->ctx = evas_gl_context_create(gl, NULL);
407 evas_gl_make_current(gl, NULL, cgl->ctx);
408 compiz_glapi->glGenFramebuffers(1, &cgl->fbo);
409 compiz_glapi->glClearColor (0.0, 0.0, 0.0, 1.0);
410 compiz_glapi->glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
411 //compiz_glapi->glEnable (GL_CULL_FACE);
412 //compiz_glapi->glDisable (GL_BLEND);
413 //compiz_glapi->glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
414 compiz_glapi->glEnableClientState (GL_VERTEX_ARRAY);
415 compiz_glapi->glEnableClientState (GL_TEXTURE_COORD_ARRAY);
416 //compiz_glapi->glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient);
417 //compiz_glapi->glNormal3f(0.0f, 0.0f, -1.0f);
418 if (!win->screen->maxTextureSize)
419 compiz_glapi->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &win->screen->maxTextureSize);
420
421 compiz_glapi->glMatrixMode(GL_PROJECTION);
422 compiz_glapi->glLoadIdentity();
423 compiz_glapi->glMatrixMode(GL_MODELVIEW);
424 compiz_glapi->glLoadIdentity();
425 //compiz_glapi->glDepthRange (0, 1);
426 //compiz_glapi->glViewport(-1, -1, 2, 2);
427 //compiz_glapi->glRasterPos2f (0, 0);
428
429 compiz_glapi->glMatrixMode(GL_PROJECTION);
430 compiz_glapi->glLoadIdentity();
431 compiz_glapi->glMultMatrixf(win->screen->projection);
432 compiz_glapi->glMatrixMode(GL_MODELVIEW);
433 //compiz_glapi->glEnable(GL_LIGHT0);
434 //compiz_glapi->glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
435 //compiz_glapi->glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
436 //compiz_glapi->glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
437 eina_hash_add(textures, &texture, cgl);
438 win->id = window_get(ec);
439 }
440 cgl->w = w, cgl->h = h;
441 cgl->sfc = evas_gl_surface_create(gl, glcfg, w, h);
442 evas_gl_make_current(gl, cgl->sfc, cgl->ctx);
443 compiz_glapi->glViewport(0, 0, w, h);
444 evas_gl_native_surface_get(gl, cgl->sfc, &ns);
445 e_comp_object_native_surface_override(ec->frame, &ns);
446}
376 447
377 if (eina_hash_find(textures, &texture)) return; 448EINTERN void
378 compiz_glapi->glGenFramebuffers(1, &fbo); 449compiz_texture_bind(CompTexture *texture)
379 compiz_glapi->glBindFramebuffer(GL_FRAMEBUFFER, fbo); 450{
451 Compiz_GL *cgl;
452
453 cgl = eina_hash_find(textures, &texture);
454 compiz_glapi->glBindFramebuffer(GL_FRAMEBUFFER, cgl->fbo);
380 compiz_glapi->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->name, 0); 455 compiz_glapi->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->name, 0);
381 eina_hash_add(textures, &texture, (uintptr_t*)fbo);
382 compiz_glapi->glBindFramebuffer(GL_FRAMEBUFFER, 0); 456 compiz_glapi->glBindFramebuffer(GL_FRAMEBUFFER, 0);
383} 457}
384 458
385EINTERN void 459EINTERN void
460compiz_texture_to_win(CompTexture *texture, CompWindow *w)
461{
462 eina_hash_set(wintextures, &texture, w);
463}
464
465EINTERN void
386compiz_texture_del(CompTexture *texture) 466compiz_texture_del(CompTexture *texture)
387{ 467{
388 GLuint fbo; 468 Compiz_GL *cgl;
389 469
390 fbo = (uintptr_t)eina_hash_set(textures, &texture, NULL); 470 cgl = eina_hash_set(textures, &texture, NULL);
391 compiz_glapi->glDeleteFramebuffers(1, &fbo); 471 evas_gl_make_current(gl, cgl->sfc, cgl->ctx);
472 compiz_glapi->glDeleteFramebuffers(1, &cgl->fbo);
473 evas_gl_surface_destroy(gl, cgl->sfc);
474 evas_gl_context_destroy(gl, cgl->ctx);
475 free(cgl);
392} 476}
393 477
394static Eina_Bool 478static Eina_Bool
@@ -420,27 +504,6 @@ compiz_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Mous
420static void 504static void
421compiz_gl_init() 505compiz_gl_init()
422{ 506{
423 glsfc = evas_gl_surface_create(gl, glcfg, e_comp->w, e_comp->h);
424 compiz_glapi = evas_gl_api_get(gl);
425#define GLFN(FN) \
426 if (!compiz_glapi->FN) \
427 compiz_glapi->FN = evas_gl_proc_address_get(gl, #FN)
428 GLFN(glLightModelfv);
429 GLFN(glLightfv);
430 GLFN(glNormal3f);
431 GLFN(glPushMatrix);
432 GLFN(glPopMatrix);
433 GLFN(glMatrixMode);
434 GLFN(glLoadMatrixf);
435 GLFN(glLoadIdentity);
436 GLFN(glMultMatrixf);
437 GLFN(glTexEnvi);
438 GLFN(glColor4f);
439 GLFN(glVertexPointer);
440 GLFN(glEnableClientState);
441 GLFN(glDisableClientState);
442 GLFN(glTexCoordPointer);
443#undef GLFN
444 assert(!compiz_main()); 507 assert(!compiz_main());
445} 508}
446 509
@@ -448,9 +511,11 @@ static void
448compiz_gl_render(void) 511compiz_gl_render(void)
449{ 512{
450 struct timeval tv; 513 struct timeval tv;
451 evas_gl_make_current(gl, glsfc, glctx); 514 if (!init)
452 if (!compiz_glapi) 515 {
453 compiz_gl_init(); 516 assert(!compiz_main());
517 init = EINA_TRUE;
518 }
454 gettimeofday (&tv, 0); 519 gettimeofday (&tv, 0);
455 handleTimeouts(&tv); 520 handleTimeouts(&tv);
456 fprintf(stderr, "COMPIZ LOOP\n"); 521 fprintf(stderr, "COMPIZ LOOP\n");
@@ -520,19 +585,45 @@ compiz_move_end(void *d EINA_UNUSED, E_Client *ec)
520 w->screen->windowUngrabNotify(w); 585 w->screen->windowUngrabNotify(w);
521} 586}
522 587
588static void
589gl_fn_init(void)
590{
591#define GLFN(FN) \
592 if (!compiz_glapi->FN) \
593 compiz_glapi->FN = evas_gl_proc_address_get(gl, #FN)
594 GLFN(glLightModelfv);
595 GLFN(glLightfv);
596 GLFN(glNormal3f);
597 GLFN(glPushMatrix);
598 GLFN(glPopMatrix);
599 GLFN(glMatrixMode);
600 GLFN(glLoadMatrixf);
601 GLFN(glLoadIdentity);
602 GLFN(glMultMatrixf);
603 GLFN(glTexEnvi);
604 GLFN(glColor4f);
605 GLFN(glVertexPointer);
606 GLFN(glEnableClientState);
607 GLFN(glDisableClientState);
608 GLFN(glTexCoordPointer);
609#undef GLFN
610}
611
523EINTERN void 612EINTERN void
524compiz_init(void) 613compiz_init(void)
525{ 614{
526 glcfg = evas_gl_config_new(); 615 glcfg = evas_gl_config_new();
527 glcfg->color_format = EVAS_GL_RGB_888; 616 glcfg->color_format = EVAS_GL_RGBA_8888;
528 glcfg->gles_version = EVAS_GL_GLES_2_X; 617 glcfg->gles_version = EVAS_GL_GLES_2_X;
529 glcfg->depth_bits = EVAS_GL_DEPTH_BIT_24; 618 glcfg->depth_bits = EVAS_GL_DEPTH_BIT_24;
530 glcfg->stencil_bits = EVAS_GL_STENCIL_BIT_8; 619 glcfg->stencil_bits = EVAS_GL_STENCIL_BIT_8;
531 gl = evas_gl_new(e_comp->evas); 620 gl = evas_gl_new(e_comp->evas);
532 glctx = evas_gl_context_create(gl, NULL); 621 compiz_glapi = evas_gl_api_get(gl);
622 gl_fn_init();
533 wins = eina_hash_pointer_new((Eina_Free_Cb)win_hash_free); 623 wins = eina_hash_pointer_new((Eina_Free_Cb)win_hash_free);
534 clients = eina_hash_pointer_new(NULL); 624 clients = eina_hash_pointer_new(NULL);
535 textures = eina_hash_pointer_new(NULL); 625 textures = eina_hash_pointer_new(NULL);
626 wintextures = eina_hash_pointer_new(NULL);
536 //evas_event_callback_add(e_comp->evas, EVAS_CALLBACK_RENDER_PRE, (Evas_Event_Cb)compiz_render_pre, NULL); 627 //evas_event_callback_add(e_comp->evas, EVAS_CALLBACK_RENDER_PRE, (Evas_Event_Cb)compiz_render_pre, NULL);
537 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, compiz_mouse_move, NULL); 628 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, compiz_mouse_move, NULL);
538 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, compiz_client_add, NULL); 629 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, compiz_client_add, NULL);
@@ -557,10 +648,6 @@ compiz_shutdown(void)
557 E_FREE_LIST(hooks, e_client_hook_del); 648 E_FREE_LIST(hooks, e_client_hook_del);
558 E_FREE_FUNC(compiz_idle, ecore_idle_enterer_del); 649 E_FREE_FUNC(compiz_idle, ecore_idle_enterer_del);
559 compiz_fini(); 650 compiz_fini();
560 evas_gl_surface_destroy(gl, glsfc);
561 evas_gl_context_destroy(gl, glctx);
562 glctx = NULL;
563 glsfc = NULL;
564 E_FREE_FUNC(gl, evas_gl_free); 651 E_FREE_FUNC(gl, evas_gl_free);
565 E_FREE_FUNC(glcfg, evas_gl_config_free); 652 E_FREE_FUNC(glcfg, evas_gl_config_free);
566 e_comp->pre_render_cbs = eina_list_remove(e_comp->pre_render_cbs, compiz_gl_render); 653 e_comp->pre_render_cbs = eina_list_remove(e_comp->pre_render_cbs, compiz_gl_render);
@@ -568,4 +655,6 @@ compiz_shutdown(void)
568 eina_hash_free(wins); 655 eina_hash_free(wins);
569 eina_hash_free(clients); 656 eina_hash_free(clients);
570 eina_hash_free(textures); 657 eina_hash_free(textures);
658 eina_hash_free(wintextures);
659 init = EINA_FALSE;
571} 660}
diff --git a/src/e_mod_main.h b/src/e_mod_main.h
index 76b8e00..51c9c5e 100644
--- a/src/e_mod_main.h
+++ b/src/e_mod_main.h
@@ -321,4 +321,7 @@ EINTERN unsigned int win_type_to_compiz(E_Window_Type type);
321 321
322EINTERN void compiz_texture_del(CompTexture *texture); 322EINTERN void compiz_texture_del(CompTexture *texture);
323EINTERN void compiz_texture_init(CompTexture *texture); 323EINTERN void compiz_texture_init(CompTexture *texture);
324EINTERN void compiz_texture_bind(CompTexture *texture);
325EINTERN void compiz_texture_to_win(CompTexture *texture, CompWindow *win);
326EINTERN void compiz_texture_activate(CompTexture *texture, Eina_Bool set);
324#endif 327#endif
diff --git a/src/exports/display.c b/src/exports/display.c
index 5401410..281dd2b 100644
--- a/src/exports/display.c
+++ b/src/exports/display.c
@@ -1462,8 +1462,8 @@ eventLoop(void)
1462 CompScreen *s; 1462 CompScreen *s;
1463 CompWindow *w; 1463 CompWindow *w;
1464 CompTimeout *t; 1464 CompTimeout *t;
1465 int time, timeToNextRedraw = 0; 1465 int time, timeToNextRedraw = MAXSHORT;
1466 unsigned int damageMask, mask; 1466 unsigned int damageMask = 0, mask;
1467 1467
1468 //for (d = core.displays; d; d = d->next) 1468 //for (d = core.displays; d; d = d->next)
1469 //d->watchFdHandle = 1469 //d->watchFdHandle =
@@ -1539,24 +1539,6 @@ eventLoop(void)
1539 { 1539 {
1540 for (s = d->screens; s; s = s->next) 1540 for (s = d->screens; s; s = s->next)
1541 { 1541 {
1542 if (s->damageMask)
1543 {
1544 finishScreenDrawing(s);
1545 }
1546 else
1547 {
1548 s->idle = TRUE;
1549 }
1550 }
1551 }
1552
1553 damageMask = 0;
1554 timeToNextRedraw = MAXSHORT;
1555
1556 for (d = core.displays; d; d = d->next)
1557 {
1558 for (s = d->screens; s; s = s->next)
1559 {
1560 if (!s->damageMask) 1542 if (!s->damageMask)
1561 continue; 1543 continue;
1562 1544
@@ -1577,14 +1559,14 @@ eventLoop(void)
1577 { 1559 {
1578 time = timeToNextRedraw; 1560 time = timeToNextRedraw;
1579 //if (time) 1561 //if (time)
1580 //time = doPoll(time); 1562 //time = doPoll(time);
1581 1563
1582 if (time == 0) 1564 if (time == 0)
1583 { 1565 {
1584 //gettimeofday(&tv, 0); 1566 //gettimeofday(&tv, 0);
1585 1567
1586 //if (core.timeouts) 1568 //if (core.timeouts)
1587 //handleTimeouts(&tv); 1569 //handleTimeouts(&tv);
1588 1570
1589 for (d = core.displays; d; d = d->next) 1571 for (d = core.displays; d; d = d->next)
1590 { 1572 {
@@ -1715,21 +1697,21 @@ eventLoop(void)
1715 y = s->height - pBox->y2; 1697 y = s->height - pBox->y2;
1716 1698
1717 compiz_glapi->glBitmap(0, 0, 0, 0, 1699 compiz_glapi->glBitmap(0, 0, 0, 0,
1718 pBox->x1 - s->rasterX, 1700 pBox->x1 - s->rasterX,
1719 y - s->rasterY, 1701 y - s->rasterY,
1720 NULL); 1702 NULL);
1721 1703
1722 s->rasterX = pBox->x1; 1704 s->rasterX = pBox->x1;
1723 s->rasterY = y; 1705 s->rasterY = y;
1724 1706
1725 compiz_glapi->glScissor(pBox->x1, y, 1707 compiz_glapi->glScissor(pBox->x1, y,
1726 pBox->x2 - pBox->x1, 1708 pBox->x2 - pBox->x1,
1727 pBox->y2 - pBox->y1); 1709 pBox->y2 - pBox->y1);
1728 1710
1729 compiz_glapi->glCopyPixels(pBox->x1, y, 1711 compiz_glapi->glCopyPixels(pBox->x1, y,
1730 pBox->x2 - pBox->x1, 1712 pBox->x2 - pBox->x1,
1731 pBox->y2 - pBox->y1, 1713 pBox->y2 - pBox->y1,
1732 GL_COLOR); 1714 GL_COLOR);
1733 1715
1734 pBox++; 1716 pBox++;
1735 } 1717 }
@@ -1768,32 +1750,47 @@ eventLoop(void)
1768 } 1750 }
1769 } 1751 }
1770 } 1752 }
1753
1754 for (d = core.displays; d; d = d->next)
1755 {
1756 for (s = d->screens; s; s = s->next)
1757 {
1758 if (s->damageMask)
1759 {
1760 finishScreenDrawing(s);
1761 }
1762 else
1763 {
1764 s->idle = TRUE;
1765 }
1766 }
1767 }
1771 //else 1768 //else
1772 //{ 1769 //{
1773 //if (core.timeouts) 1770 //if (core.timeouts)
1774 //{ 1771 //{
1775 //if (core.timeouts->minLeft > 0) 1772 //if (core.timeouts->minLeft > 0)
1776 //{ 1773 //{
1777 //t = core.timeouts; 1774 //t = core.timeouts;
1778 //time = t->maxLeft; 1775 //time = t->maxLeft;
1779 //while (t && t->minLeft <= time) 1776 //while (t && t->minLeft <= time)
1780 //{ 1777 //{
1781 //if (t->maxLeft < time) 1778 //if (t->maxLeft < time)
1782 //time = t->maxLeft; 1779 //time = t->maxLeft;
1783 //t = t->next; 1780 //t = t->next;
1784 //} 1781 //}
1785 //doPoll(time); 1782 //doPoll(time);
1786 //} 1783 //}
1787 1784
1788 //gettimeofday(&tv, 0); 1785 //gettimeofday(&tv, 0);
1789 1786
1790 //handleTimeouts(&tv); 1787 //handleTimeouts(&tv);
1791 //} 1788 //}
1792 //else 1789 //else
1793 //{ 1790 //{
1794 //doPoll(-1); 1791 //doPoll(-1);
1795 //} 1792 //}
1796 //} 1793 //}
1797//} 1794//}
1798 1795
1799//for (d = core.displays; d; d = d->next) 1796//for (d = core.displays; d; d = d->next)
@@ -2846,24 +2843,24 @@ warpPointer(CompScreen *s,
2846 pointerY = 0; 2843 pointerY = 0;
2847 2844
2848 //XWarpPointer(display->display, 2845 //XWarpPointer(display->display,
2849 //None, s->root, 2846 //None, s->root,
2850 //0, 0, 0, 0, 2847 //0, 0, 0, 0,
2851 //pointerX, pointerY); 2848 //pointerX, pointerY);
2852 2849
2853 //XSync(display->display, FALSE); 2850 //XSync(display->display, FALSE);
2854 2851
2855 //while (XCheckMaskEvent(display->display, 2852 //while (XCheckMaskEvent(display->display,
2856 //LeaveWindowMask | 2853 //LeaveWindowMask |
2857 //EnterWindowMask | 2854 //EnterWindowMask |
2858 //PointerMotionMask, 2855 //PointerMotionMask,
2859 //&event)) 2856 //&event))
2860 //; 2857 //;
2861 2858
2862 //if (!inHandleEvent) 2859 //if (!inHandleEvent)
2863 //{ 2860 //{
2864 //lastPointerX = pointerX; 2861 //lastPointerX = pointerX;
2865 //lastPointerY = pointerY; 2862 //lastPointerY = pointerY;
2866 //} 2863 //}
2867} 2864}
2868 2865
2869Bool 2866Bool
diff --git a/src/exports/event.c b/src/exports/event.c
index 1fbfa34..9f8ac7a 100644
--- a/src/exports/event.c
+++ b/src/exports/event.c
@@ -2337,7 +2337,7 @@ handleEvent(CompDisplay *d,
2337 break; 2337 break;
2338 2338
2339 default: 2339 default:
2340 if (event->type == d->damageEvent + XDamageNotify) 2340 if (event->type == d->damageEvent)
2341 { 2341 {
2342 XDamageNotifyEvent *de = (XDamageNotifyEvent *)event; 2342 XDamageNotifyEvent *de = (XDamageNotifyEvent *)event;
2343 2343
diff --git a/src/exports/paint.c b/src/exports/paint.c
index ee24c66..cc3eb7b 100644
--- a/src/exports/paint.c
+++ b/src/exports/paint.c
@@ -94,11 +94,11 @@ prepareXCoords(CompScreen *screen,
94{ 94{
95 compiz_glapi->glTranslatef(-0.5f, -0.5f, z); 95 compiz_glapi->glTranslatef(-0.5f, -0.5f, z);
96 compiz_glapi->glScalef(1.0f / output->width, 96 compiz_glapi->glScalef(1.0f / output->width,
97 -1.0f / output->height, 97 -1.0f / output->height,
98 1.0f); 98 1.0f);
99 compiz_glapi->glTranslatef(-output->region.extents.x1, 99 compiz_glapi->glTranslatef(-output->region.extents.x1,
100 -output->region.extents.y2, 100 -output->region.extents.y2,
101 0.0f); 101 0.0f);
102} 102}
103 103
104void 104void
@@ -126,16 +126,16 @@ paintCursor(CompCursor *c,
126 compiz_glapi->glBegin(GL_QUADS); 126 compiz_glapi->glBegin(GL_QUADS);
127 127
128 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x1), 128 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x1),
129 COMP_TEX_COORD_Y(&c->matrix, y2)); 129 COMP_TEX_COORD_Y(&c->matrix, y2));
130 compiz_glapi->glVertex2i(x1, y2); 130 compiz_glapi->glVertex2i(x1, y2);
131 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x2), 131 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x2),
132 COMP_TEX_COORD_Y(&c->matrix, y2)); 132 COMP_TEX_COORD_Y(&c->matrix, y2));
133 compiz_glapi->glVertex2i(x2, y2); 133 compiz_glapi->glVertex2i(x2, y2);
134 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x2), 134 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x2),
135 COMP_TEX_COORD_Y(&c->matrix, y1)); 135 COMP_TEX_COORD_Y(&c->matrix, y1));
136 compiz_glapi->glVertex2i(x2, y1); 136 compiz_glapi->glVertex2i(x2, y1);
137 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x1), 137 compiz_glapi->glTexCoord2f(COMP_TEX_COORD_X(&c->matrix, x1),
138 COMP_TEX_COORD_Y(&c->matrix, y1)); 138 COMP_TEX_COORD_Y(&c->matrix, y1));
139 compiz_glapi->glVertex2i(x1, y1); 139 compiz_glapi->glVertex2i(x1, y1);
140 140
141 compiz_glapi->glEnd(); 141 compiz_glapi->glEnd();
@@ -432,6 +432,7 @@ enableOutputClipping(CompScreen *screen,
432 Region region, 432 Region region,
433 CompOutput *output) 433 CompOutput *output)
434{ 434{
435#if 0
435 GLfloat h = screen->height; 436 GLfloat h = screen->height;
436 437
437 GLfloat p1[2] = { region->extents.x1, h - region->extents.y2 }; 438 GLfloat p1[2] = { region->extents.x1, h - region->extents.y2 };
@@ -462,15 +463,18 @@ enableOutputClipping(CompScreen *screen,
462 compiz_glapi->glEnable(GL_CLIP_PLANE3); 463 compiz_glapi->glEnable(GL_CLIP_PLANE3);
463 464
464 compiz_glapi->glPopMatrix(); 465 compiz_glapi->glPopMatrix();
466#endif
465} 467}
466 468
467void 469void
468disableOutputClipping(CompScreen *screen) 470disableOutputClipping(CompScreen *screen)
469{ 471{
472#if 0
470 compiz_glapi->glDisable(GL_CLIP_PLANE0); 473 compiz_glapi->glDisable(GL_CLIP_PLANE0);
471 compiz_glapi->glDisable(GL_CLIP_PLANE1); 474 compiz_glapi->glDisable(GL_CLIP_PLANE1);
472 compiz_glapi->glDisable(GL_CLIP_PLANE2); 475 compiz_glapi->glDisable(GL_CLIP_PLANE2);
473 compiz_glapi->glDisable(GL_CLIP_PLANE3); 476 compiz_glapi->glDisable(GL_CLIP_PLANE3);
477#endif
474} 478}
475 479
476#define CLIP_PLANE_MASK (PAINT_SCREEN_TRANSFORMED_MASK | \ 480#define CLIP_PLANE_MASK (PAINT_SCREEN_TRANSFORMED_MASK | \
@@ -500,12 +504,12 @@ paintTransformedOutput(CompScreen *screen,
500 transformToScreenSpace(screen, output, -sAttrib->zTranslate, 504 transformToScreenSpace(screen, output, -sAttrib->zTranslate,
501 &sTransform); 505 &sTransform);
502 506
503 compiz_glapi->glPushMatrix(); 507 //compiz_glapi->glPushMatrix();
504 compiz_glapi->glLoadMatrixf(sTransform.m); 508 //compiz_glapi->glLoadMatrixf(sTransform.m);
505 509
506 paintOutputRegion(screen, &sTransform, region, output, mask); 510 paintOutputRegion(screen, &sTransform, region, output, mask);
507 511
508 compiz_glapi->glPopMatrix(); 512 //compiz_glapi->glPopMatrix();
509 513
510 screen->disableOutputClipping(screen); 514 screen->disableOutputClipping(screen);
511 } 515 }
@@ -514,12 +518,12 @@ paintTransformedOutput(CompScreen *screen,
514 transformToScreenSpace(screen, output, -sAttrib->zTranslate, 518 transformToScreenSpace(screen, output, -sAttrib->zTranslate,
515 &sTransform); 519 &sTransform);
516 520
517 compiz_glapi->glPushMatrix(); 521 //compiz_glapi->glPushMatrix();
518 compiz_glapi->glLoadMatrixf(sTransform.m); 522 //compiz_glapi->glLoadMatrixf(sTransform.m);
519 523
520 paintOutputRegion(screen, &sTransform, region, output, mask); 524 paintOutputRegion(screen, &sTransform, region, output, mask);
521 525
522 compiz_glapi->glPopMatrix(); 526 //compiz_glapi->glPopMatrix();
523 } 527 }
524} 528}
525 529
@@ -568,8 +572,8 @@ paintOutput(CompScreen *screen,
568 572
569 transformToScreenSpace(screen, output, -DEFAULT_Z_CAMERA, &sTransform); 573 transformToScreenSpace(screen, output, -DEFAULT_Z_CAMERA, &sTransform);
570 574
571 compiz_glapi->glPushMatrix(); 575 //compiz_glapi->glPushMatrix();
572 compiz_glapi->glLoadMatrixf(sTransform.m); 576 //compiz_glapi->glLoadMatrixf(sTransform.m);
573 577
574 paintOutputRegion(screen, &sTransform, region, output, mask); 578 paintOutputRegion(screen, &sTransform, region, output, mask);
575 579
@@ -708,7 +712,7 @@ drawWindowGeometry(CompWindow *w)
708 compiz_glapi->glTexCoordPointer(w->texCoordSize, GL_FLOAT, stride, vertices); 712 compiz_glapi->glTexCoordPointer(w->texCoordSize, GL_FLOAT, stride, vertices);
709 } 713 }
710 714
711 compiz_glapi->glDrawArrays(GL_TRIANGLES, 0, 6); 715 compiz_glapi->glDrawArrays(0x0007, 0, w->vCount);
712 716
713 /* disable all texture coordinate arrays except 0 */ 717 /* disable all texture coordinate arrays except 0 */
714 texUnit = w->texUnits; 718 texUnit = w->texUnits;
@@ -933,7 +937,7 @@ enableFragmentProgramAndDrawGeometry(CompWindow *w,
933 { 937 {
934 screenTexEnvMode(s, GL_MODULATE); 938 screenTexEnvMode(s, GL_MODULATE);
935 compiz_glapi->glColor4f(attrib->brightness, attrib->brightness, 939 compiz_glapi->glColor4f(attrib->brightness, attrib->brightness,
936 attrib->brightness, BRIGHT); 940 attrib->brightness, BRIGHT);
937 941
938 (*w->drawWindowGeometry)(w); 942 (*w->drawWindowGeometry)(w);
939 943
@@ -961,160 +965,161 @@ enableFragmentOperationsAndDrawGeometry(CompWindow *w,
961{ 965{
962 CompScreen *s = w->screen; 966 CompScreen *s = w->screen;
963 967
964 if (s->canDoSaturated && attrib->saturation != COLOR) 968 //if (s->canDoSaturated && attrib->saturation != COLOR)
965 { 969 //{
966 GLfloat constant[4]; 970 //GLfloat constant[4];
967 971
968 if (mask & PAINT_WINDOW_BLEND_MASK) 972 //if (mask & PAINT_WINDOW_BLEND_MASK)
969 compiz_glapi->glEnable(GL_BLEND); 973 //compiz_glapi->glEnable(GL_BLEND);
970 974
971 enableTexture(s, texture, filter); 975 //enableTexture(s, texture, filter);
972 976
973 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); 977 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
974 978
975 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); 979 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
976 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); 980 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
977 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR); 981 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
978 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PRIMARY_COLOR); 982 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PRIMARY_COLOR);
979 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); 983 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
980 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); 984 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
981 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); 985 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
982 986
983 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); 987 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
984 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE); 988 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
985 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); 989 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
986 990
987 compiz_glapi->glColor4f(1.0f, 1.0f, 1.0f, 0.5f); 991 //compiz_glapi->glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
988 992
989 s->activeTexture(GL_TEXTURE1); 993 //s->activeTexture(GL_TEXTURE1);
990 994
991 enableTexture(s, texture, filter); 995 //enableTexture(s, texture, filter);
992 996
993 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); 997 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
994 998
995 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); 999 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);
996 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS); 1000 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
997 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT); 1001 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
998 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); 1002 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
999 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); 1003 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
1000 1004
1001 if (s->canDoSlightlySaturated && attrib->saturation > 0) 1005 //if (s->canDoSlightlySaturated && attrib->saturation > 0)
1002 { 1006 //{
1003 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); 1007 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
1004 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); 1008 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
1005 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); 1009 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
1006 1010
1007 constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT; 1011 //constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT;
1008 constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT; 1012 //constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT;
1009 constant[2] = 0.5f + 0.5f * BLUE_SATURATION_WEIGHT; 1013 //constant[2] = 0.5f + 0.5f * BLUE_SATURATION_WEIGHT;
1010 constant[3] = 1.0; 1014 //constant[3] = 1.0;
1011 1015
1012 compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); 1016 //compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
1013 1017
1014 s->activeTexture(GL_TEXTURE2); 1018 //s->activeTexture(GL_TEXTURE2);
1015 1019
1016 enableTexture(s, texture, filter); 1020 //enableTexture(s, texture, filter);
1017 1021
1018 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); 1022 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
1019 1023
1020 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); 1024 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
1021 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0); 1025 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
1022 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); 1026 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
1023 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); 1027 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
1024 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); 1028 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
1025 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); 1029 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
1026 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); 1030 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
1027 1031
1028 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); 1032 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
1029 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); 1033 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
1030 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); 1034 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
1031 1035
1032 constant[3] = attrib->saturation / 65535.0f; 1036 //constant[3] = attrib->saturation / 65535.0f;
1033 1037
1034 compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); 1038 //compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
1035 1039
1036 if (attrib->opacity < OPAQUE || attrib->brightness != BRIGHT) 1040 //if (attrib->opacity < OPAQUE || attrib->brightness != BRIGHT)
1037 { 1041 //{
1038 s->activeTexture(GL_TEXTURE3); 1042 //s->activeTexture(GL_TEXTURE3);
1039 1043
1040 enableTexture(s, texture, filter); 1044 //enableTexture(s, texture, filter);
1041 1045
1042 constant[3] = attrib->opacity / 65535.0f; 1046 //constant[3] = attrib->opacity / 65535.0f;
1043 constant[0] = constant[1] = constant[2] = constant[3] * 1047 //constant[0] = constant[1] = constant[2] = constant[3] *
1044 attrib->brightness / 65535.0f; 1048 //attrib->brightness / 65535.0f;
1045 1049
1046 compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); 1050 //compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
1047 1051
1048 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); 1052 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
1049 1053
1050 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); 1054 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
1051 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS); 1055 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
1052 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT); 1056 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
1053 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); 1057 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
1054 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); 1058 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
1055 1059
1056 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); 1060 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
1057 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); 1061 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
1058 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT); 1062 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT);
1059 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); 1063 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
1060 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); 1064 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
1061 1065
1062 (*w->drawWindowGeometry)(w); 1066 //(*w->drawWindowGeometry)(w);
1063 1067
1064 disableTexture(s, texture); 1068 //disableTexture(s, texture);
1065 1069
1066 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 1070 //compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1067 1071
1068 s->activeTexture(GL_TEXTURE2); 1072 //s->activeTexture(GL_TEXTURE2);
1069 } 1073 //}
1070 else 1074 //else
1071 { 1075 //{
1072 (*w->drawWindowGeometry)(w); 1076 //(*w->drawWindowGeometry)(w);
1073 } 1077 //}
1074 1078
1075 disableTexture(s, texture); 1079 //disableTexture(s, texture);
1076 1080
1077 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 1081 //compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1078 1082
1079 s->activeTexture(GL_TEXTURE1); 1083 //s->activeTexture(GL_TEXTURE1);
1080 } 1084 //}
1081 else 1085 //else
1082 { 1086 //{
1083 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); 1087 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
1084 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); 1088 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
1085 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT); 1089 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT);
1086 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); 1090 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
1087 compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); 1091 //compiz_glapi->glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
1088 1092
1089 constant[3] = attrib->opacity / 65535.0f; 1093 //constant[3] = attrib->opacity / 65535.0f;
1090 constant[0] = constant[1] = constant[2] = constant[3] * 1094 //constant[0] = constant[1] = constant[2] = constant[3] *
1091 attrib->brightness / 65535.0f; 1095 //attrib->brightness / 65535.0f;
1092 1096
1093 constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0]; 1097 //constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
1094 constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT * constant[1]; 1098 //constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT * constant[1];
1095 constant[2] = 0.5f + 0.5f * BLUE_SATURATION_WEIGHT * constant[2]; 1099 //constant[2] = 0.5f + 0.5f * BLUE_SATURATION_WEIGHT * constant[2];
1096 1100
1097 compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); 1101 //compiz_glapi->glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
1098 1102
1099 (*w->drawWindowGeometry)(w); 1103 //(*w->drawWindowGeometry)(w);
1100 } 1104 //}
1101 1105
1102 disableTexture(s, texture); 1106 //disableTexture(s, texture);
1103 1107
1104 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 1108 //compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1105 1109
1106 s->activeTexture(GL_TEXTURE0); 1110 //s->activeTexture(GL_TEXTURE0);
1107 1111
1108 disableTexture(s, texture); 1112 //disableTexture(s, texture);
1109 1113
1110 compiz_glapi->glColor4f(defaultColor[0], defaultColor[1], defaultColor[2], defaultColor[3]); 1114 //compiz_glapi->glColor4f(defaultColor[0], defaultColor[1], defaultColor[2], defaultColor[3]);
1111 screenTexEnvMode(s, GL_REPLACE); 1115 //screenTexEnvMode(s, GL_REPLACE);
1112 1116
1113 if (mask & PAINT_WINDOW_BLEND_MASK) 1117 //if (mask & PAINT_WINDOW_BLEND_MASK)
1114 compiz_glapi->glDisable(GL_BLEND); 1118 //compiz_glapi->glDisable(GL_BLEND);
1115 } 1119 //}
1116 else 1120 //else
1117 { 1121 {
1122 compiz_glapi->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1118 enableTexture(s, texture, filter); 1123 enableTexture(s, texture, filter);
1119 1124
1120 if (mask & PAINT_WINDOW_BLEND_MASK) 1125 if (mask & PAINT_WINDOW_BLEND_MASK)
@@ -1145,7 +1150,7 @@ enableFragmentOperationsAndDrawGeometry(CompWindow *w,
1145 { 1150 {
1146 screenTexEnvMode(s, GL_MODULATE); 1151 screenTexEnvMode(s, GL_MODULATE);
1147 compiz_glapi->glColor4f(attrib->brightness, attrib->brightness, 1152 compiz_glapi->glColor4f(attrib->brightness, attrib->brightness,
1148 attrib->brightness, BRIGHT); 1153 attrib->brightness, BRIGHT);
1149 1154
1150 (*w->drawWindowGeometry)(w); 1155 (*w->drawWindowGeometry)(w);
1151 1156
@@ -1156,7 +1161,6 @@ enableFragmentOperationsAndDrawGeometry(CompWindow *w,
1156 { 1161 {
1157 (*w->drawWindowGeometry)(w); 1162 (*w->drawWindowGeometry)(w);
1158 } 1163 }
1159
1160 disableTexture(w->screen, texture); 1164 disableTexture(w->screen, texture);
1161 } 1165 }
1162} 1166}
@@ -1261,10 +1265,12 @@ paintWindow(CompWindow *w,
1261 if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK) 1265 if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
1262 return TRUE; 1266 return TRUE;
1263 1267
1268 compiz_texture_init(w->texture);
1269 compiz_texture_activate(w->texture, 1);
1264 initFragmentAttrib(&fragment, attrib); 1270 initFragmentAttrib(&fragment, attrib);
1265 1271
1266 if (mask & PAINT_WINDOW_TRANSFORMED_MASK || 1272 //if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
1267 mask & PAINT_WINDOW_WITH_OFFSET_MASK) 1273 //mask & PAINT_WINDOW_WITH_OFFSET_MASK)
1268 { 1274 {
1269 compiz_glapi->glPushMatrix(); 1275 compiz_glapi->glPushMatrix();
1270 compiz_glapi->glLoadMatrixf(transform->m); 1276 compiz_glapi->glLoadMatrixf(transform->m);
@@ -1272,9 +1278,10 @@ paintWindow(CompWindow *w,
1272 1278
1273 status = (*w->screen->drawWindow)(w, transform, &fragment, region, mask); 1279 status = (*w->screen->drawWindow)(w, transform, &fragment, region, mask);
1274 1280
1275 if (mask & PAINT_WINDOW_TRANSFORMED_MASK || 1281 //if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
1276 mask & PAINT_WINDOW_WITH_OFFSET_MASK) 1282 //mask & PAINT_WINDOW_WITH_OFFSET_MASK)
1277 compiz_glapi->glPopMatrix(); 1283 compiz_glapi->glPopMatrix();
1284 compiz_texture_activate(w->texture, 0);
1278 1285
1279 return status; 1286 return status;
1280} 1287}
diff --git a/src/exports/screen.c b/src/exports/screen.c
index 595af39..8bf3145 100644
--- a/src/exports/screen.c
+++ b/src/exports/screen.c
@@ -974,22 +974,22 @@ reshape(CompScreen *s,
974 //d->screenInfo = XineramaQueryScreens (d->display, &d->nScreenInfo); 974 //d->screenInfo = XineramaQueryScreens (d->display, &d->nScreenInfo);
975 //} 975 //}
976 976
977 compiz_glapi->glMatrixMode (GL_PROJECTION); 977 //compiz_glapi->glMatrixMode(GL_PROJECTION);
978 compiz_glapi->glLoadIdentity (); 978 //compiz_glapi->glLoadIdentity();
979 compiz_glapi->glMatrixMode (GL_MODELVIEW); 979 //compiz_glapi->glMatrixMode(GL_MODELVIEW);
980 compiz_glapi->glLoadIdentity (); 980 //compiz_glapi->glLoadIdentity();
981 //compiz_glapi->glDepthRange (0, 1); 981 //compiz_glapi->glDepthRange (0, 1);
982 compiz_glapi->glViewport (-1, -1, 2, 2); 982 //compiz_glapi->glViewport(-1, -1, 2, 2);
983 //compiz_glapi->glRasterPos2f (0, 0); 983 //compiz_glapi->glRasterPos2f (0, 0);
984 984
985 s->rasterX = s->rasterY = 0; 985 s->rasterX = s->rasterY = 0;
986 986
987 perspective (s->projection, 60.0f, 1.0f, 0.1f, 100.0f); 987 perspective(s->projection, 60.0f, 1.0f, 0.1f, 100.0f);
988 988
989 compiz_glapi->glMatrixMode (GL_PROJECTION); 989 //compiz_glapi->glMatrixMode(GL_PROJECTION);
990 compiz_glapi->glLoadIdentity (); 990 //compiz_glapi->glLoadIdentity();
991 compiz_glapi->glMultMatrixf (s->projection); 991 //compiz_glapi->glMultMatrixf(s->projection);
992 compiz_glapi->glMatrixMode (GL_MODELVIEW); 992 //compiz_glapi->glMatrixMode(GL_MODELVIEW);
993 993
994 s->region.rects = &s->region.extents; 994 s->region.rects = &s->region.extents;
995 s->region.numRects = 1; 995 s->region.numRects = 1;
@@ -1064,6 +1064,7 @@ void
1064updateScreenBackground(CompScreen *screen, 1064updateScreenBackground(CompScreen *screen,
1065 CompTexture *texture) 1065 CompTexture *texture)
1066{ 1066{
1067#if 0
1067 Display *dpy = screen->display->display; 1068 Display *dpy = screen->display->display;
1068 Atom pixmapAtom, actualType; 1069 Atom pixmapAtom, actualType;
1069 int actualFormat, i, status; 1070 int actualFormat, i, status;
@@ -1144,6 +1145,7 @@ updateScreenBackground(CompScreen *screen,
1144 compiz_glapi->glTexParameteri(texture->target, GL_TEXTURE_WRAP_T, GL_REPEAT); 1145 compiz_glapi->glTexParameteri(texture->target, GL_TEXTURE_WRAP_T, GL_REPEAT);
1145 compiz_glapi->glBindTexture(texture->target, 0); 1146 compiz_glapi->glBindTexture(texture->target, 0);
1146 } 1147 }
1148#endif
1147} 1149}
1148 1150
1149void 1151void
@@ -2080,7 +2082,7 @@ addScreen(CompDisplay *display,
2080 if (strstr(glExtensions, "texture_npot")) 2082 if (strstr(glExtensions, "texture_npot"))
2081 s->textureNonPowerOfTwo = 1; 2083 s->textureNonPowerOfTwo = 1;
2082 2084
2083 compiz_glapi->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s->maxTextureSize); 2085 //compiz_glapi->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s->maxTextureSize);
2084 2086
2085 s->textureRectangle = 0; 2087 s->textureRectangle = 0;
2086 if (strstr(glExtensions, "GL_NV_texture_rectangle") || 2088 if (strstr(glExtensions, "GL_NV_texture_rectangle") ||
@@ -2369,14 +2371,14 @@ addScreen(CompDisplay *display,
2369 2371
2370 s->desktopWindowCount = 0; 2372 s->desktopWindowCount = 0;
2371 2373
2372 //glClearColor (0.0, 0.0, 0.0, 1.0); 2374 //compiz_glapi->glClearColor (0.0, 0.0, 0.0, 1.0);
2373 //glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); 2375 //compiz_glapi->glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
2374 //glEnable (GL_CULL_FACE); 2376 //compiz_glapi->glEnable (GL_CULL_FACE);
2375 //glDisable (GL_BLEND); 2377 //compiz_glapi->glDisable (GL_BLEND);
2376 //glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 2378 //compiz_glapi->glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
2377 //glColor4usv (defaultColor); 2379 //compiz_glapi->glColor4usv (defaultColor);
2378 //glEnableClientState (GL_VERTEX_ARRAY); 2380 //compiz_glapi->glEnableClientState (GL_VERTEX_ARRAY);
2379 //glEnableClientState (GL_TEXTURE_COORD_ARRAY); 2381 //compiz_glapi->glEnableClientState (GL_TEXTURE_COORD_ARRAY);
2380 2382
2381 s->canDoSaturated = s->canDoSlightlySaturated = FALSE; 2383 s->canDoSaturated = s->canDoSlightlySaturated = FALSE;
2382 if (s->textureEnvCombine && s->maxTextureUnits >= 2) 2384 if (s->textureEnvCombine && s->maxTextureUnits >= 2)
@@ -2395,16 +2397,16 @@ addScreen(CompDisplay *display,
2395 detectOutputDevices(s); 2397 detectOutputDevices(s);
2396 updateOutputDevices(s); 2398 updateOutputDevices(s);
2397 2399
2398 compiz_glapi->glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient); 2400 //compiz_glapi->glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient);
2399 2401
2400 compiz_glapi->glEnable(GL_LIGHT0); 2402 //compiz_glapi->glEnable(GL_LIGHT0);
2401 compiz_glapi->glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); 2403 //compiz_glapi->glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
2402 compiz_glapi->glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); 2404 //compiz_glapi->glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
2403 compiz_glapi->glLightfv(GL_LIGHT0, GL_POSITION, light0Position); 2405 //compiz_glapi->glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
2404 2406
2405 //compiz_glapi->glColorMaterial (GL_FRONT, GL_AMBIENT_AND_DIFFUSE); 2407 //compiz_glapi->glColorMaterial (GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
2406 2408
2407 compiz_glapi->glNormal3f(0.0f, 0.0f, -1.0f); 2409 //compiz_glapi->glNormal3f(0.0f, 0.0f, -1.0f);
2408 2410
2409 s->lighting = FALSE; 2411 s->lighting = FALSE;
2410 s->slowAnimations = FALSE; 2412 s->slowAnimations = FALSE;
@@ -2829,35 +2831,35 @@ pushScreenGrab(CompScreen *s,
2829 const char *name) 2831 const char *name)
2830{ 2832{
2831 //if (s->maxGrab == 0) 2833 //if (s->maxGrab == 0)
2832 //{ 2834 //{
2833 //int status; 2835 //int status;
2834 2836
2835 //status = XGrabPointer(s->display->display, s->grabWindow, TRUE, 2837 //status = XGrabPointer(s->display->display, s->grabWindow, TRUE,
2836 //POINTER_GRAB_MASK, 2838 //POINTER_GRAB_MASK,
2837 //GrabModeAsync, GrabModeAsync, 2839 //GrabModeAsync, GrabModeAsync,
2838 //s->root, cursor, 2840 //s->root, cursor,
2839 //CurrentTime); 2841 //CurrentTime);
2840 2842
2841 //if (status == GrabSuccess) 2843 //if (status == GrabSuccess)
2842 //{ 2844 //{
2843 //status = XGrabKeyboard(s->display->display, 2845 //status = XGrabKeyboard(s->display->display,
2844 //s->grabWindow, TRUE, 2846 //s->grabWindow, TRUE,
2845 //GrabModeAsync, GrabModeAsync, 2847 //GrabModeAsync, GrabModeAsync,
2846 //CurrentTime); 2848 //CurrentTime);
2847 //if (status != GrabSuccess) 2849 //if (status != GrabSuccess)
2848 //{ 2850 //{
2849 //XUngrabPointer(s->display->display, CurrentTime); 2851 //XUngrabPointer(s->display->display, CurrentTime);
2850 //return 0; 2852 //return 0;
2851 //} 2853 //}
2852 //} 2854 //}
2853 //else
2854 //return 0;
2855 //}
2856 //else 2855 //else
2857 //{ 2856 //return 0;
2858 //XChangeActivePointerGrab(s->display->display, POINTER_GRAB_MASK, 2857 //}
2859 //cursor, CurrentTime); 2858 //else
2860 //} 2859 //{
2860 //XChangeActivePointerGrab(s->display->display, POINTER_GRAB_MASK,
2861 //cursor, CurrentTime);
2862 //}
2861 2863
2862 if (s->grabSize <= s->maxGrab) 2864 if (s->grabSize <= s->maxGrab)
2863 { 2865 {
@@ -2890,7 +2892,7 @@ updateScreenGrab(CompScreen *s,
2890#endif 2892#endif
2891 2893
2892 //XChangeActivePointerGrab(s->display->display, POINTER_GRAB_MASK, 2894 //XChangeActivePointerGrab(s->display->display, POINTER_GRAB_MASK,
2893 //cursor, CurrentTime); 2895 //cursor, CurrentTime);
2894 2896
2895 s->grabs[index].cursor = cursor; 2897 s->grabs[index].cursor = cursor;
2896} 2898}
@@ -2921,9 +2923,9 @@ removeScreenGrab(CompScreen *s,
2921 if (maxGrab) 2923 if (maxGrab)
2922 { 2924 {
2923 //XChangeActivePointerGrab(s->display->display, 2925 //XChangeActivePointerGrab(s->display->display,
2924 //POINTER_GRAB_MASK, 2926 //POINTER_GRAB_MASK,
2925 //s->grabs[maxGrab - 1].cursor, 2927 //s->grabs[maxGrab - 1].cursor,
2926 //CurrentTime); 2928 //CurrentTime);
2927 } 2929 }
2928 else 2930 else
2929 { 2931 {
@@ -3926,16 +3928,19 @@ void
3926screenTexEnvMode(CompScreen *s, 3928screenTexEnvMode(CompScreen *s,
3927 GLenum mode) 3929 GLenum mode)
3928{ 3930{
3931#if 0
3929 if (s->lighting) 3932 if (s->lighting)
3930 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 3933 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
3931 else 3934 else
3932 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode); 3935 compiz_glapi->glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode);
3936#endif
3933} 3937}
3934 3938
3935void 3939void
3936screenLighting(CompScreen *s, 3940screenLighting(CompScreen *s,
3937 Bool lighting) 3941 Bool lighting)
3938{ 3942{
3943#if 0
3939 if (s->lighting != lighting) 3944 if (s->lighting != lighting)
3940 { 3945 {
3941 if (!s->opt[COMP_SCREEN_OPTION_LIGHTING].value.b) 3946 if (!s->opt[COMP_SCREEN_OPTION_LIGHTING].value.b)
@@ -3956,6 +3961,7 @@ screenLighting(CompScreen *s,
3956 3961
3957 screenTexEnvMode(s, GL_REPLACE); 3962 screenTexEnvMode(s, GL_REPLACE);
3958 } 3963 }
3964#endif
3959} 3965}
3960 3966
3961void 3967void
@@ -4009,7 +4015,7 @@ finishScreenDrawing(CompScreen *s)
4009 if (s->pendingCommands) 4015 if (s->pendingCommands)
4010 { 4016 {
4011 makeScreenCurrent(s); 4017 makeScreenCurrent(s);
4012 compiz_glapi->glFinish (); 4018 //compiz_glapi->glFinish();
4013 4019
4014 s->pendingCommands = FALSE; 4020 s->pendingCommands = FALSE;
4015 } 4021 }
@@ -4122,10 +4128,10 @@ setDefaultViewport(CompScreen *s)
4122 s->lastViewport.width = s->outputDev->width; 4128 s->lastViewport.width = s->outputDev->width;
4123 s->lastViewport.height = s->outputDev->height; 4129 s->lastViewport.height = s->outputDev->height;
4124 4130
4125 compiz_glapi->glViewport(s->lastViewport.x, 4131 //compiz_glapi->glViewport(s->lastViewport.x,
4126 s->lastViewport.y, 4132 //s->lastViewport.y,
4127 s->lastViewport.width, 4133 //s->lastViewport.width,
4128 s->lastViewport.height); 4134 //s->lastViewport.height);
4129} 4135}
4130 4136
4131void 4137void
@@ -4153,9 +4159,9 @@ clearScreenOutput(CompScreen *s,
4153 4159
4154 compiz_glapi->glEnable(GL_SCISSOR_TEST); 4160 compiz_glapi->glEnable(GL_SCISSOR_TEST);
4155 compiz_glapi->glScissor(pBox->x1, 4161 compiz_glapi->glScissor(pBox->x1,
4156 s->height - pBox->y2, 4162 s->height - pBox->y2,
4157 pBox->x2 - pBox->x1, 4163 pBox->x2 - pBox->x1,
4158 pBox->y2 - pBox->y1); 4164 pBox->y2 - pBox->y1);
4159 compiz_glapi->glClear(mask); 4165 compiz_glapi->glClear(mask);
4160 4166
4161 if (!sct) 4167 if (!sct)
diff --git a/src/exports/texture.c b/src/exports/texture.c
index fd980c6..f3cc9d9 100644
--- a/src/exports/texture.c
+++ b/src/exports/texture.c
@@ -146,7 +146,7 @@ imageToTexture(CompScreen *screen,
146 GL_COMPRESSED_RGBA_ARB : GL_RGBA); 146 GL_COMPRESSED_RGBA_ARB : GL_RGBA);
147 147
148 compiz_glapi->glTexImage2D(texture->target, 0, internalFormat, width, height, 0, 148 compiz_glapi->glTexImage2D(texture->target, 0, internalFormat, width, height, 0,
149 format, type, data); 149 format, type, data);
150 150
151 texture->filter = GL_NEAREST; 151 texture->filter = GL_NEAREST;
152 152
@@ -371,7 +371,7 @@ bindPixmapToTexture(CompScreen *screen,
371 371
372 texture->wrap = GL_CLAMP_TO_EDGE; 372 texture->wrap = GL_CLAMP_TO_EDGE;
373 373
374 compiz_texture_init(texture); 374 compiz_texture_bind(texture);
375 375
376 compiz_glapi->glBindTexture(texture->target, 0); 376 compiz_glapi->glBindTexture(texture->target, 0);
377 377
@@ -411,6 +411,7 @@ enableTexture(CompScreen *screen,
411{ 411{
412 makeScreenCurrent(screen); 412 makeScreenCurrent(screen);
413 compiz_glapi->glEnable(texture->target); 413 compiz_glapi->glEnable(texture->target);
414 compiz_glapi->glActiveTexture(GL_TEXTURE0);
414 compiz_glapi->glBindTexture(texture->target, texture->name); 415 compiz_glapi->glBindTexture(texture->target, texture->name);
415 416
416 if (strictBinding && texture->pixmap) 417 if (strictBinding && texture->pixmap)
@@ -426,11 +427,11 @@ enableTexture(CompScreen *screen,
426 if (texture->filter != GL_NEAREST) 427 if (texture->filter != GL_NEAREST)
427 { 428 {
428 compiz_glapi->glTexParameteri(texture->target, 429 compiz_glapi->glTexParameteri(texture->target,
429 GL_TEXTURE_MIN_FILTER, 430 GL_TEXTURE_MIN_FILTER,
430 GL_NEAREST); 431 GL_NEAREST);
431 compiz_glapi->glTexParameteri(texture->target, 432 compiz_glapi->glTexParameteri(texture->target,
432 GL_TEXTURE_MAG_FILTER, 433 GL_TEXTURE_MAG_FILTER,
433 GL_NEAREST); 434 GL_NEAREST);
434 435
435 texture->filter = GL_NEAREST; 436 texture->filter = GL_NEAREST;
436 } 437 }
@@ -442,24 +443,24 @@ enableTexture(CompScreen *screen,
442 if (screen->textureNonPowerOfTwo && screen->fbo && texture->mipmap) 443 if (screen->textureNonPowerOfTwo && screen->fbo && texture->mipmap)
443 { 444 {
444 compiz_glapi->glTexParameteri(texture->target, 445 compiz_glapi->glTexParameteri(texture->target,
445 GL_TEXTURE_MIN_FILTER, 446 GL_TEXTURE_MIN_FILTER,
446 GL_LINEAR_MIPMAP_LINEAR); 447 GL_LINEAR_MIPMAP_LINEAR);
447 448
448 if (texture->filter != GL_LINEAR) 449 if (texture->filter != GL_LINEAR)
449 compiz_glapi->glTexParameteri(texture->target, 450 compiz_glapi->glTexParameteri(texture->target,
450 GL_TEXTURE_MAG_FILTER, 451 GL_TEXTURE_MAG_FILTER,
451 GL_LINEAR); 452 GL_LINEAR);
452 453
453 texture->filter = GL_LINEAR_MIPMAP_LINEAR; 454 texture->filter = GL_LINEAR_MIPMAP_LINEAR;
454 } 455 }
455 else if (texture->filter != GL_LINEAR) 456 else if (texture->filter != GL_LINEAR)
456 { 457 {
457 compiz_glapi->glTexParameteri(texture->target, 458 compiz_glapi->glTexParameteri(texture->target,
458 GL_TEXTURE_MIN_FILTER, 459 GL_TEXTURE_MIN_FILTER,
459 GL_LINEAR); 460 GL_LINEAR);
460 compiz_glapi->glTexParameteri(texture->target, 461 compiz_glapi->glTexParameteri(texture->target,
461 GL_TEXTURE_MAG_FILTER, 462 GL_TEXTURE_MAG_FILTER,
462 GL_LINEAR); 463 GL_LINEAR);
463 464
464 texture->filter = GL_LINEAR; 465 texture->filter = GL_LINEAR;
465 } 466 }
@@ -467,11 +468,11 @@ enableTexture(CompScreen *screen,
467 else 468 else
468 { 469 {
469 compiz_glapi->glTexParameteri(texture->target, 470 compiz_glapi->glTexParameteri(texture->target,
470 GL_TEXTURE_MIN_FILTER, 471 GL_TEXTURE_MIN_FILTER,
471 screen->display->textureFilter); 472 screen->display->textureFilter);
472 compiz_glapi->glTexParameteri(texture->target, 473 compiz_glapi->glTexParameteri(texture->target,
473 GL_TEXTURE_MAG_FILTER, 474 GL_TEXTURE_MAG_FILTER,
474 screen->display->textureFilter); 475 screen->display->textureFilter);
475 476
476 texture->filter = screen->display->textureFilter; 477 texture->filter = screen->display->textureFilter;
477 } 478 }
diff --git a/src/exports/window.c b/src/exports/window.c
index 92bae75..393e958 100644
--- a/src/exports/window.c
+++ b/src/exports/window.c
@@ -1394,6 +1394,7 @@ releaseWindow(CompWindow *w)
1394 destroyTexture(w->screen, w->texture); 1394 destroyTexture(w->screen, w->texture);
1395 1395
1396 w->texture = texture; 1396 w->texture = texture;
1397 compiz_texture_to_win(texture, w);
1397 } 1398 }
1398 1399
1399 XFreePixmap(w->screen->display->display, w->pixmap); 1400 XFreePixmap(w->screen->display->display, w->pixmap);
@@ -1973,6 +1974,7 @@ addWindow(CompScreen *screen,
1973 free(w); 1974 free(w);
1974 return; 1975 return;
1975 } 1976 }
1977 compiz_texture_to_win(w->texture, w);
1976 1978
1977 w->screen = screen; 1979 w->screen = screen;
1978 w->pixmap = None; 1980 w->pixmap = None;
@@ -2198,8 +2200,8 @@ addWindow(CompScreen *screen,
2198 if (w->type & CompWindowTypeDesktopMask) 2200 if (w->type & CompWindowTypeDesktopMask)
2199 w->paint.opacity = OPAQUE; 2201 w->paint.opacity = OPAQUE;
2200 else 2202 else
2201 w->paint.opacity = getWindowProp32 (d, w->id, 2203 w->paint.opacity = getWindowProp32(d, w->id,
2202 d->winOpacityAtom, OPAQUE); 2204 d->winOpacityAtom, OPAQUE);
2203 2205
2204 w->paint.brightness = getWindowProp32(d, w->id, 2206 w->paint.brightness = getWindowProp32(d, w->id,
2205 d->winBrightnessAtom, BRIGHT); 2207 d->winBrightnessAtom, BRIGHT);