replace some deprecated functions

This commit is contained in:
paul 2021-08-11 09:43:42 +01:00
parent b8e35947d4
commit 5e237aee3c
9 changed files with 78 additions and 28 deletions

View file

@ -866,6 +866,11 @@ static CompletionWindow *addrcompl_create_window( void ) {
* \param cw Window to destroy.
*/
static void addrcompl_destroy_window( CompletionWindow *cw ) {
GdkDisplay *display;
GdkSeat *seat;
display = gdk_display_get_default();
seat = gdk_display_get_default_seat(display);
/* Stop all searches currently in progress */
#ifndef USE_ALT_ADDRBOOK
addrindex_stop_search( _queryID_ );
@ -893,7 +898,7 @@ static void addrcompl_destroy_window( CompletionWindow *cw ) {
}
/* Re-enable keyboard, required at least for Gtk3/Win32 */
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
gdk_seat_ungrab(seat);
}
/**

View file

@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
* Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -201,13 +201,20 @@ void alertpanel_error_log(const gchar *format, ...)
static void alertpanel_show(void)
{
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *device;
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
manage_window_set_transient(GTK_WINDOW(window));
gtk_widget_show_all(window);
value = G_ALERTWAIT;
display = gdk_display_get_default();
seat = gdk_display_get_default_seat(display);
device = gdk_seat_get_pointer(seat);
if (gdk_pointer_is_grabbed())
gdk_pointer_ungrab(GDK_CURRENT_TIME);
if (gdk_display_device_is_grabbed(display, device))
gdk_seat_ungrab(seat);
inc_lock();
while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT)
gtk_main_iteration();

View file

@ -7754,6 +7754,7 @@ static Compose *compose_create(PrefsAccount *account,
#endif
static GdkGeometry geometry;
GdkRectangle workarea = {0};
cm_return_val_if_fail(account != NULL, NULL);
@ -7776,9 +7777,12 @@ static Compose *compose_create(PrefsAccount *account,
gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.compose_width,
prefs_common.compose_height);
gdk_monitor_get_workarea(gdk_display_get_primary_monitor(gdk_display_get_default()),
&workarea);
if (!geometry.max_width) {
geometry.max_width = gdk_screen_width();
geometry.max_height = gdk_screen_height();
geometry.max_width = workarea.width;
geometry.max_height = workarea.height;
}
gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL,

View file

@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2019 the Claws Mail team and Hiroyuki Yamamoto
* Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -2248,6 +2248,9 @@ void folderview_close_opened(FolderView *folderview, gboolean dirty)
static void folderview_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
gint column, FolderView *folderview)
{
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *device;
static gboolean can_select = TRUE; /* exclusive lock */
gboolean opened;
FolderItem *item;
@ -2256,6 +2259,10 @@ static void folderview_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
GtkCMCTreeNode *old_opened = folderview->opened;
START_TIMING("");
folderview->selected = row;
display = gdk_display_get_default();
seat = gdk_display_get_default_seat(display);
device = gdk_seat_get_pointer(seat);
debug_print("newly selected %p, opened %p\n", folderview->selected,
folderview->opened);
@ -2311,8 +2318,8 @@ static void folderview_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
/* ungrab the mouse event */
if (gtk_widget_has_grab(GTK_WIDGET(ctree))) {
gtk_grab_remove(GTK_WIDGET(ctree));
if (gdk_pointer_is_grabbed())
gdk_pointer_ungrab(GDK_CURRENT_TIME);
if (gdk_display_device_is_grabbed(display, device))
gdk_seat_ungrab(seat);
}
/* Open Folder */

View file

@ -593,14 +593,18 @@ void gtkut_window_popup(GtkWidget *window)
{
GdkWindow *gdkwin;
gint x, y, sx, sy, new_x, new_y;
GdkRectangle workarea = {0};
gdkwin = gtk_widget_get_window(window);
cm_return_if_fail(window != NULL);
cm_return_if_fail(gdkwin != NULL);
sx = gdk_screen_width();
sy = gdk_screen_height();
gdk_monitor_get_workarea(gdk_display_get_primary_monitor(gdk_display_get_default()),
&workarea);
sx = workarea.width;
sy = workarea.height;
gdk_window_get_origin(gdkwin, &x, &y);
new_x = x % sx; if (new_x < 0) new_x = 0;
@ -617,14 +621,18 @@ void gtkut_widget_get_uposition(GtkWidget *widget, gint *px, gint *py)
GdkWindow *gdkwin;
gint x, y;
gint sx, sy;
GdkRectangle workarea = {0};
gdkwin = gtk_widget_get_window(widget);
cm_return_if_fail(widget != NULL);
cm_return_if_fail(gdkwin != NULL);
sx = gdk_screen_width();
sy = gdk_screen_height();
gdk_monitor_get_workarea(gdk_display_get_primary_monitor(gdk_display_get_default()),
&workarea);
sx = workarea.width;
sy = workarea.height;
/* gdk_window_get_root_origin ever return *rootwindow*'s position */
gdk_window_get_root_origin(gdkwin, &x, &y);
@ -926,7 +934,6 @@ GtkWidget *gtkut_get_replace_btn(const gchar *button_label)
GtkWidget *gtkut_stock_button(const gchar *stock_image, const gchar *label)
{
GtkWidget *button;
gint i;
cm_return_val_if_fail(stock_image != NULL, NULL);
@ -934,7 +941,6 @@ GtkWidget *gtkut_stock_button(const gchar *stock_image, const gchar *label)
if (label != NULL)
gtk_button_set_label(GTK_BUTTON(button), _(label));
gtk_button_set_use_underline(GTK_BUTTON(button), TRUE);
gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
gtk_button_set_always_show_image(GTK_BUTTON(button), TRUE);
return button;

View file

@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2019 the Claws Mail Team and Hiroyuki Yamamoto
* Copyright (C) 1999-2021 the Claws Mail Team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -400,10 +400,11 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
PrefsCloseCallbackFunc close_cb)
{
PrefsWindow *prefswindow;
gint x = gdk_screen_width();
gint y = gdk_screen_height();
gint x;
gint y;
static GdkGeometry geometry;
GtkAdjustment *adj;
GdkRectangle workarea = {0};
prefswindow = g_new0(PrefsWindow, 1);
@ -541,7 +542,12 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
}
MANAGE_WINDOW_SIGNALS_CONNECT(prefswindow->window);
gdk_monitor_get_workarea(gdk_display_get_primary_monitor(gdk_display_get_default()),
&workarea);
x = workarea.width;
y = workarea.height;
if (!geometry.min_height) {
if (x < 800 && y < 600) {

View file

@ -2205,6 +2205,9 @@ void main_window_update_actions_menu(MainWindow *mainwin)
void main_window_cursor_wait(MainWindow *mainwin)
{
GdkDisplay *display;
display = gdk_display_get_default();
if (mainwin->cursor_count == 0) {
gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), watch_cursor);
@ -2213,11 +2216,15 @@ void main_window_cursor_wait(MainWindow *mainwin)
mainwin->cursor_count++;
gdk_flush();
gdk_display_flush(display);
}
void main_window_cursor_normal(MainWindow *mainwin)
{
GdkDisplay *display;
display = gdk_display_get_default();
if (mainwin->cursor_count)
mainwin->cursor_count--;
@ -2225,7 +2232,7 @@ void main_window_cursor_normal(MainWindow *mainwin)
gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), NULL);
textview_cursor_normal(mainwin->messageview->mimeview->textview);
}
gdk_flush();
gdk_display_flush(display);
}
/* lock / unlock the user-interface */

