~alan-griffiths/miral/tidy-SurfaceObserver-part1

« back to all changes in this revision

Viewing changes to miral-shell/titlebar_provider.cpp

  • Committer: Alan Griffiths
  • Date: 2016-10-27 14:26:30 UTC
  • mfrom: (412.2.9 miral2)
  • Revision ID: alan@octopull.co.uk-20161027142630-8dns7a67zm1g8yic
[miral-shell] Fix glitches by repainting titlebar on resize

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
 
219
219
void TitlebarProvider::paint_titlebar_for(miral::WindowInfo const& info, int intensity)
220
220
{
 
221
    this->intensity = intensity;
 
222
 
221
223
    if (auto data = find_titlebar_data(info.window()))
222
224
    {
223
225
        auto const title = info.name();
254
256
    }
255
257
}
256
258
 
257
 
void TitlebarProvider::resize_titlebar_for(miral::Window const& window, Size const& size)
 
259
void TitlebarProvider::resize_titlebar_for(miral::WindowInfo const& window_info, Size const& size)
258
260
{
 
261
    auto const window = window_info.window();
 
262
 
259
263
    if (window.size().width == size.width)
260
264
        return;
261
265
 
262
266
    if (auto titlebar_window = find_titlebar_window(window))
263
267
    {
264
268
        titlebar_window.resize({size.width, title_bar_height});
 
269
 
 
270
        repaint_titlebar_for(window_info);
265
271
    }
266
272
}
267
273
 
314
320
        }
315
321
 
316
322
        tools.modify_window(titlebar, modifications);
 
323
        repaint_titlebar_for(window_info);
 
324
    }
 
325
}
 
326
 
 
327
void TitlebarProvider::repaint_titlebar_for(miral::WindowInfo const& window_info)
 
328
{
 
329
    if (auto data = find_titlebar_data(window_info.window()))
 
330
    {
 
331
        auto const title = window_info.name();
 
332
 
 
333
        if (auto surface = data->titlebar.load())
 
334
            enqueue_work([this, surface, title]{ paint_surface(surface, title, intensity); });
317
335
    }
318
336
}
319
337