~matttbe/ubuntu/quantal/lxpanel/lp1013171

« back to all changes in this revision

Viewing changes to src/plugins/menu.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2011-10-06 00:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20111006005602-jl06qq45fcxdfr20
Tags: 0.5.8-1ubuntu3
* debian/patches/fix_position.patch:
 - Fix position of the menu (LP: #818869).

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
    int ox, oy, w, h;
132
132
    Plugin *p;
133
133
#if GTK_CHECK_VERSION(2,18,0)
134
 
    GtkAllocation allocation;
135
 
    gtk_widget_set_allocation(widget, &allocation);
 
134
    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
 
135
    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
136
136
#endif
137
137
    ENTER;
138
138
    p = g_object_get_data(G_OBJECT(widget), "plugin");
155
155
        *x = ox;
156
156
        if (*x + w > gdk_screen_width())
157
157
#if GTK_CHECK_VERSION(2,18,0)
158
 
            *x = ox + allocation.width - w;
 
158
            *x = ox + allocation->width - w;
159
159
#else
160
160
            *x = ox + widget->allocation.width - w;
161
161
#endif
162
162
        *y = oy - h;
163
163
        if (*y < 0)
164
164
#if GTK_CHECK_VERSION(2,18,0)
165
 
            *y = oy + allocation.height;
 
165
            *y = oy + allocation->height;
166
166
#else
167
167
            *y = oy + widget->allocation.height;
168
168
#endif
169
169
    } else {
170
170
#if GTK_CHECK_VERSION(2,18,0)
171
 
        *x = ox + allocation.width;
 
171
        *x = ox + allocation->width;
172
172
#else
173
173
        *x = ox + widget->allocation.width;
174
174
#endif
177
177
        *y = oy;
178
178
        if (*y + h >  gdk_screen_height())
179
179
#if GTK_CHECK_VERSION(2,18,0)
180
 
            *y = oy + allocation.height - h;
 
180
            *y = oy + allocation->height - h;
181
181
#else
182
182
            *y = oy + widget->allocation.height - h;
183
183
#endif
184
184
    }
185
185
    DBG("widget: x,y=%d,%d  w,h=%d,%d\n", ox, oy,
186
186
#if GTK_CHECK_VERSION(2,18,0)
187
 
          allocation.width, allocation.height );
 
187
          allocation->width, allocation->height );
188
188
#else
189
189
          widget->allocation.width, widget->allocation.height );
190
190
#endif
191
191
    DBG("w-h %d %d\n", w, h);
192
192
    *push_in = TRUE;
 
193
#if GTK_CHECK_VERSION(2,18,0)
 
194
    g_free (allocation);
 
195
#endif
193
196
    RET();
194
197
}
195
198
 
634
637
{
635
638
    ENTER;
636
639
#if GTK_CHECK_VERSION(2,18,0)
637
 
    GtkAllocation allocation;
638
 
    gtk_widget_get_allocation(widget, &allocation);
 
640
    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
 
641
    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
639
642
#endif
640
643
 
641
644
    /* Standard right-click handling. */
644
647
 
645
648
    if ((event->type == GDK_BUTTON_PRESS)
646
649
#if GTK_CHECK_VERSION(2,18,0)
647
 
          && (event->x >=0 && event->x < allocation.width)
648
 
          && (event->y >=0 && event->y < allocation.height)) {
 
650
          && (event->x >=0 && event->x < allocation->width)
 
651
          && (event->y >=0 && event->y < allocation->height)) {
649
652
#else
650
653
          && (event->x >=0 && event->x < widget->allocation.width)
651
654
          && (event->y >=0 && event->y < widget->allocation.height)) {
652
655
#endif
653
656
        show_menu( widget, plugin, event->button, event->time );
654
657
    }
 
658
#if GTK_CHECK_VERSION(2,18,0)
 
659
    g_free (allocation);
 
660
#endif
655
661
    RET(TRUE);
656
662
}
657
663