1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Restructuring, my biggest joy.

This commit is contained in:
Dave Davenport 2016-02-06 14:27:36 +01:00
parent 73169af793
commit adfc83f07d
7 changed files with 1624 additions and 1588 deletions

View file

@ -83,17 +83,6 @@ int show_error_message ( const char *msg, int markup );
" * The version of rofi you are running\n\n" \
" <i>https://github.com/DaveDavenport/rofi/</i>"
#define ERROR_MSG_MARKUP TRUE
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
void rofi_view_itterrate ( RofiViewState *state, XEvent *event );
unsigned int rofi_view_get_completed ( const RofiViewState *state );
const char * rofi_view_get_user_input ( const RofiViewState *state );
void rofi_view_free ( RofiViewState *state );
void rofi_view_restart ( RofiViewState *state );
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
void rofi_view_queue_redraw ( void );
void rofi_view_set_active ( RofiViewState *state );
int locate_switcher ( KeySym key, unsigned int modstate );
/*@}*/
#endif

73
include/view-internal.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef ROFI_VIEW_INTERNAL_H
#define ROFI_VIEW_INTERNAL_H
#include "widget.h"
#include "textbox.h"
#include "scrollbar.h"
/**
* @ingroup View
*
* @{
*/
// State of the menu.
typedef struct RofiViewState
{
Mode *sw;
unsigned int menu_lines;
unsigned int max_elements;
unsigned int max_rows;
unsigned int columns;
// window width,height
unsigned int w, h;
int x, y;
unsigned int element_width;
int top_offset;
// Update/Refilter list.
int update;
int refilter;
int rchanged;
int cur_page;
// Entries
textbox *text;
textbox *prompt_tb;
textbox *message_tb;
textbox *case_indicator;
textbox **boxes;
scrollbar *scrollbar;
int *distance;
unsigned int *line_map;
unsigned int num_lines;
// Selected element.
unsigned int selected;
unsigned int filtered_lines;
// Last offset in paginating.
unsigned int last_offset;
KeySym prev_key;
Time last_button_press;
int quit;
int skip_absorb;
// Return state
unsigned int selected_line;
MenuReturn retv;
int *lines_not_ascii;
int line_height;
unsigned int border;
workarea mon;
// Sidebar view
ssize_t num_modi;
textbox **modi;
// Handlers.
void ( *x11_event_loop )( struct RofiViewState *state, XEvent *ev );
void ( *finalize )( struct RofiViewState *state );
}RofiViewState;
/** @} */
#endif

View file

@ -1,63 +1,13 @@
#ifndef ROFI_VIEW_H
#define ROFI_VIEW_H
// State of the menu.
typedef struct RofiViewState
{
Mode *sw;
unsigned int menu_lines;
unsigned int max_elements;
unsigned int max_rows;
unsigned int columns;
// window width,height
unsigned int w, h;
int x, y;
unsigned int element_width;
int top_offset;
// Update/Refilter list.
int update;
int refilter;
int rchanged;
int cur_page;
// Entries
textbox *text;
textbox *prompt_tb;
textbox *message_tb;
textbox *case_indicator;
textbox **boxes;
scrollbar *scrollbar;
int *distance;
unsigned int *line_map;
unsigned int num_lines;
// Selected element.
unsigned int selected;
unsigned int filtered_lines;
// Last offset in paginating.
unsigned int last_offset;
KeySym prev_key;
Time last_button_press;
int quit;
int skip_absorb;
// Return state
unsigned int selected_line;
MenuReturn retv;
int *lines_not_ascii;
int line_height;
unsigned int border;
workarea mon;
ssize_t num_modi;
textbox **modi;
// Handlers.
void ( *x11_event_loop )( struct RofiViewState *state, XEvent *ev );
void ( *finalize )( struct RofiViewState *state );
}RofiViewState;
/**
* @defgroup View View
*
* The rofi Menu view.
*
* @{
*/
/**
* @param state The Menu Handle
@ -67,3 +17,24 @@ typedef struct RofiViewState
void rofi_view_finalize ( RofiViewState *state );
RofiViewState * rofi_view_state_create ( void );
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
void rofi_view_itterrate ( RofiViewState *state, XEvent *event );
unsigned int rofi_view_get_completed ( const RofiViewState *state );
const char * rofi_view_get_user_input ( const RofiViewState *state );
void rofi_view_free ( RofiViewState *state );
void rofi_view_restart ( RofiViewState *state );
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
void rofi_view_queue_redraw ( void );
void rofi_view_set_active ( RofiViewState *state );
void rofi_view_call_thread ( gpointer data, gpointer user_data );
void menu_update ( RofiViewState *state );
void menu_setup_fake_transparency ( Display *display, RofiViewState *state );
void rofi_view_cleanup ( void );
/** @} */
#endif

View file

@ -40,7 +40,7 @@
#include "dialogs/dmenu.h"
#include "helper.h"
#include "xrmoptions.h"
#include "view.h"
// We limit at 1000000 rows for now.
#define DMENU_MAX_ROWS 1000000

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@ unsigned int normal_window_mode = 0;
Display *display = NULL;
Colormap map = None;
XVisualInfo vinfo;
#include "view.h"
void rofi_view_queue_redraw ()
{
}