View file

@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 2003-2021 the Claws Mail team and Hiroyuki Yamamoto
* Copyright (C) 2003-2021 the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -660,10 +660,14 @@ static void prefs_themes_menu_item_activated_cb(GtkWidget *widget, gpointer data
#define MM_INCH 0.0393700787402
static gdouble prefs_themes_compute_ppi(GdkScreen *screen)
{
gdouble wp = gdk_screen_get_width(screen);
gdouble hp = gdk_screen_get_height(screen);
gdouble wi = gdk_screen_get_width_mm(screen);
gdouble hi = gdk_screen_get_height_mm(screen);
GdkRectangle workarea = {0};
GdkMonitor *monitor = gdk_display_get_primary_monitor(gdk_display_get_default());
gdk_monitor_get_workarea(monitor, &workarea);
gdouble wp = workarea.width;
gdouble hp = workarea.height;
gdouble wi = gdk_monitor_get_width_mm(monitor);
gdouble hi = gdk_monitor_get_height_mm(monitor);
gdouble dp, di;
debug_print("screen is %f x %f pixels, %f x %f mm\n", wp, hp, wi, hi);

View file

@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
* Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -3239,16 +3239,20 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
GHashTable *msgid_table;
GHashTable *subject_table = NULL;
GSList * cur;
GdkDisplay *display;
gboolean vert_layout = (prefs_common.layout_mode == VERTICAL_LAYOUT);
gboolean small_layout = (prefs_common.layout_mode == SMALL_LAYOUT);
START_TIMING("");
if (!mlist) return;
display = gdk_display_get_default();
debug_print("Setting summary from message data...\n");
STATUSBAR_PUSH(summaryview->mainwin,
_("Setting summary from message data..."));
gdk_flush();
gdk_display_flush(display);
g_signal_handlers_block_by_func(G_OBJECT(ctree),
G_CALLBACK(summary_tree_expanded), summaryview);