macos: use GDK_WINDOWING_MACOS instead of GDK_WINDOWING_QUARTZ
Various bits in gtk/ need to be updated to connect to the macOS GDK backend. This gets some of that changed over. Additional modules still need updating but require more in-depth changes.
This commit is contained in:
@@ -707,7 +707,7 @@ static gboolean
|
||||
append_keyval_symbol (guint accelerator_key,
|
||||
GString *gstring)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
switch (accelerator_key)
|
||||
{
|
||||
case GDK_KEY_Return:
|
||||
@@ -778,7 +778,7 @@ append_keyval_symbol (guint accelerator_key,
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
#else /* !GDK_WINDOWING_QUARTZ */
|
||||
#else /* !GDK_WINDOWING_MACOS */
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
@@ -786,7 +786,7 @@ append_keyval_symbol (guint accelerator_key,
|
||||
static void
|
||||
append_separator (GString *string)
|
||||
{
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
g_string_append (string, "+");
|
||||
#else
|
||||
/* no separator on quartz */
|
||||
@@ -826,7 +826,7 @@ gtk_accelerator_print_label (GString *gstring,
|
||||
|
||||
if (accelerator_mods & GDK_SHIFT_MASK)
|
||||
{
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the shift key. If the text on this key isn't typically
|
||||
* translated on keyboards used for your language, don't translate
|
||||
@@ -845,7 +845,7 @@ gtk_accelerator_print_label (GString *gstring,
|
||||
if (seen_mod)
|
||||
append_separator (gstring);
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the control key. If the text on this key isn't typically
|
||||
* translated on keyboards used for your language, don't translate
|
||||
@@ -864,7 +864,7 @@ gtk_accelerator_print_label (GString *gstring,
|
||||
if (seen_mod)
|
||||
append_separator (gstring);
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the alt key. If the text on this key isn't typically
|
||||
* translated on keyboards used for your language, don't translate
|
||||
@@ -911,7 +911,7 @@ gtk_accelerator_print_label (GString *gstring,
|
||||
if (seen_mod)
|
||||
append_separator (gstring);
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the meta key. If the text on this key isn't typically
|
||||
* translated on keyboards used for your language, don't translate
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#include <gdk/macos/gdkmacos.h>
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (GtkApplicationImpl, gtk_application_impl, G_TYPE_OBJECT)
|
||||
@@ -172,8 +172,8 @@ gtk_application_impl_new (GtkApplication *application,
|
||||
impl_type = gtk_application_impl_wayland_get_type ();
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
if (GDK_IS_QUARTZ_DISPLAY (display))
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
if (GDK_IS_MACOS_DISPLAY (display))
|
||||
impl_type = gtk_application_impl_quartz_get_type ();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
enum {
|
||||
MODE_FALLBACK,
|
||||
MODE_WIN32,
|
||||
MODE_QUARTZ,
|
||||
MODE_MACOS,
|
||||
MODE_PORTAL,
|
||||
};
|
||||
|
||||
@@ -672,7 +672,7 @@ gtk_file_chooser_native_get_files (GtkFileChooser *chooser)
|
||||
{
|
||||
case MODE_PORTAL:
|
||||
case MODE_WIN32:
|
||||
case MODE_QUARTZ:
|
||||
case MODE_MACOS:
|
||||
{
|
||||
GListStore *store;
|
||||
GSList *l;
|
||||
@@ -709,9 +709,9 @@ gtk_file_chooser_native_show (GtkNativeDialog *native)
|
||||
self->mode = MODE_WIN32;
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
if (gtk_file_chooser_native_quartz_show (self))
|
||||
self->mode = MODE_QUARTZ;
|
||||
self->mode = MODE_MACOS;
|
||||
#endif
|
||||
|
||||
if (self->mode == MODE_FALLBACK &&
|
||||
@@ -737,8 +737,8 @@ gtk_file_chooser_native_hide (GtkNativeDialog *native)
|
||||
gtk_file_chooser_native_win32_hide (self);
|
||||
#endif
|
||||
break;
|
||||
case MODE_QUARTZ:
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
case MODE_MACOS:
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
gtk_file_chooser_native_quartz_hide (self);
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "gtkfilechoosernativeprivate.h"
|
||||
#include "gtknativedialogprivate.h"
|
||||
|
||||
@@ -28,6 +30,7 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
@@ -38,7 +41,9 @@
|
||||
#include "gtklabel.h"
|
||||
#include "gtkfilefilterprivate.h"
|
||||
|
||||
#include "quartz/gdkquartz.h"
|
||||
#include <gdk/macos/gdkmacos.h>
|
||||
|
||||
#include "gdk/macos/gdkmacossurface-private.h"
|
||||
|
||||
typedef struct {
|
||||
GtkFileChooserNative *self;
|
||||
@@ -346,7 +351,7 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
|
||||
|
||||
void (^handler)(NSInteger ret) = ^(NSInteger result) {
|
||||
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
if (result == NSModalResponseOK)
|
||||
{
|
||||
// get selected files and update data->files
|
||||
data->response = GTK_RESPONSE_ACCEPT;
|
||||
@@ -467,7 +472,7 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
|
||||
data->filter_names = [NSMutableArray arrayWithCapacity:n_filters];
|
||||
[data->filter_names retain];
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
for (i = 0; i < n_filters; i++)
|
||||
{
|
||||
GtkFileFilter *filter = g_list_model_get_item (filters, i);
|
||||
if (!file_filter_to_quartz (filter, data->filters, data->filter_names))
|
||||
@@ -516,7 +521,7 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
|
||||
if (transient_for)
|
||||
{
|
||||
gtk_widget_realize (GTK_WIDGET (transient_for));
|
||||
data->parent = gdk_quartz_surface_get_nswindow (gtk_native_get_surface (GTK_NATIVE (transient_for)));
|
||||
data->parent = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (gtk_native_get_surface (GTK_NATIVE (transient_for))));
|
||||
|
||||
if (gtk_native_dialog_get_modal (GTK_NATIVE_DIALOG (self)))
|
||||
data->modal = TRUE;
|
||||
|
||||
@@ -625,7 +625,7 @@ gtk_file_filter_get_attributes (GtkFileFilter *filter)
|
||||
return (const char **)filter->attributes;
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <gtk/gtkfilefilter.h>
|
||||
#include <gdk/gdkconfig.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
|
||||
|
||||
char ** _gtk_file_filter_get_as_patterns (GtkFileFilter *filter);
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
#include "gtkimcontextime.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include "quartz/gdkquartz.h"
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#include "macos/gdkmacos.h"
|
||||
#include "gtkimcontextquartz.h"
|
||||
#endif
|
||||
|
||||
@@ -131,9 +131,9 @@ match_backend (GdkDisplay *display,
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (g_strcmp0 (context_id, "quartz") == 0)
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
return GDK_IS_QUARTZ_DISPLAY (display);
|
||||
if (g_strcmp0 (context_id, "macos") == 0)
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
return GDK_IS_MACOS_DISPLAY (display);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
@@ -270,7 +270,7 @@ gtk_im_modules_init (void)
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
g_type_ensure (gtk_im_context_ime_get_type ());
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
g_type_ensure (gtk_im_context_quartz_get_type ());
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "gtkresources.h"
|
||||
|
||||
|
||||
#if !defined G_OS_WIN32 && !(defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
|
||||
#if !defined G_OS_WIN32 && !(defined GDK_WINDOWING_MACOS && defined QUARTZ_RELOCATION)
|
||||
|
||||
const gchar *
|
||||
_gtk_get_datadir (void)
|
||||
|
||||
@@ -2182,7 +2182,7 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
gboolean handled;
|
||||
GtkOrientation move_orientation;
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
scroll_unit = 1;
|
||||
#else
|
||||
scroll_unit = gtk_adjustment_get_page_increment (priv->adjustment);
|
||||
|
||||
@@ -1202,7 +1202,7 @@ get_scroll_unit (GtkScrolledWindow *sw,
|
||||
{
|
||||
gdouble scroll_unit;
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (sw);
|
||||
GtkScrollbar *scrollbar;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "gtksearchenginequartz.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include <gdk/gdk.h> /* for GDK_WINDOWING_QUARTZ */
|
||||
#include <gdk/gdk.h> /* for GDK_WINDOWING_MACOS */
|
||||
|
||||
#if defined(HAVE_TRACKER3)
|
||||
#include "gtksearchenginetracker3.h"
|
||||
@@ -342,7 +342,7 @@ _gtk_search_engine_new (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
engine->priv->native = _gtk_search_engine_quartz_new ();
|
||||
if (engine->priv->native)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <quartz/gdkquartz.h>
|
||||
|
||||
#include "gtksearchenginequartz.h"
|
||||
|
||||
@@ -262,7 +261,7 @@ _gtk_search_engine_quartz_init (GtkSearchEngineQuartz *engine)
|
||||
GtkSearchEngine *
|
||||
_gtk_search_engine_quartz_new (void)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
return g_object_new (GTK_TYPE_SEARCH_ENGINE_QUARTZ, NULL);
|
||||
#else
|
||||
return NULL;
|
||||
|
||||
@@ -49,15 +49,15 @@
|
||||
#include "broadway/gdkbroadway.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include "quartz/gdkquartz.h"
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#include "macos/gdkmacos.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
#include "win32/gdkwin32.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#define PRINT_PREVIEW_COMMAND "open -b com.apple.Preview %f"
|
||||
#else
|
||||
#define PRINT_PREVIEW_COMMAND "evince --unlink-tempfile --preview --print-settings %s %f"
|
||||
@@ -1095,8 +1095,8 @@ gtk_settings_create_for_display (GdkDisplay *display)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
if (GDK_IS_QUARTZ_DISPLAY (display))
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
if (GDK_IS_MACOS_DISPLAY (display))
|
||||
settings = g_object_new (GTK_TYPE_SETTINGS,
|
||||
"gtk-key-theme-name", "Mac",
|
||||
"gtk-shell-shows-app-menu", TRUE,
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "win32/gdkwin32.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include "quartz/gdkquartz.h"
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#include "macos/gdkmacos.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
@@ -134,9 +134,9 @@ init_version (GtkInspectorGeneral *gen)
|
||||
backend = "Windows";
|
||||
else
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
if (GDK_IS_QUARTZ_DISPLAY (gen->display))
|
||||
backend = "Quartz";
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
if (GDK_IS_MACOS_DISPLAY (gen->display))
|
||||
backend = "macOS";
|
||||
else
|
||||
#endif
|
||||
backend = "Unknown";
|
||||
|
||||
@@ -486,7 +486,7 @@ static gchar*
|
||||
get_data_path (const gchar *subdir)
|
||||
{
|
||||
gchar *base_datadir, *full_datadir;
|
||||
#if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
|
||||
#if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_MACOS)
|
||||
base_datadir = g_strdup (_gtk_get_datadir ());
|
||||
#else
|
||||
base_datadir = g_strdup (GTK_DATADIR);
|
||||
|
||||
@@ -799,7 +799,7 @@ if win32_enabled
|
||||
gtk_sources += ['gtkmountoperation-stub.c']
|
||||
endif
|
||||
|
||||
if quartz_enabled
|
||||
if macos_enabled
|
||||
gtk_sources += files([
|
||||
'gtksearchenginequartz.c',
|
||||
'gtkmountoperation-stub.c',
|
||||
@@ -813,7 +813,7 @@ if quartz_enabled
|
||||
gtk_cargs += ['-xobjective-c'] # FIXME? maybe add_languages() instead?
|
||||
endif
|
||||
|
||||
if not (x11_enabled or win32_enabled or quartz_enabled)
|
||||
if not (x11_enabled or win32_enabled or macos_enabled)
|
||||
gtk_sources += ['gtkmountoperation-stub.c', ]
|
||||
endif
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include <gdk/broadway/gdkbroadway.h>
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
#if HAVE_OBJC
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
#include <gdk/macos/gdkmacos.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user