Skip to content

Commit 35c02e7

Browse files
gxalphaRytoEX
authored andcommitted
docs: Clarify some aspects of OBS_PROPERTY_BUTTON
The important point here is that "data" from the callback isn't defined by libobs, but rather by the API consumer. Additionally, it's not entirely clear from the documentation whether the callback would still be called for button of type OBS_BUTTON_URL. There should be no negatives to always calling it and the OBS Studio frontend already behaves that way, so let's document that in libobs.
1 parent 2c65cb8 commit 35c02e7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/sphinx/reference-properties.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ Property Object Functions
270270

271271
:param name: Setting identifier string
272272
:param text: Localized name shown to user
273-
:param callback: Callback to be executed when the button is pressed
273+
:param callback: Callback to be executed when the button is pressed. Note that if the property
274+
is created with :c:func:`obs_properties_add_button` instead of
275+
:c:func:`obs_properties_add_button2`, the value of ``data`` is determined by
276+
the caller of :c:func:`obs_property_button_clicked`, and as such unspecified
277+
by libobs.
274278
:param priv: Pointer passed back as the `data` argument of the callback
275279
:return: The property
276280

@@ -642,6 +646,16 @@ Property Modification Functions
642646

643647
.. function:: bool obs_property_button_clicked(obs_property_t *p, void *obj)
644648

649+
Calls the ``callback`` of the button.
650+
651+
:param p: The property
652+
:param obj: Must be a pointer to an object of type ``obs_canvas_t``, ``obs_source_t``,
653+
``obs_output_t``, ``obs_encoder_t``, or ``obs_service_t``.
654+
If the property was created with :c:func:`obs_properties_add_button`, that
655+
object's context will be passed as the ``obj`` parameter.
656+
If the property was created with :c:func:`obs_properties_add_button2`, it
657+
will be ignored.
658+
645659
---------------------
646660

647661
.. function:: void obs_property_set_visible(obs_property_t *p, bool visible)
@@ -813,6 +827,8 @@ Property Modification Functions
813827

814828
.. function:: void obs_property_button_set_type(obs_property_t *p, enum obs_button_type type)
815829

830+
Sets the type of the button. The button's ``callback`` will be called regardless of type.
831+
816832
:param type: Can be one of the following values:
817833

818834
- **OBS_BUTTON_DEFAULT** - Standard button
@@ -822,3 +838,6 @@ Property Modification Functions
822838
---------------------
823839

824840
.. function:: void obs_property_button_set_url(obs_property_t *p, char *url)
841+
842+
:param p: The property
843+
:param url: The URL to be opened if the button is of type ``OBS_BUTTON_URL``

0 commit comments

Comments
 (0)