Commit b492db25 authored by Emmanuele Bassi's avatar Emmanuele Bassi

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.
parent e5ed52b6
......@@ -10354,9 +10354,9 @@ gtk_text_view_get_css_node (GtkTextView *text_view,
* @window: a window type
*
* Usually used to find out which window an event corresponds to.
*
* If you connect to an event signal on @text_view, this function
* should be called on `event->window` to
* see which window it was.
* should be called on `event->window` to see which window it was.
*
* Returns: the window type.
**/
......@@ -10366,8 +10366,8 @@ gtk_text_view_get_window_type (GtkTextView *text_view,
{
GtkTextWindow *win;
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 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), GTK_TEXT_WINDOW_PRIVATE);
if (window == gtk_widget_get_window (GTK_WIDGET (text_view)))
return GTK_TEXT_WINDOW_WIDGET;
......@@ -10377,10 +10377,8 @@ gtk_text_view_get_window_type (GtkTextView *text_view,
if (win)
return win->type;
else
{
return GTK_TEXT_WINDOW_PRIVATE;
}
return GTK_TEXT_WINDOW_PRIVATE;
}
static void
......@@ -10448,7 +10446,7 @@ buffer_to_text_window (GtkTextView *text_view,
/**
* gtk_text_view_buffer_to_window_coords:
* @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_y: buffer y coordinate
* @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;
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
g_return_if_fail (win != GTK_TEXT_WINDOW_PRIVATE);
switch (win)
{
......@@ -10592,7 +10591,7 @@ text_window_to_buffer (GtkTextView *text_view,
/**
* gtk_text_view_window_to_buffer_coords:
* @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_y: window y coordinate
* @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;
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
g_return_if_fail (win != GTK_TEXT_WINDOW_PRIVATE);
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.
* 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
* function can only be used for the “border windows,” it doesn’t work
* with #GTK_TEXT_WINDOW_WIDGET, #GTK_TEXT_WINDOW_TEXT, or
* #GTK_TEXT_WINDOW_PRIVATE.
* function can only be used for the “border windows”, and it won’t
* work with %GTK_TEXT_WINDOW_WIDGET, %GTK_TEXT_WINDOW_TEXT, or
* %GTK_TEXT_WINDOW_PRIVATE.
**/
void
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;
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);
switch (type)
......
......@@ -45,6 +45,7 @@ G_BEGIN_DECLS
/**
* GtkTextWindowType:
* @GTK_TEXT_WINDOW_PRIVATE: Invalid value, used as a marker
* @GTK_TEXT_WINDOW_WIDGET: Window that floats over scrolling areas.
* @GTK_TEXT_WINDOW_TEXT: Scrollable text window.
* @GTK_TEXT_WINDOW_LEFT: Left side border window.
......@@ -56,9 +57,7 @@ G_BEGIN_DECLS
*/
typedef enum
{
/*< private >*/
GTK_TEXT_WINDOW_PRIVATE,
/*< public >*/
GTK_TEXT_WINDOW_WIDGET,
GTK_TEXT_WINDOW_TEXT,
GTK_TEXT_WINDOW_LEFT,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment