@@ -61,7 +61,7 @@ nk_draw_symbol(struct nk_command_buffer *out, enum nk_symbol_type type,
6161}
6262NK_LIB int
6363nk_button_behavior (nk_flags * state , struct nk_rect r ,
64- const struct nk_input * i , enum nk_button_behavior behavior )
64+ struct nk_input * i , enum nk_button_behavior behavior )
6565{
6666 int ret = 0 ;
6767 nk_widget_state_reset (state );
@@ -78,6 +78,8 @@ nk_button_behavior(nk_flags *state, struct nk_rect r,
7878#else
7979 nk_input_is_mouse_pressed (i , NK_BUTTON_LEFT );
8080#endif
81+ if (ret )
82+ i -> mouse .clicked = 1 ;
8183 }
8284 }
8385 if (* state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect (i , r ))
@@ -108,7 +110,7 @@ nk_draw_button(struct nk_command_buffer *out,
108110}
109111NK_LIB int
110112nk_do_button (nk_flags * state , struct nk_command_buffer * out , struct nk_rect r ,
111- const struct nk_style_button * style , const struct nk_input * in ,
113+ const struct nk_style_button * style , struct nk_input * in ,
112114 enum nk_button_behavior behavior , struct nk_rect * content )
113115{
114116 struct nk_rect bounds ;
@@ -158,7 +160,7 @@ NK_LIB int
158160nk_do_button_text (nk_flags * state ,
159161 struct nk_command_buffer * out , struct nk_rect bounds ,
160162 const char * string , int len , nk_flags align , enum nk_button_behavior behavior ,
161- const struct nk_style_button * style , const struct nk_input * in ,
163+ const struct nk_style_button * style , struct nk_input * in ,
162164 const struct nk_user_font * font )
163165{
164166 struct nk_rect content ;
@@ -204,7 +206,7 @@ NK_LIB int
204206nk_do_button_symbol (nk_flags * state ,
205207 struct nk_command_buffer * out , struct nk_rect bounds ,
206208 enum nk_symbol_type symbol , enum nk_button_behavior behavior ,
207- const struct nk_style_button * style , const struct nk_input * in ,
209+ const struct nk_style_button * style , struct nk_input * in ,
208210 const struct nk_user_font * font )
209211{
210212 int ret ;
@@ -235,7 +237,7 @@ NK_LIB int
235237nk_do_button_image (nk_flags * state ,
236238 struct nk_command_buffer * out , struct nk_rect bounds ,
237239 struct nk_image img , enum nk_button_behavior b ,
238- const struct nk_style_button * style , const struct nk_input * in )
240+ const struct nk_style_button * style , struct nk_input * in )
239241{
240242 int ret ;
241243 struct nk_rect content ;
@@ -295,7 +297,7 @@ nk_do_button_text_symbol(nk_flags *state,
295297 struct nk_command_buffer * out , struct nk_rect bounds ,
296298 enum nk_symbol_type symbol , const char * str , int len , nk_flags align ,
297299 enum nk_button_behavior behavior , const struct nk_style_button * style ,
298- const struct nk_user_font * font , const struct nk_input * in )
300+ const struct nk_user_font * font , struct nk_input * in )
299301{
300302 int ret ;
301303 struct nk_rect tri = {0 ,0 ,0 ,0 };
@@ -352,7 +354,7 @@ nk_do_button_text_image(nk_flags *state,
352354 struct nk_command_buffer * out , struct nk_rect bounds ,
353355 struct nk_image img , const char * str , int len , nk_flags align ,
354356 enum nk_button_behavior behavior , const struct nk_style_button * style ,
355- const struct nk_user_font * font , const struct nk_input * in )
357+ const struct nk_user_font * font , struct nk_input * in )
356358{
357359 int ret ;
358360 struct nk_rect icon ;
@@ -434,7 +436,7 @@ nk_button_text_styled(struct nk_context *ctx,
434436{
435437 struct nk_window * win ;
436438 struct nk_panel * layout ;
437- const struct nk_input * in ;
439+ struct nk_input * in ;
438440
439441 struct nk_rect bounds ;
440442 enum nk_widget_layout_states state ;
@@ -476,7 +478,7 @@ nk_button_color(struct nk_context *ctx, struct nk_color color)
476478{
477479 struct nk_window * win ;
478480 struct nk_panel * layout ;
479- const struct nk_input * in ;
481+ struct nk_input * in ;
480482 struct nk_style_button button ;
481483
482484 int ret = 0 ;
@@ -512,7 +514,7 @@ nk_button_symbol_styled(struct nk_context *ctx,
512514{
513515 struct nk_window * win ;
514516 struct nk_panel * layout ;
515- const struct nk_input * in ;
517+ struct nk_input * in ;
516518
517519 struct nk_rect bounds ;
518520 enum nk_widget_layout_states state ;
@@ -544,7 +546,7 @@ nk_button_image_styled(struct nk_context *ctx, const struct nk_style_button *sty
544546{
545547 struct nk_window * win ;
546548 struct nk_panel * layout ;
547- const struct nk_input * in ;
549+ struct nk_input * in ;
548550
549551 struct nk_rect bounds ;
550552 enum nk_widget_layout_states state ;
@@ -578,7 +580,7 @@ nk_button_symbol_text_styled(struct nk_context *ctx,
578580{
579581 struct nk_window * win ;
580582 struct nk_panel * layout ;
581- const struct nk_input * in ;
583+ struct nk_input * in ;
582584
583585 struct nk_rect bounds ;
584586 enum nk_widget_layout_states state ;
@@ -625,7 +627,7 @@ nk_button_image_text_styled(struct nk_context *ctx,
625627{
626628 struct nk_window * win ;
627629 struct nk_panel * layout ;
628- const struct nk_input * in ;
630+ struct nk_input * in ;
629631
630632 struct nk_rect bounds ;
631633 enum nk_widget_layout_states state ;
0 commit comments