wlmaker
Loading...
Searching...
No Matches
Classes | Functions | Variables
launcher.c File Reference
#include "launcher.h"
#include <cairo.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <limits.h>
#include <linux/input-event-codes.h>
#include <stdbool.h>
#include <stdlib.h>
#include "toolkit/toolkit.h"
Include dependency graph for launcher.c:

Classes

struct  _wlmaker_launcher_t
 

Functions

static void _wlmaker_launcher_update_overlay (wlmaker_launcher_t *launcher_ptr)
 
static struct wlr_buffer * _wlmaker_launcher_create_overlay_buffer (wlmaker_launcher_t *launcher_ptr)
 
static void _wlmaker_launcher_element_destroy (wlmtk_element_t *element_ptr)
 
static bool _wlmaker_launcher_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
 
static void _wlmaker_launcher_start (wlmaker_launcher_t *launcher_ptr)
 
static void _wlmaker_launcher_handle_terminated (void *userdata_ptr, wlmaker_subprocess_handle_t *subprocess_handle_ptr, int state, int code)
 
static void _wlmaker_launcher_handle_window_created (void *userdata_ptr, wlmaker_subprocess_handle_t *subprocess_handle_ptr, wlmtk_window_t *window_ptr)
 
static void _wlmaker_launcher_handle_window_mapped (void *userdata_ptr, wlmaker_subprocess_handle_t *subprocess_handle_ptr, wlmtk_window_t *window_ptr)
 
static void _wlmaker_launcher_handle_window_unmapped (void *userdata_ptr, wlmaker_subprocess_handle_t *subprocess_handle_ptr, wlmtk_window_t *window_ptr)
 
static void _wlmaker_launcher_handle_window_destroyed (void *userdata_ptr, wlmaker_subprocess_handle_t *subprocess_handle_ptr, wlmtk_window_t *window_ptr)
 
wlmaker_launcher_twlmaker_launcher_create_from_plist (const wlmtk_tile_style_t *style_ptr, bspl_dict_t *dict_ptr, wlmaker_subprocess_monitor_t *monitor_ptr)
 
void wlmaker_launcher_destroy (wlmaker_launcher_t *launcher_ptr)
 
wlmtk_tile_twlmaker_launcher_tile (wlmaker_launcher_t *launcher_ptr)
 
static void test_create_from_plist (bs_test_t *test_ptr)
 

Variables

static const bspl_desc_t _wlmaker_launcher_plist_desc []
 
static const char * lookup_paths []
 
static const wlmtk_element_vmt_t _wlmaker_launcher_element_vmt
 
const bs_test_case_t wlmaker_launcher_test_cases []
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _wlmaker_launcher_create_overlay_buffer()

struct wlr_buffer * _wlmaker_launcher_create_overlay_buffer ( wlmaker_launcher_t launcher_ptr)
static

Creates an overlay wlr_buffer.

◆ _wlmaker_launcher_element_destroy()

void _wlmaker_launcher_element_destroy ( wlmtk_element_t element_ptr)
static

Implements wlmtk_element_vmt_t::destroy. Calls wlmaker_launcher_destroy.

Parameters
element_ptr

◆ _wlmaker_launcher_handle_terminated()

void _wlmaker_launcher_handle_terminated ( void *  userdata_ptr,
wlmaker_subprocess_handle_t subprocess_handle_ptr,
int  exit_status,
int  signal_number 
)
static

Callback handler for when the registered subprocess terminates.

Parameters
userdata_ptrPoints to wlmaker_launcher_t.
subprocess_handle_ptr
exit_status
signal_number

◆ _wlmaker_launcher_handle_window_created()

void _wlmaker_launcher_handle_window_created ( void *  userdata_ptr,
wlmaker_subprocess_handle_t subprocess_handle_ptr,
wlmtk_window_t window_ptr 
)
static

Callback for then a window from the launched subprocess is created.

Registers the windows as "created", and will then redraw the launcher tile to reflect potential status changes.

Parameters
userdata_ptrPoints to the wlmaker_launcher_t.
subprocess_handle_ptr
window_ptr

◆ _wlmaker_launcher_handle_window_destroyed()

void _wlmaker_launcher_handle_window_destroyed ( void *  userdata_ptr,
wlmaker_subprocess_handle_t subprocess_handle_ptr,
wlmtk_window_t window_ptr 
)
static

Callback for then a window from the launched subprocess is destroyed.

Removes the window from the set of "created" windows, and will then redraw the launcher tile to reflect potential status changes.

