mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-09 12:10:09 +00:00
textview: Make GTK_TEXT_WINDOW_PRIVATE public
The GTK_TEXT_WINDOW_PRIVATE enumeration value is really *not* private. Internally, it's used as a simple "invalid value" marker, and application and library developers are supposed to use it as such in their own code. Let's just document it, and since the GtkTextView documentation and internals go a long way to state the fact that it should not be used as an argument value, let's add some pre-condition checks as well. This commit fixes GtkSourceView's use of GTK_TEXT_WINDOW_PRIVATE as default value for a GObject property that was broken by the change in glib-mkenums to honor the `/*< public >*/` and `/*< private >*/` trigraphs.
This commit is contained in:
parent
e5ed52b6c9
commit
b492db25a1
@ -10354,9 +10354,9 @@ gtk_text_view_get_css_node (GtkTextView *text_view,
|
|||||||
* @window: a window type
|
* @window: a window type
|
||||||
*
|
*
|
||||||
* Usually used to find out which window an event corresponds to.
|
* Usually used to find out which window an event corresponds to.
|
||||||
|
*
|
||||||
* If you connect to an event signal on @text_view, this function
|
* If you connect to an event signal on @text_view, this function
|
||||||
* should be called on `event->window` to
|
* should be called on `event->window` to see which window it was.
|
||||||
* see which window it was.
|
|
||||||
*
|
*
|
||||||
* Returns: the window type.
|
* Returns: the window type.
|
||||||
**/
|
**/
|
||||||
@ -10366,8 +10366,8 @@ gtk_text_view_get_window_type (GtkTextView *text_view,
|
|||||||
{
|
{
|
||||||
GtkTextWindow *win;
|
GtkTextWindow *win;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), 0);
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), GTK_TEXT_WINDOW_PRIVATE);
|
||||||
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
|
g_return_val_if_fail (GDK_IS_WINDOW (window), GTK_TEXT_WINDOW_PRIVATE);
|
||||||
|
|
||||||
if (window == gtk_widget_get_window (GTK_WIDGET (text_view)))
|
if (window == gtk_widget_get_window (GTK_WIDGET (text_view)))
|
||||||
return GTK_TEXT_WINDOW_WIDGET;
|
return GTK_TEXT_WINDOW_WIDGET;
|
||||||
@ -10377,10 +10377,8 @@ gtk_text_view_get_window_type (GtkTextView *text_view,
|
|||||||
|
|
||||||
if (win)
|
if (win)
|
||||||
return win->type;
|
return win->type;
|
||||||
else
|
|
||||||
{
|
return GTK_TEXT_WINDOW_PRIVATE;
|
||||||
return GTK_TEXT_WINDOW_PRIVATE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -10448,7 +10446,7 @@ buffer_to_text_window (GtkTextView *text_view,
|
|||||||
/**
|
/**
|
||||||
* gtk_text_view_buffer_to_window_coords:
|
* gtk_text_view_buffer_to_window_coords:
|
||||||
* @text_view: a #GtkTextView
|
* @text_view: a #GtkTextView
|
||||||
* @win: a #GtkTextWindowType except #GTK_TEXT_WINDOW_PRIVATE
|
* @win: a #GtkTextWindowType, except %GTK_TEXT_WINDOW_PRIVATE
|
||||||
* @buffer_x: buffer x coordinate
|
* @buffer_x: buffer x coordinate
|
||||||
* @buffer_y: buffer y coordinate
|
* @buffer_y: buffer y coordinate
|
||||||
* @window_x: (out) (allow-none): window x coordinate return location or %NULL
|
* @window_x: (out) (allow-none): window x coordinate return location or %NULL
|
||||||
@ -10471,6 +10469,7 @@ gtk_text_view_buffer_to_window_coords (GtkTextView *text_view,
|
|||||||
GtkTextViewPrivate *priv = text_view->priv;
|
GtkTextViewPrivate *priv = text_view->priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
||||||
|
g_return_if_fail (win != GTK_TEXT_WINDOW_PRIVATE);
|
||||||
|
|
||||||
switch (win)
|
switch (win)
|
||||||
{
|
{
|
||||||
@ -10592,7 +10591,7 @@ text_window_to_buffer (GtkTextView *text_view,
|
|||||||
/**
|
/**
|
||||||
* gtk_text_view_window_to_buffer_coords:
|
* gtk_text_view_window_to_buffer_coords:
|
||||||
* @text_view: a #GtkTextView
|
* @text_view: a #GtkTextView
|
||||||
* @win: a #GtkTextWindowType except #GTK_TEXT_WINDOW_PRIVATE
|
* @win: a #GtkTextWindowType except %GTK_TEXT_WINDOW_PRIVATE
|
||||||
* @window_x: window x coordinate
|
* @window_x: window x coordinate
|
||||||
* @window_y: window y coordinate
|
* @window_y: window y coordinate
|
||||||
* @buffer_x: (out) (allow-none): buffer x coordinate return location or %NULL
|
* @buffer_x: (out) (allow-none): buffer x coordinate return location or %NULL
|
||||||
@ -10615,6 +10614,7 @@ gtk_text_view_window_to_buffer_coords (GtkTextView *text_view,
|
|||||||
GtkTextViewPrivate *priv = text_view->priv;
|
GtkTextViewPrivate *priv = text_view->priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
||||||
|
g_return_if_fail (win != GTK_TEXT_WINDOW_PRIVATE);
|
||||||
|
|
||||||
switch (win)
|
switch (win)
|
||||||
{
|
{
|
||||||
@ -10755,9 +10755,9 @@ set_window_height (GtkTextView *text_view,
|
|||||||
* or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
|
* or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
|
||||||
* Automatically destroys the corresponding window if the size is set
|
* Automatically destroys the corresponding window if the size is set
|
||||||
* to 0, and creates the window if the size is set to non-zero. This
|
* to 0, and creates the window if the size is set to non-zero. This
|
||||||
* function can only be used for the “border windows,” it doesn’t work
|
* function can only be used for the “border windows”, and it won’t
|
||||||
* with #GTK_TEXT_WINDOW_WIDGET, #GTK_TEXT_WINDOW_TEXT, or
|
* work with %GTK_TEXT_WINDOW_WIDGET, %GTK_TEXT_WINDOW_TEXT, or
|
||||||
* #GTK_TEXT_WINDOW_PRIVATE.
|
* %GTK_TEXT_WINDOW_PRIVATE.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_text_view_set_border_window_size (GtkTextView *text_view,
|
gtk_text_view_set_border_window_size (GtkTextView *text_view,
|
||||||
@ -10767,6 +10767,7 @@ gtk_text_view_set_border_window_size (GtkTextView *text_view,
|
|||||||
GtkTextViewPrivate *priv = text_view->priv;
|
GtkTextViewPrivate *priv = text_view->priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
||||||
|
g_return_if_fail (type != GTK_TEXT_WINDOW_PRIVATE);
|
||||||
g_return_if_fail (size >= 0);
|
g_return_if_fail (size >= 0);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -45,6 +45,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkTextWindowType:
|
* GtkTextWindowType:
|
||||||
|
* @GTK_TEXT_WINDOW_PRIVATE: Invalid value, used as a marker
|
||||||
* @GTK_TEXT_WINDOW_WIDGET: Window that floats over scrolling areas.
|
* @GTK_TEXT_WINDOW_WIDGET: Window that floats over scrolling areas.
|
||||||
* @GTK_TEXT_WINDOW_TEXT: Scrollable text window.
|
* @GTK_TEXT_WINDOW_TEXT: Scrollable text window.
|
||||||
* @GTK_TEXT_WINDOW_LEFT: Left side border window.
|
* @GTK_TEXT_WINDOW_LEFT: Left side border window.
|
||||||
@ -56,9 +57,7 @@ G_BEGIN_DECLS
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
/*< private >*/
|
|
||||||
GTK_TEXT_WINDOW_PRIVATE,
|
GTK_TEXT_WINDOW_PRIVATE,
|
||||||
/*< public >*/
|
|
||||||
GTK_TEXT_WINDOW_WIDGET,
|
GTK_TEXT_WINDOW_WIDGET,
|
||||||
GTK_TEXT_WINDOW_TEXT,
|
GTK_TEXT_WINDOW_TEXT,
|
||||||
GTK_TEXT_WINDOW_LEFT,
|
GTK_TEXT_WINDOW_LEFT,
|
||||||
|
Loading…
Reference in New Issue
Block a user