~stolowski/unity/expand-2nd-home-category

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/unityshell.h

  • Committer: Tarmac
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2012-09-24 20:01:09 UTC
  • mfrom: (2713.1.26 scale-close-middle-click)
  • Revision ID: tarmac-20120924200109-lh0p4z04lhmirscl
UnityWindow: when spreading, render once an empty decoration texture at full size and scale it via OpenGL
  
This saves a lot of drawing and improves the performances of the unity Spread. Also, don't redraw the decoration texture for selected windows if not needed.
Finally, cleanup the header file. Fixes: https://bugs.launchpad.net/bugs/1055643. Approved by Brandon Schaefer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
359
359
 
360
360
  nux::Geometry last_bound;
361
361
 
362
 
  void minimize ();
363
 
  void unminimize ();
364
 
  bool minimized ();
365
 
  bool focus ();
366
 
  void activate ();
 
362
  void minimize();
 
363
  void unminimize();
 
364
  bool minimized();
 
365
  bool focus();
 
366
  void activate();
367
367
 
368
 
  void updateFrameRegion (CompRegion &region);
 
368
  void updateFrameRegion(CompRegion &region);
369
369
 
370
370
  /* occlusion detection
371
371
   * and window hiding */
372
 
  bool glPaint(const GLWindowPaintAttrib& attrib,
373
 
               const GLMatrix&            matrix,
374
 
               const CompRegion&          region,
375
 
               unsigned int              mask);
 
372
  bool glPaint(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask);
376
373
 
377
374
  /* basic window draw function */
378
 
  bool glDraw(const GLMatrix& matrix,
379
 
              const GLWindowPaintAttrib& attrib,
380
 
              const CompRegion& region,
381
 
              unsigned intmask);
382
 
 
383
 
  void updateIconPos (int   &wx,
384
 
                      int   &wy,
385
 
                      int   x,
386
 
                      int   y,
387
 
                      float width,
388
 
                      float height);
389
 
 
 
375
  bool glDraw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
 
376
 
 
377
  void updateIconPos (int &wx, int &wy, int x, int y, float width, float height);
390
378
  void windowNotify(CompWindowNotify n);
391
379
  void moveNotify(int x, int y, bool immediate);
392
380
  void resizeNotify(int x, int y, int w, int h);
396
384
  CompPoint tryNotIntersectUI(CompPoint& pos);
397
385
  nux::Geometry GetScaledGeometry();
398
386
 
399
 
  void paintThumbnail (nux::Geometry const& bounding, float alpha);
 
387
  void paintThumbnail(nux::Geometry const& bounding, float alpha);
400
388
 
401
 
  void enterShowDesktop ();
402
 
  void leaveShowDesktop ();
403
 
  bool HandleAnimations (unsigned int ms);
 
389
  void enterShowDesktop();
 
390
  void leaveShowDesktop();
 
391
  bool HandleAnimations(unsigned int ms);
404
392
 
405
393
  bool handleEvent(XEvent *event);
406
 
 
 
394
  void scalePaintDecoration(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask);
 
395
 
 
396
  //! Emited when CompWindowNotifyBeforeDestroy is received
 
397
  sigc::signal<void> being_destroyed;
 
398
 
 
399
 
 
400
protected:
 
401
  std::string GetName() const;
 
402
  void AddProperties(GVariantBuilder* builder);
 
403
 
 
404
private:
407
405
  typedef compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>
408
406
          UnityMinimizedHandler;
409
 
  std::unique_ptr <UnityMinimizedHandler> mMinimizeHandler;
410
 
  std::unique_ptr <ShowdesktopHandler> mShowdesktopHandler;
411
 
 
412
 
  //! Emited when CompWindowNotifyBeforeDestroy is received
413
 
  sigc::signal<void> being_destroyed;
414
 
 
415
 
  void scalePaintDecoration(const GLWindowPaintAttrib &,
416
 
                            const GLMatrix &,
417
 
                            const CompRegion &,
418
 
                            unsigned int);
419
 
 
420
 
protected:
421
 
  std::string GetName() const;
422
 
  void AddProperties(GVariantBuilder* builder);
423
 
 
424
 
private:
425
407
  struct CairoContext;
426
408
 
427
409
  void DoEnableFocus ();
443
425
  void DoShow ();
444
426
  void DoNotifyShown ();
445
427
 
446
 
  void OnInitiateSpreed();
447
 
  void OnTerminateSpreed();
 
428
  void OnInitiateSpread();
 
429
  void OnTerminateSpread();
448
430
 
449
431
  void DoAddDamage ();
450
432
  ShowdesktopHandlerWindowInterface::PostPaintAction DoHandleAnimations (unsigned int ms);
457
439
 
458
440
  compiz::WindowInputRemoverLock::Ptr GetInputRemover ();
459
441
 
460
 
  void DrawWindowDecoration(GLWindowPaintAttrib const& attrib, GLMatrix const& transform,
461
 
                            unsigned int mask, bool highlighted,
462
 
                            int x, int y, unsigned width, unsigned height);
463
 
  void DrawTexture(GLTexture::List const& textures, GLWindowPaintAttrib const& attrib,
464
 
                   GLMatrix const& transform, unsigned int mask, int x, int y);
465
 
  void RenderText(CairoContext const& context, int x, int y, int width, int height);
 
442
  void RenderDecoration(CairoContext const&, double aspect = 1.0f);
 
443
  void RenderText(CairoContext const&, int x, int y, int width, int height);
 
444
  void DrawTexture(GLTexture::List const& textures, GLWindowPaintAttrib const&,
 
445
                   GLMatrix const&, unsigned mask, int x, int y, double scale = 1.0f);
466
446
 
 
447
  void BuildDecorationTexture();
 
448
  void CleanupCachedTextures();
467
449
  static void SetupSharedTextures();
468
450
  static void CleanupSharedTextures();
469
451
  static void LoadCloseIcon(panel::WindowState state, GLTexture::List& texture);
470
452
 
 
453
public:
 
454
  std::unique_ptr <UnityMinimizedHandler> mMinimizeHandler;
 
455
 
 
456
private:
 
457
  std::unique_ptr <ShowdesktopHandler> mShowdesktopHandler;
471
458
  static GLTexture::List close_normal_tex_;
472
459
  static GLTexture::List close_prelight_tex_;
473
460
  static GLTexture::List close_pressed_tex_;
 
461
  GLTexture::List decoration_tex_;
 
462
  GLTexture::List decoration_selected_tex_;
 
463
  std::string decoration_title_;
474
464
  compiz::WindowInputRemoverLock::Weak input_remover_;
475
465
  panel::WindowState close_icon_state_;
476
466
  nux::Geometry close_button_geo_;