Parameters
userdata_ptrPoints to the wlmaker_launcher_t.
subprocess_handle_ptr
window_ptr

◆ _wlmaker_launcher_handle_window_mapped()

void _wlmaker_launcher_handle_window_mapped ( void *  userdata_ptr,
wlmaker_subprocess_handle_t subprocess_handle_ptr,
wlmtk_window_t window_ptr 
)
static

Callback for then a window from the launched subprocess is mapped.

Registers the window as "mapped", and will then redraw the launcher tile to reflect potential status changes.

Parameters
userdata_ptrPoints to the wlmaker_launcher_t.
subprocess_handle_ptr
window_ptr

◆ _wlmaker_launcher_handle_window_unmapped()

void _wlmaker_launcher_handle_window_unmapped ( void *  userdata_ptr,
wlmaker_subprocess_handle_t subprocess_handle_ptr,
wlmtk_window_t window_ptr 
)
static

Callback for then a window from the launched subprocess is unmapped.

Removes the window from the set of "mapped" windows, and will then redraw the launcher tile to reflect potential status changes.

Parameters
userdata_ptrPoints to the wlmaker_launcher_t.
subprocess_handle_ptr
window_ptr

◆ _wlmaker_launcher_pointer_button()

bool _wlmaker_launcher_pointer_button ( wlmtk_element_t element_ptr,
const wlmtk_button_event_t button_event_ptr 
)
static

Implements wlmtk_element_vmt_t::pointer_button.

Parameters
element_ptr
button_event_ptr
Returns
true always.

◆ _wlmaker_launcher_start()

void _wlmaker_launcher_start ( wlmaker_launcher_t launcher_ptr)
static

Starts the application, called when the launcher is clicked.

Parameters
launcher_ptr

◆ _wlmaker_launcher_update_overlay()

void _wlmaker_launcher_update_overlay ( wlmaker_launcher_t launcher_ptr)
static

Redraws the overlay element.

◆ test_create_from_plist()

void test_create_from_plist ( bs_test_t *  test_ptr)
static

Exercises plist parser.

◆ wlmaker_launcher_create_from_plist()

wlmaker_launcher_t * wlmaker_launcher_create_from_plist ( const wlmtk_tile_style_t style_ptr,
bspl_dict_t *  dict_ptr,
wlmaker_subprocess_monitor_t monitor_ptr 
)

Creates an application launcher, configured from a plist dict.

Parameters
style_ptr
dict_ptr
monitor_ptr
Returns
Pointer to the launcher handle or NULL on error.

◆ wlmaker_launcher_destroy()

void wlmaker_launcher_destroy ( wlmaker_launcher_t launcher_ptr)

Destroys the application launcher.

Parameters
launcher_ptr

◆ wlmaker_launcher_tile()

wlmtk_tile_t * wlmaker_launcher_tile ( wlmaker_launcher_t launcher_ptr)
Returns
A pointer to the wlmtk_tile_t superclass of launcher_ptr.

Variable Documentation

◆ _wlmaker_launcher_element_vmt

const wlmtk_element_vmt_t _wlmaker_launcher_element_vmt
static
Initial value:
= {
}
static bool _wlmaker_launcher_pointer_button(wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
Definition launcher.c:350
static void _wlmaker_launcher_element_destroy(wlmtk_element_t *element_ptr)
Definition launcher.c:332

The launcher's extension to wlmtk_element_t virtual method table.

◆ _wlmaker_launcher_plist_desc

const bspl_desc_t _wlmaker_launcher_plist_desc[]
static
Initial value:
= {
BSPL_DESC_STRING(
"CommandLine", true, wlmaker_launcher_t, cmdline_ptr, cmdline_ptr, ""),
BSPL_DESC_STRING(
"Icon", true, wlmaker_launcher_t, icon_path_ptr, icon_path_ptr, ""),
BSPL_DESC_SENTINEL(),
}
Definition launcher.c:36

Plist descroptor for a launcher.

◆ lookup_paths

const char* lookup_paths[]
static
Initial value:
= {
"/usr/share/icons/wlmaker",
"/usr/local/share/icons/wlmaker",
NULL
}

Lookup paths for icons.

◆ wlmaker_launcher_test_cases

const bs_test_case_t wlmaker_launcher_test_cases[]
Initial value:
= {
{ 1, "create_from_plist", test_create_from_plist },
{ 0, NULL, NULL }
}
static void test_create_from_plist(bs_test_t *test_ptr)
Definition launcher.c:560

Unit tests.