gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout

This avoids some string copies at startup.
This commit is contained in:
Matthias Clasen 2017-11-17 21:38:08 -05:00
parent dd7163a699
commit a129053ed9
9 changed files with 43 additions and 34 deletions

View File

@ -183,35 +183,40 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
P_("Fallback"),
P_("Cursor image to fall back to if this cursor cannot be displayed"),
GDK_TYPE_CURSOR,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_HOTSPOT_X,
g_param_spec_int ("hotspot-x",
P_("Hotspot X"),
P_("Horizontal offset of the cursor hotspot"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_HOTSPOT_Y,
g_param_spec_int ("hotspot-y",
P_("Hotspot Y"),
P_("Vertical offset of the cursor hotspot"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
P_("Name"),
P_("Name of this cursor"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_TEXTURE,
g_param_spec_object ("texture",
P_("Texture"),
P_("The texture displayed by this cursor"),
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
static void

View File

@ -123,8 +123,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
P_("Device Display"),
P_("Display which the device belongs to"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:device-manager:
@ -138,8 +137,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
P_("Device manager"),
P_("Device manager which the device belongs to"),
GDK_TYPE_DEVICE_MANAGER,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:name:
*

View File

@ -106,14 +106,16 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
"Serial number",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
"Tool type",
"Tool type",
GDK_TYPE_DEVICE_TOOL_TYPE,
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
"Axes",
"Tool axes",
@ -125,7 +127,8 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
"Hardware ID",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
}

View File

@ -214,7 +214,7 @@ gdk_display_class_init (GdkDisplayClass *class)
P_("Composited"),
P_("Composited"),
TRUE,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:rgba:
@ -229,7 +229,7 @@ gdk_display_class_init (GdkDisplayClass *class)
P_("RGBA"),
P_("RGBA"),
TRUE,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, props);

View File

@ -168,8 +168,7 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
P_("Default Display"),
P_("The default display for GDK"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|
G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
}
static void

View File

@ -178,76 +178,76 @@ gdk_monitor_class_init (GdkMonitorClass *class)
"Display",
"The display of the monitor",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
props[PROP_MANUFACTURER] =
g_param_spec_string ("manufacturer",
"Manufacturer",
"The manufacturer name",
NULL,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_MODEL] =
g_param_spec_string ("model",
"Model",
"The model name",
NULL,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
"Scale factor",
"The scale factor",
0, G_MAXINT,
1,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_GEOMETRY] =
g_param_spec_boxed ("geometry",
"Geometry",
"The geometry of the monitor",
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_WORKAREA] =
g_param_spec_boxed ("workarea",
"Workarea",
"The workarea of the monitor",
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_WIDTH_MM] =
g_param_spec_int ("width-mm",
"Physical width",
"The width of the monitor, in millimeters",
0, G_MAXINT,
0,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_HEIGHT_MM] =
g_param_spec_int ("height-mm",
"Physical height",
"The height of the monitor, in millimeters",
0, G_MAXINT,
0,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_REFRESH_RATE] =
g_param_spec_int ("refresh-rate",
"Refresh rate",
"The refresh rate, in millihertz",
0, G_MAXINT,
0,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_SUBPIXEL_LAYOUT] =
g_param_spec_enum ("subpixel-layout",
"Subpixel layout",
"The subpixel layout",
GDK_TYPE_SUBPIXEL_LAYOUT,
GDK_SUBPIXEL_LAYOUT_UNKNOWN,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_VALID] =
g_param_spec_boolean ("valid",
"Valid",
"Whether the monitor is still valid",
TRUE,
G_PARAM_READABLE);
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, props);
signals[INVALIDATE] = g_signal_new ("invalidate",
signals[INVALIDATE] = g_signal_new (g_intern_static_string ("invalidate"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
0,

View File

@ -258,7 +258,7 @@ gdk_window_class_init (GdkWindowClass *klass)
P_("Cursor"),
P_("Cursor"),
GDK_TYPE_CURSOR,
G_PARAM_READWRITE);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* GdkWindow:display:
@ -273,7 +273,7 @@ gdk_window_class_init (GdkWindowClass *klass)
P_("Display"),
P_("Display"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);

View File

@ -141,7 +141,8 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
P_("Device ID"),
P_("Device identifier"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
static void

View File

@ -115,21 +115,24 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
P_("Opcode"),
P_("Opcode for XInput2 requests"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MAJOR,
g_param_spec_int ("major",
P_("Major"),
P_("Major version number"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MINOR,
g_param_spec_int ("minor",
P_("Minor"),
P_("Minor version number"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
static void