~timo-jyrinki/compiz/metacity-key-migrations

« back to all changes in this revision

Viewing changes to gtk/window-decorator/events.c

Fixed various problems described in bug 1030473.
Optimized performance and style following suggestions reported by cppcheck:

1. Reduced the scope of various variables.

2. Used prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.. Fixes: https://bugs.launchpad.net/bugs/1030473. Approved by Daniel van Vugt, Sam Spilsbury.

Show diffs side-by-side

added added

removed removed

Lines of Context:
440
440
             decor_event      *gtkwd_event,
441
441
             decor_event_type gtkwd_type)
442
442
{
443
 
    static int    last_button_num = 0;
444
443
    static Window last_button_xwindow = None;
445
444
    static Time   last_button_time = 0;
446
 
    static int    last_button_x = 0;
447
 
    static int    last_button_y = 0;
448
445
 
449
446
    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
450
447
 
460
457
 
461
458
    if (gtkwd_event->button == 1)
462
459
    {
 
460
        static int last_button_num = 0;
 
461
        static int last_button_x = 0;
 
462
        static int last_button_y = 0;
463
463
        if (gtkwd_event->button == last_button_num                      &&
464
464
            gtkwd_event->window == last_button_xwindow                  &&
465
465
            gtkwd_event->time < last_button_time + double_click_timeout &&