Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete gdk_window_process_all_updates() #698

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/boxes.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* 02110-1301, USA.
*/

#include <config.h>
#include "boxes.h"
#include "util.h"
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
Expand Down
2 changes: 1 addition & 1 deletion src/core/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -7120,7 +7120,7 @@ meta_window_show_menu (MetaWindow *window,

meta_verbose ("Popping up window menu for %s\n", window->desc);

meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp);
meta_ui_window_menu_popup (menu);
}

void
Expand Down
1 change: 1 addition & 0 deletions src/include/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <X11/Xlib.h>

#include <config.h>
#include "util.h"
#include "display.h"

Expand Down
6 changes: 1 addition & 5 deletions src/include/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
int n_workspaces,
MetaWindowMenuFunc func,
gpointer data);
void meta_ui_window_menu_popup (MetaWindowMenu *menu,
int root_x,
int root_y,
int button,
guint32 timestamp);
void meta_ui_window_menu_popup (MetaWindowMenu *menu);
void meta_ui_window_menu_free (MetaWindowMenu *menu);

GdkPixbuf* meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
Expand Down
6 changes: 0 additions & 6 deletions src/ui/frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,11 +1302,6 @@ meta_frames_repaint_frame (MetaFrames *frames,
frame = meta_frames_lookup_window (frames, xwindow);

g_assert (frame);

/* repaint everything, so the other frame don't
* lag behind if they are exposed
*/
gdk_window_process_all_updates ();
}

static void
Expand Down Expand Up @@ -2966,7 +2961,6 @@ meta_frames_push_delay_exposes (MetaFrames *frames)
if (frames->expose_delay_count == 0)
{
/* Make sure we've repainted things */
gdk_window_process_all_updates ();
XFlush (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
}

Expand Down
68 changes: 17 additions & 51 deletions src/ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,6 @@ static MenuItem menuitems[] = {
{META_MENU_OP_DELETE, MENU_ITEM_IMAGE, MARCO_STOCK_DELETE, FALSE, N_("_Close")}
};

static void popup_position_func(GtkMenu* menu, gint* x, gint* y, gboolean* push_in, gpointer user_data)
{
GtkRequisition req;
GdkPoint* pos;

pos = user_data;

gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);

*x = pos->x;
*y = pos->y;

if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
{
*x = MAX (0, *x - req.width);
}

/* Ensure onscreen */
*x = CLAMP (*x, 0, MAX(0, WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.width));
*y = CLAMP (*y, 0, MAX(0, HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.height));
}

static void menu_closed(GtkMenu* widget, gpointer data)
{
MetaWindowMenu *menu;
Expand Down Expand Up @@ -263,19 +241,10 @@ static GtkWidget* menu_item_new(MenuItem* menuitem, int workspace_id)
GtkWidget* mi;
GtkWidget* accel_label;

if (menuitem->type == MENU_ITEM_NORMAL)
if (menuitem->type == MENU_ITEM_NORMAL || menuitem->type == MENU_ITEM_IMAGE)
{
mi = gtk_menu_item_new ();
}
else if (menuitem->type == MENU_ITEM_IMAGE)
{
GtkWidget* image = gtk_image_new_from_icon_name(menuitem->stock_id, GTK_ICON_SIZE_MENU);

mi = gtk_image_menu_item_new();

gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), image);
gtk_widget_show(image);
}
else if (menuitem->type == MENU_ITEM_CHECKBOX)
{
mi = gtk_check_menu_item_new ();
Expand Down Expand Up @@ -304,8 +273,22 @@ static GtkWidget* menu_item_new(MenuItem* menuitem, int workspace_id)
accel_label = meta_accel_label_new_with_mnemonic (i18n_label);
gtk_widget_set_halign (accel_label, GTK_ALIGN_START);

gtk_container_add (GTK_CONTAINER (mi), accel_label);
gtk_widget_show (accel_label);
if (menuitem->type == MENU_ITEM_IMAGE)
{
GtkWidget* image = gtk_image_new_from_icon_name(menuitem->stock_id, GTK_ICON_SIZE_MENU);
GtkWidget* box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

gtk_container_add (GTK_CONTAINER (box), image);
gtk_label_set_xalign (GTK_LABEL (accel_label), 0.0);
gtk_box_pack_end (GTK_BOX (box), accel_label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (mi), box);
gtk_widget_show_all (mi);
}
else
{
gtk_container_add (GTK_CONTAINER (mi), accel_label);
gtk_widget_show (accel_label);
}

meta_accel_label_set_accelerator (META_ACCEL_LABEL (accel_label), key, mods);

Expand Down Expand Up @@ -489,23 +472,6 @@ meta_window_menu_new (MetaFrames *frames,
return menu;
}

void meta_window_menu_popup(MetaWindowMenu* menu, int root_x, int root_y, int button, guint32 timestamp)
{
GdkPoint* pt = g_new(GdkPoint, 1);
gint scale;

g_object_set_data_full(G_OBJECT(menu->menu), "destroy-point", pt, g_free);

scale = gtk_widget_get_scale_factor (menu->menu);
pt->x = root_x / scale;
pt->y = root_y / scale;

gtk_menu_popup(GTK_MENU (menu->menu), NULL, NULL, popup_position_func, pt, button, timestamp);

if (!gtk_widget_get_visible (menu->menu))
meta_warning("GtkMenu failed to grab the pointer\n");
}

void meta_window_menu_free(MetaWindowMenu* menu)
{
gtk_widget_destroy(menu->menu);
Expand Down
1 change: 0 additions & 1 deletion src/ui/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ struct _MetaWindowMenu {
};

MetaWindowMenu* meta_window_menu_new(MetaFrames* frames, MetaMenuOp ops, MetaMenuOp insensitive, Window client_xwindow, unsigned long active_workspace, int n_workspaces, MetaWindowMenuFunc func, gpointer data);
void meta_window_menu_popup(MetaWindowMenu* menu, int root_x, int root_y, int button, guint32 timestamp);
void meta_window_menu_free(MetaWindowMenu* menu);

#endif
9 changes: 3 additions & 6 deletions src/ui/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* 02110-1301, USA.
*/

#include <config.h>
#include "prefs.h"
#include "ui.h"
#include "frames.h"
Expand Down Expand Up @@ -515,13 +516,9 @@ meta_ui_window_menu_new (MetaUI *ui,
}

void
meta_ui_window_menu_popup (MetaWindowMenu *menu,
int root_x,
int root_y,
int button,
guint32 timestamp)
meta_ui_window_menu_popup (MetaWindowMenu *menu)
{
meta_window_menu_popup (menu, root_x, root_y, button, timestamp);
gtk_menu_popup_at_pointer (GTK_MENU (menu->menu), NULL);
}

void
Expand Down