diff options
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-autorun.c | 20 | ||||
-rw-r--r-- | libcaja-private/caja-file-operations.c | 6 | ||||
-rw-r--r-- | libcaja-private/caja-icon-container.c | 41 | ||||
-rw-r--r-- | libcaja-private/caja-icon-dnd.c | 15 |
4 files changed, 51 insertions, 31 deletions
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c index 2f79b16b..b78ea1c7 100644 --- a/libcaja-private/caja-autorun.c +++ b/libcaja-private/caja-autorun.c @@ -761,16 +761,22 @@ is_shift_pressed (void) Bool status; ret = FALSE; - display = gdk_display_get_default (); - gdk_x11_display_error_trap_push (display); - status = XkbGetState (GDK_DISPLAY_XDISPLAY (display), - XkbUseCoreKbd, &state); - gdk_x11_display_error_trap_pop_ignored (display); + if (GDK_IS_X11_DISPLAY (display)) + { + gdk_x11_display_error_trap_push (display); + status = XkbGetState (GDK_DISPLAY_XDISPLAY (display), + XkbUseCoreKbd, &state); + gdk_x11_display_error_trap_pop_ignored (display); - if (status == Success) + if (status == Success) + { + ret = state.mods & ShiftMask; + } + } + else { - ret = state.mods & ShiftMask; + ret=FALSE; } return ret; diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 60193d47..8676800e 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -962,7 +962,11 @@ init_common (gsize job_size, GdkScreen *screen; screen = gtk_widget_get_screen (GTK_WIDGET (parent_window)); - common->screen_num = gdk_x11_screen_get_screen_number (screen); + /*common->screen_num = gdk_x11_screen_get_screen_number (screen);* + *https://discourse.ubuntu.com/t/porting-mate-apps-to-wayland/12670 + *Screen number is always 0 with >GTK 3.22 so we can just use zero here + */ + common->screen_num = 0; } return common; diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index bb912d4b..7b19516d 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -324,7 +324,9 @@ icon_set_position_full (CajaIcon *icon, int item_width, item_height; int height_above, width_left; int min_x, max_x, min_y, max_y; - int scale; + GdkWindow *window; + GdkMonitor *monitor; + GdkRectangle workarea = {0}; /* FIXME: This should be: @@ -338,14 +340,17 @@ icon_set_position_full (CajaIcon *icon, really bad. For now, we have a cheesy workaround: + note that this version does not require scaling */ - scale = gtk_widget_get_scale_factor (GTK_WIDGET (container)); + window = gtk_widget_get_window (GTK_WIDGET(container)); + monitor = gdk_display_get_monitor_at_window (gdk_display_get_default(), window); + gdk_monitor_get_workarea(monitor, &workarea); container_x = 0; container_y = 0; - container_width = WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_x + container_width = workarea.width - container_x - container->details->left_margin - container->details->right_margin; - container_height = HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) / scale - container_y + container_height = workarea.height - container_y - container->details->top_margin - container->details->bottom_margin; pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit; @@ -5253,17 +5258,19 @@ caja_icon_container_search_position_func (CajaIconContainer *container, gint x, y; gint cont_x, cont_y; gint cont_width, cont_height; - gint scale; GdkWindow *cont_window; GdkScreen *screen; GtkRequisition requisition; GdkMonitor *monitor_num; GdkRectangle monitor; + GdkRectangle workarea = {0}; cont_window = gtk_widget_get_window (GTK_WIDGET (container)); - scale = gtk_widget_get_scale_factor (GTK_WIDGET (container)); screen = gdk_window_get_screen (cont_window); + monitor_num = gdk_display_get_monitor_at_window (gdk_display_get_default(), cont_window); + gdk_monitor_get_workarea(monitor_num, &workarea); + monitor_num = gdk_display_get_monitor_at_window (gdk_screen_get_display (screen), cont_window); gdk_monitor_get_geometry (monitor_num, &monitor); @@ -5277,9 +5284,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container, gtk_widget_get_preferred_size (search_dialog, &requisition, NULL); - if (cont_x + cont_width - requisition.width > WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale) + if (cont_x + cont_width - requisition.width > workarea.width) { - x = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale - requisition.width; + x = workarea.width - requisition.width; } else if (cont_x + cont_width - requisition.width < 0) { @@ -5290,9 +5297,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container, x = cont_x + cont_width - requisition.width; } - if (cont_y + cont_height > HeightOfScreen (gdk_x11_screen_get_xscreen (screen))) + if (cont_y + cont_height > workarea.height) { - y = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.height; + y = workarea.height - requisition.height; } else if (cont_y + cont_height < 0) /* isn't really possible ... */ { @@ -6034,13 +6041,13 @@ key_press_event (GtkWidget *widget, { GdkEvent *new_event; GdkWindow *window; + GdkDisplay *display; + GdkRectangle workarea = {0}; char *old_text; const char *new_text; gboolean retval; - GdkScreen *screen; gboolean text_modified; gulong popup_menu_id; - gint scale; caja_icon_container_ensure_interactive_directory (container); @@ -6055,12 +6062,12 @@ key_press_event (GtkWidget *widget, "popup_menu", G_CALLBACK (gtk_true), NULL); /* Move the entry off screen */ - screen = gtk_widget_get_screen (GTK_WIDGET (container)); - scale = gtk_widget_get_scale_factor (GTK_WIDGET (container)); - gtk_window_move (GTK_WINDOW (container->details->search_window), - WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale + 1, - HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale + 1); gtk_widget_show (container->details->search_window); + display = gdk_display_get_default (); + gdk_monitor_get_workarea(gdk_display_get_monitor_at_window (display, window), &workarea); + gtk_window_move (GTK_WINDOW (container->details->search_window), + workarea.width + 1, + workarea.height + 1); /* Send the event to the window. If the preedit_changed signal is emitted * during this event, we will set priv->imcontext_changed */ diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c index b9dfc36f..913e085f 100644 --- a/libcaja-private/caja-icon-dnd.c +++ b/libcaja-private/caja-icon-dnd.c @@ -946,7 +946,6 @@ handle_local_move (CajaIconContainer *container, GList *moved_icons, *p; CajaFile *file; char screen_string[32]; - GdkScreen *screen; time_t now; CajaDragSelectionItem *item = NULL; CajaIcon *icon = NULL; @@ -971,13 +970,15 @@ handle_local_move (CajaIconContainer *container, { /* probably dragged from another screen. Add it to * this screen + * Update: since GTK 3.22 there is only ONE screen + * even with multiple monitors */ file = caja_file_get_by_uri (item->uri); - - screen = gtk_widget_get_screen (GTK_WIDGET (container)); + g_snprintf (screen_string, sizeof (screen_string), "%d", - gdk_x11_screen_get_screen_number (screen)); + /*gdk_x11_screen_get_screen_number (screen)); This is ALWAYS 0 since GTK 3.22*/ + 0); caja_file_set_metadata (file, CAJA_METADATA_KEY_SCREEN, NULL, screen_string); @@ -1906,8 +1907,10 @@ drag_data_received_callback (GtkWidget *widget, caja_file_changes_queue_schedule_position_set ( location, p, - gdk_x11_screen_get_screen_number ( - gtk_widget_get_screen (widget))); + 0); + /*gdk_x11_screen_get_screen_number + *Always returns 0 since GTK 3.22 + */ g_object_unref (location); caja_file_changes_consume_changes (TRUE); success = TRUE; |